From 22a3562f76b5bfcc66baf0f8cd7cbf6a7212d011 Mon Sep 17 00:00:00 2001 From: Daniel Manrique Date: Tue, 27 Jan 2015 17:29:38 -0500 Subject: 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. --- bin/piglit_test | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'bin') 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])) -- cgit v1.2.3