From 1f9f7ae1125dc9e53900a7b11a7116154881c00e Mon Sep 17 00:00:00 2001 From: Vignesh Raman Date: Thu, 19 Sep 2024 07:02:13 +0530 Subject: [PATCH] ci/bare-metal: handle non-zero exit codes The fastboot/poe/cros-servo scripts always exits with code 1, regardless of the HWCI_TEST_SCRIPT's exit code. This commit fixes these scripts to exit with the actual code returned by the test. Signed-off-by: Vignesh Raman Part-of: --- .gitlab-ci/bare-metal/cros_servo_run.py | 12 ++++++++---- .gitlab-ci/bare-metal/fastboot_run.py | 10 +++++----- .gitlab-ci/bare-metal/poe_run.py | 12 ++++++++---- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci/bare-metal/cros_servo_run.py b/.gitlab-ci/bare-metal/cros_servo_run.py index 4b4487154b0..bb9d222a728 100755 --- a/.gitlab-ci/bare-metal/cros_servo_run.py +++ b/.gitlab-ci/bare-metal/cros_servo_run.py @@ -127,14 +127,18 @@ class CrosServoRun: self.print_error("Detected cheza MMU fail, abandoning run.") return 1 - result = re.search("hwci: mesa: (\S*)", line) + result = re.search(r"hwci: mesa: (\S*), exit_code: (\d+)", line) if result: - if result.group(1) == "pass": + status = result.group(1) + exit_code = int(result.group(2)) + + if status == "pass": self.logger.update_dut_job("status", "pass") - return 0 else: self.logger.update_status_fail("test fail") - return 1 + + self.logger.update_dut_job("exit_code", exit_code) + return exit_code self.print_error( "Reached the end of the CPU serial log without finding a result") diff --git a/.gitlab-ci/bare-metal/fastboot_run.py b/.gitlab-ci/bare-metal/fastboot_run.py index ca3229f6d28..f0637040023 100755 --- a/.gitlab-ci/bare-metal/fastboot_run.py +++ b/.gitlab-ci/bare-metal/fastboot_run.py @@ -119,12 +119,12 @@ class FastbootRun: if print_more_lines == -1: print_more_lines = 30 - result = re.search("hwci: mesa: (\S*)", line) + result = re.search(r"hwci: mesa: (\S*), exit_code: (\d+)", line) if result: - if result.group(1) == "pass": - return 0 - else: - return 1 + status = result.group(1) + exit_code = int(result.group(2)) + + return exit_code self.print_error( "Reached the end of the CPU serial log without finding a result, abandoning run.") diff --git a/.gitlab-ci/bare-metal/poe_run.py b/.gitlab-ci/bare-metal/poe_run.py index e015625abd3..1a617e18aa3 100755 --- a/.gitlab-ci/bare-metal/poe_run.py +++ b/.gitlab-ci/bare-metal/poe_run.py @@ -87,14 +87,18 @@ class PoERun: self.print_error("nouveau jetson tk1 network fail, abandoning run.") return 1 - result = re.search("hwci: mesa: (\S*)", line) + result = re.search(r"hwci: mesa: (\S*), exit_code: (\d+)", line) if result: - if result.group(1) == "pass": + status = result.group(1) + exit_code = int(result.group(2)) + + if status == "pass": self.logger.update_dut_job("status", "pass") - return 0 else: self.logger.update_status_fail("test fail") - return 1 + + self.logger.update_dut_job("exit_code", exit_code) + return exit_code self.print_error( "Reached the end of the CPU serial log without finding a result")