diff options
author | Daniel Manrique <roadmr@ubuntu.com> | 2015-01-27 17:29:38 -0500 |
---|---|---|
committer | Daniel Manrique <roadmr@ubuntu.com> | 2015-01-27 17:29:38 -0500 |
commit | 22a3562f76b5bfcc66baf0f8cd7cbf6a7212d011 (patch) | |
tree | b98d7048a780f64f728e5d01a6635a4a2582b2c9 /bin | |
parent | d87de2135edeed392bf271ee9a0c2ce0f87f7422 (diff) |
providers:checkbox: piglit_test should call piglit in verbose mode
This is required because piglit output changed and now our parser's expectations are only met by verbose mode. Also, fixed the logic a bit so if our parser didn't parse any results, a loud warning and an error code will be generated, instead of a misleading successful exit code and cryptic "0 tests passed" message.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/piglit_test | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/bin/piglit_test b/bin/piglit_test index c8eacfc..24ef6c7 100755 --- a/bin/piglit_test +++ b/bin/piglit_test @@ -20,7 +20,9 @@ class PiglitTests: log_path = os.path.join(os.environ.get('CHECKBOX_DATA', '.'), 'piglit-results', self._name) - run_command = ["piglit-run.py"] + # Need to run in verbose mode to produce output compatible with + # our parser. + run_command = ["piglit-run.py", "-v"] for test in self._tests: run_command.extend(["-t", test]) @@ -42,10 +44,12 @@ class PiglitTests: self._results[line.split(' :: ')[-1].strip()] = \ line.split(' :: ')[-2].strip() - def get_tests_by_status(self, status): + def get_tests_by_status(self, status=None): """ Return a list of the tests with the given status in the last piglit run """ + if not status: + return self._results tests = [] for test in self._results: if self._results[test] == status: @@ -74,8 +78,15 @@ def main(): piglit = PiglitTests(args.test, args.name) piglit.run() + if not piglit.get_tests_by_status(): + print("WARNING: Test summary is empty, piglit output may have " + "changed. Exiting with error to ensure a human " + "looks at this.") + return 2 + passed_tests = piglit.get_tests_by_status('pass') - print("%d tests passed" % len(passed_tests)) + if passed_tests: + print("%d tests passed" % len(passed_tests)) if args.verbose: print("\n".join(["- %s" % test for test in passed_tests])) |