ci/lava: handle non-zero exit codes
The LAVA job submitter always exits with code 1, regardless of the HWCI_TEST_SCRIPT's exit code. This commit fixes the LAVA job submitter to exit with the actual code returned by the test. Signed-off-by: Vignesh Raman <vignesh.raman@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31189>
This commit is contained in:
@@ -505,9 +505,10 @@ class LAVAJobSubmitter(PathResolver):
|
||||
raise SystemExit(1)
|
||||
|
||||
STRUCTURAL_LOG["job_combined_status"] = last_attempt_job.status
|
||||
STRUCTURAL_LOG["job_exit_code"] = last_attempt_job.exit_code
|
||||
|
||||
if last_attempt_job.status != "pass":
|
||||
raise SystemExit(1)
|
||||
raise SystemExit(last_attempt_job.exit_code)
|
||||
|
||||
|
||||
class StructuredLoggerWrapper:
|
||||
@@ -520,6 +521,7 @@ class StructuredLoggerWrapper:
|
||||
STRUCTURAL_LOG["farm"] = self.__submitter.farm
|
||||
STRUCTURAL_LOG["job_combined_fail_reason"] = None
|
||||
STRUCTURAL_LOG["job_combined_status"] = "not_submitted"
|
||||
STRUCTURAL_LOG["job_exit_code"] = None
|
||||
STRUCTURAL_LOG["dut_attempt_counter"] = 0
|
||||
|
||||
# Initialize dut_jobs list to enable appends
|
||||
|
@@ -35,6 +35,7 @@ class LAVAJob:
|
||||
self._is_finished = False
|
||||
self.log: dict[str, Any] = log
|
||||
self.status = "not_submitted"
|
||||
self._exit_code = None
|
||||
self.__exception: Optional[Exception] = None
|
||||
|
||||
def heartbeat(self) -> None:
|
||||
@@ -50,6 +51,15 @@ class LAVAJob:
|
||||
self._status = new_status
|
||||
self.log["status"] = self._status
|
||||
|
||||
@property
|
||||
def exit_code(self) -> int:
|
||||
return self._exit_code
|
||||
|
||||
@exit_code.setter
|
||||
def exit_code(self, code: int) -> None:
|
||||
self._exit_code = code
|
||||
self.log["exit_code"] = self._exit_code
|
||||
|
||||
@property
|
||||
def job_id(self) -> int:
|
||||
return self._job_id
|
||||
@@ -158,9 +168,10 @@ class LAVAJob:
|
||||
last_line = None # Print all lines. lines[:None] == lines[:]
|
||||
|
||||
for idx, line in enumerate(lava_lines):
|
||||
if result := re.search(r"hwci: mesa: (pass|fail)", line):
|
||||
if result := re.search(r"hwci: mesa: (pass|fail), exit_code: (\d+)", line):
|
||||
self._is_finished = True
|
||||
self.status = result[1]
|
||||
self.status = result.group(1)
|
||||
self.exit_code = int(result.group(2))
|
||||
|
||||
last_line = idx + 1
|
||||
# We reached the log end here. hwci script has finished.
|
||||
|
Reference in New Issue
Block a user