From 5a5b00cfcab885852a1b3059f9a7154b3d5aa287 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Wed, 28 May 2025 19:13:16 +0200 Subject: [PATCH] ci: drop unneeded printing of `pass`/`fail` alongside the exit_code Part-of: --- .gitlab-ci/bare-metal/poe_run.py | 7 +++---- .gitlab-ci/common/init-stage2.sh | 6 +----- .gitlab-ci/image-tags.yml | 2 +- .gitlab-ci/lava/lava_job_submitter.py | 2 +- .gitlab-ci/lava/utils/lava_job.py | 6 +++--- .gitlab-ci/test/gitlab-ci.yml | 2 +- .gitlab-ci/tests/lava/helpers.py | 4 ++-- .gitlab-ci/tests/test_lava_job_submitter.py | 10 +++++----- 8 files changed, 17 insertions(+), 22 deletions(-) diff --git a/.gitlab-ci/bare-metal/poe_run.py b/.gitlab-ci/bare-metal/poe_run.py index c987c39d965..d9c884104ad 100755 --- a/.gitlab-ci/bare-metal/poe_run.py +++ b/.gitlab-ci/bare-metal/poe_run.py @@ -87,12 +87,11 @@ class PoERun: self.print_error("nouveau jetson tk1 network fail, abandoning run.") return 1 - result = re.search(r"hwci: mesa: (\S*), exit_code: (\d+)", line) + result = re.search(r"hwci: mesa: exit_code: (\d+)", line) if result: - status = result.group(1) - exit_code = int(result.group(2)) + exit_code = int(result.group(1)) - if status == "pass": + if exit_code == 0: self.logger.update_dut_job("status", "pass") else: self.logger.update_status_fail("test fail") diff --git a/.gitlab-ci/common/init-stage2.sh b/.gitlab-ci/common/init-stage2.sh index 5e776fc9acb..e1bb4f860cd 100755 --- a/.gitlab-ci/common/init-stage2.sh +++ b/.gitlab-ci/common/init-stage2.sh @@ -229,10 +229,6 @@ if [ -n "$S3_RESULTS_UPLOAD" ]; then ci-fairy s3cp --token-file "${S3_JWT_FILE}" results.tar.zst https://"$S3_RESULTS_UPLOAD"/results.tar.zst fi -# We still need to echo the hwci: mesa message, as some scripts rely on it, such -# as the python ones inside the bare-metal folder -[ ${EXIT_CODE} -eq 0 ] && RESULT=pass || RESULT=fail - set +x section_end post_test_cleanup @@ -240,6 +236,6 @@ section_end post_test_cleanup # the result of our run, so try really hard to get it out rather than losing # the run. The device gets shut down right at this point, and a630 seems to # enjoy corrupting the last line of serial output before shutdown. -for _ in $(seq 0 3); do echo "hwci: mesa: $RESULT, exit_code: $EXIT_CODE"; sleep 1; echo; done +for _ in $(seq 0 3); do echo "hwci: mesa: exit_code: $EXIT_CODE"; sleep 1; echo; done exit $EXIT_CODE diff --git a/.gitlab-ci/image-tags.yml b/.gitlab-ci/image-tags.yml index c37328f4672..17724c0cadb 100644 --- a/.gitlab-ci/image-tags.yml +++ b/.gitlab-ci/image-tags.yml @@ -30,7 +30,7 @@ variables: ALPINE_X86_64_BUILD_TAG: "20250423-rootfs" ALPINE_X86_64_LAVA_SSH_TAG: "20250423-rootfs" - ALPINE_X86_64_LAVA_TRIGGER_TAG: "20250526-byeutils" + ALPINE_X86_64_LAVA_TRIGGER_TAG: "20250529-passfail" FEDORA_X86_64_BUILD_TAG: "20250423-rootfs" diff --git a/.gitlab-ci/lava/lava_job_submitter.py b/.gitlab-ci/lava/lava_job_submitter.py index b6ce929096b..ee36f47b401 100755 --- a/.gitlab-ci/lava/lava_job_submitter.py +++ b/.gitlab-ci/lava/lava_job_submitter.py @@ -260,7 +260,7 @@ def follow_job_execution(job, log_follower): raise_lava_error(job) # LogFollower does some cleanup after the early exit (trigger by - # `hwci: pass|fail` regex), let's update the phases after the cleanup. + # `hwci: mesa: exit_code: \d+` regex), let's update the phases after the cleanup. structural_log_phases(job, log_follower) diff --git a/.gitlab-ci/lava/utils/lava_job.py b/.gitlab-ci/lava/utils/lava_job.py index 4dcd2c0cf26..6b16f1e7376 100644 --- a/.gitlab-ci/lava/utils/lava_job.py +++ b/.gitlab-ci/lava/utils/lava_job.py @@ -175,10 +175,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), exit_code: (\d+)", line): + if result := re.search(r"hwci: mesa: exit_code: (\d+)", line): self._is_finished = True - self.status = result.group(1) - self.exit_code = int(result.group(2)) + self.exit_code = int(result.group(1)) + self.status = "pass" if self.exit_code == 0 else "fail" last_line = idx # We reached the log end here. hwci script has finished. diff --git a/.gitlab-ci/test/gitlab-ci.yml b/.gitlab-ci/test/gitlab-ci.yml index 84fad43e2f7..bb58871cb50 100644 --- a/.gitlab-ci/test/gitlab-ci.yml +++ b/.gitlab-ci/test/gitlab-ci.yml @@ -393,7 +393,7 @@ yaml-toml-shell-py-test: SCRIPTS_DIR: install - CI_TRON_PATTERN__JOB_SUCCESS__REGEX: 'hwci: mesa: pass, exit_code: 0\r$' + CI_TRON_PATTERN__JOB_SUCCESS__REGEX: 'hwci: mesa: exit_code: 0\r$' CI_TRON_PATTERN__SESSION_END__REGEX: '^.*It''s now safe to turn off your computer\r$' CI_TRON_TIMEOUT__FIRST_CONSOLE_ACTIVITY__MINUTES: 2 diff --git a/.gitlab-ci/tests/lava/helpers.py b/.gitlab-ci/tests/lava/helpers.py index 60ed6ee2985..11ec209ab7f 100644 --- a/.gitlab-ci/tests/lava/helpers.py +++ b/.gitlab-ci/tests/lava/helpers.py @@ -49,7 +49,7 @@ def jobs_logs_response( timed_msg = {"dt": str(datetime.now(tz=UTC)), "msg": "New message", "lvl": lvl} if result: timed_msg["lvl"] = "target" - timed_msg["msg"] = f"hwci: mesa: {result}, exit_code: {exit_code}" + timed_msg["msg"] = f"hwci: mesa: exit_code: {exit_code}" logs = [timed_msg] if msg is None else msg @@ -72,7 +72,7 @@ def section_aware_message_generator( if result and section_type == result_message_section: # To consider the job finished, the result `echo` should be produced # in the correct section - yield create_lava_yaml_msg(msg=f"hwci: mesa: {result}, exit_code: {exit_code}"), delay + yield create_lava_yaml_msg(msg=f"hwci: mesa: exit_code: {exit_code}"), delay def message_generator(): diff --git a/.gitlab-ci/tests/test_lava_job_submitter.py b/.gitlab-ci/tests/test_lava_job_submitter.py index 4df2c8014f3..bd2726ceebf 100644 --- a/.gitlab-ci/tests/test_lava_job_submitter.py +++ b/.gitlab-ci/tests/test_lava_job_submitter.py @@ -337,27 +337,27 @@ def test_log_corruption(mock_sleep, data_sequence, expected_exception, mock_prox LAVA_RESULT_LOG_SCENARIOS = { # the submitter should accept xtrace logs "Bash xtrace echo with kmsg interleaving": ( - "echo hwci: mesa: pass, exit_code: 0[ 737.673352] ", + "echo hwci: mesa: exit_code: 0[ 737.673352] ", "pass", 0, ), # the submitter should accept xtrace logs "kmsg result print": ( - "[ 737.673352] hwci: mesa: pass, exit_code: 0", + "[ 737.673352] hwci: mesa: exit_code: 0", "pass", 0, ), # if the job result echo has a very bad luck, it still can be interleaved # with kmsg "echo output with kmsg interleaving": ( - "hwci: mesa: pass, exit_code: 0[ 737.673352] ", + "hwci: mesa: exit_code: 0[ 737.673352] ", "pass", 0, ), "fail case": ( - "hwci: mesa: fail, exit_code: 1", + "hwci: mesa: exit_code: 1", "fail", 1, ), # fail case with different exit code "fail case (exit code 101)": ( - "hwci: mesa: fail, exit_code: 101", + "hwci: mesa: exit_code: 101", "fail", 101, ), }