ci/lava: propely report test failure through sys.exit()

We added lava_job_submitter.py to improve our robusteness, but
the final result reporting was not handled correctly by the script.

This change fix it by properly calling sys.exit() on failures.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11218>
This commit is contained in:
Gustavo Padovan
2021-06-07 08:03:24 -03:00
committed by Marge Bot
parent 21b0a4c80c
commit a477dcf56a
+6 -4
View File
@@ -119,10 +119,12 @@ def get_job_results(proxy, job_id, test_suite, test_case):
results_yaml = _call_proxy(proxy.results.get_testcase_results_yaml, job_id, test_suite, test_case)
results = yaml.load(results_yaml, Loader=loader(False))
if results:
print_log("LAVA: result for test_suite '{}', test_case '{}': {}".format(test_suite, test_case, results[0]['result']))
else:
print_log("LAVA: no result for test_suite '{}', test_case '{}'".format(test_suite, test_case))
if not results:
sys.exit(log_msg("LAVA: no result for test_suite '{}', test_case '{}'".format(test_suite, test_case)))
print_log("LAVA: result for test_suite '{}', test_case '{}': {}".format(test_suite, test_case, results[0]['result']))
if results[0]['result'] != 'pass':
sys.exit(log_msg("FAIL"))
return True