This file is indexed.

/usr/share/checkbox/scripts/ltp_filter is in checkbox 0.13.7.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/python

import re
import sys

from optparse import OptionParser

# TPASS     The test case produced expected results.
# TFAIL     The test case produced unexpected results.
# TBROK     A resource needed to execute the test case was not available (e.g. a temporary file could not be opened).
# TCONF     The test case was not appropriate for the current hardware or software configuration (e.g. MLS was not enabled).
# TRETR     The test case was no longer valid and has been "retired."
# TWARN     The testing procedure caused undesirable side effects that did not affect test results (e.g. a temporary file could not be removed after all test results were recorded).
# TINFO     An informative message about the execution of the test that does not correspond to a test case result and does not indicate a problem.

ltp_to_checkox_status = {
    "TPASS": "pass",
    "TFAIL": "fail",
    "TBROK": "unresolved",
    "TCONF": "unsupported"}

def print_line(key, value):
    print "%s: %s" % (key, value)

def print_element(element):
    for key, value in element.iteritems():
        print_line(key, value)

    print

def parse_file(file):
    test_pattern = re.compile("(?P<case>\w+)\s+(?P<number>\d+)\s+(?P<status>[A-Z]+)\s+:\s+(?P<data>.*)")

    elements = []
    for line in file.readlines():
        match = test_pattern.match(line)
        if match:
            if match.group("status") in ltp_to_checkox_status:
                element = {
                    "plugin": "shell",
                    "name": "%s.%s" % (match.group("case"), match.group("number")),
                    "requires": "package.alias == 'linux'",
                    "description": "%s.%s" % (match.group("case"), match.group("number")),
                    "status": ltp_to_checkox_status[match.group("status")],
                    "data": match.group("data")}
                elements.append(element)

    return elements

def parse_filename(filename):
    if filename == "-":
        file = sys.stdin
    else:
        file = open(filename, "r")

    return parse_file(file)

def parse_filenames(filenames):
    elements = []
    for filename in filenames:
        elements.extend(parse_filename(filename))

    return elements

def main(args):
    usage = "Usage: %prog [FILE...]"
    parser = OptionParser(usage=usage)
    parser.add_option("-s", "--suite",
        help="Suite corresponding to the tests")
    (options, args) = parser.parse_args(args)

    if not args:
        filenames = ["-"]
    else:
        filenames = args

    elements = parse_filenames(filenames)
    if not elements:
        return 1

    for element in elements:
        if options.suite:
            element["suite"] = options.suite
        print_element(element)

    return 0


if __name__ == "__main__":
    sys.exit(main(sys.argv[1:]))