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

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 10 06:26:34 UTC 2021


Module: Mesa
Branch: main
Commit: a477dcf56a7dfe480c0962c046a44ca8a3231d81
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a477dcf56a7dfe480c0962c046a44ca8a3231d81

Author: Gustavo Padovan <gustavo.padovan at collabora.com>
Date:   Mon Jun  7 08:03:24 2021 -0300

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 at collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso at collabora.com>
Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11218>

---

 .gitlab-ci/lava_job_submitter.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci/lava_job_submitter.py b/.gitlab-ci/lava_job_submitter.py
index 2bd0b7322c1..6d6cb2a4365 100755
--- a/.gitlab-ci/lava_job_submitter.py
+++ b/.gitlab-ci/lava_job_submitter.py
@@ -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
 



More information about the mesa-commit mailing list