This file is indexed.

/usr/lib/2013.com.canonical.certification:checkbox/bin/piglit_test is in plainbox-provider-checkbox 0.4-1.

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
91
92
93
94
95
96
97
98
#!/usr/bin/python3

import os
import sys

from argparse import ArgumentParser, FileType
from subprocess import check_output, STDOUT


class PiglitTests:

    def __init__(self, tests, name):
        self._tests = tests
        self._name = name
        self._results = {}

    def run(self):
        piglit_output = ''
        
        log_path = os.path.join(os.environ.get('CHECKBOX_DATA', '.'),
                                    'piglit-results', self._name)

        run_command = ["piglit-run.py"]

        for test in self._tests:
            run_command.extend(["-t", test])

        run_command.extend(['/usr/share/piglit/tests/all.tests', log_path])

        piglit_output = check_output(run_command,
                                     universal_newlines=True,
                                     stderr=STDOUT)
        # TODO: Capture stderr instead?
        for line in piglit_output.split('\n'):
            if ' :: ' in line:
                self._results[line.split(' :: ')[-1].strip()] = \
                line.split(' :: ')[-2].strip()

    def get_tests_by_status(self, status):
        """
        Return a list of the tests with the given status in the last piglit run
        """
        tests = []
        for test in self._results:
            if self._results[test] == status:
                tests.append(test)

        return tests


def main():
    parser = ArgumentParser("A wrapper script for the Piglit graphics test "
                               "framework which runs the tests and parses the "
                               "results.")
    parser.add_argument("--test", "-t",
                        required=True,
                        action='append',
                        help="The expression used to get the tests to run.")
    parser.add_argument("--name", "-n",
                        required=True,
                        help="""A friendly name for this group of tests
                                to use in reporting.""")
    parser.add_argument("--verbose", "-v",
                        action='store_true',
                        help='Have more verbose output')
    args = parser.parse_args()

    piglit = PiglitTests(args.test, args.name)
    piglit.run()

    passed_tests = piglit.get_tests_by_status('pass')
    print("%d tests passed" % len(passed_tests))

    if args.verbose:
        print("\n".join(["- %s" % test for test in passed_tests]))

    failed_tests = piglit.get_tests_by_status('fail')
    if failed_tests:
        print("%d tests failed" % len(failed_tests))
        print("\n".join(["- %s" % test for test in failed_tests]))

    crashed_tests = piglit.get_tests_by_status('crash')
    if crashed_tests:
        print("%d tests crashed" % len(crashed_tests))
        print("\n".join(["- %s" % test for test in crashed_tests]))

    skipped_tests = piglit.get_tests_by_status('skip')
    if skipped_tests:
        print("%d tests were skipped" % len(skipped_tests))
        print("\n".join(["- %s" % test for test in skipped_tests]))

    if len(failed_tests) > 0 or len(crashed_tests) > 0:
        return 1
    else:
        return 0

if __name__ == "__main__":
    sys.exit(main())