From 60f50adfec1fadb9944459d83313a4daf6357d02 Mon Sep 17 00:00:00 2001 From: Vikas Katariya Date: Mon, 1 Aug 2022 08:58:45 +0100 Subject: [PATCH] cassini-ci: Fix `ptest-to-junit.py` The script doesn't accommodate for handling error when it encounters first test failure, therefore enable failure logging early and add a test case if none has been added. Signed-off-by: Vikas Katariya --- .gitlab/scripts/ptest-to-junit.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitlab/scripts/ptest-to-junit.py b/.gitlab/scripts/ptest-to-junit.py index f980140..4bd4411 100644 --- a/.gitlab/scripts/ptest-to-junit.py +++ b/.gitlab/scripts/ptest-to-junit.py @@ -42,17 +42,22 @@ def _parse_test_log(test_log): test_result = re.match(regex, line) test_name = test_result.group(3).split(":") - if len(test_name) == 1: - continue - if test_result.group(2) == "FAIL": collect_failure_log = True + if len(test_name) == 1: + continue + test_number += 1 test_case = TestCase(test_name[1], test_number, "", "", timestamp=test_result.group(1)) test_cases.append(test_case) + if test_number == 0: + test_case = TestCase(*test_name, test_number + 1, "", "", + timestamp=test_result.group(1)) + test_cases.append(test_case) + test_case.add_failure_info(output=failure_log) return TestSuite(test_log.stem, test_cases) -- GitLab