ci/lava: Improve result parsing regex
LAVA job logs have an ongoing problem of message interleaving with kmsg. So any kernel dumps and LAVA signals (which are being printed in kmsg) will have a chance to clutter the pattern matching for `hwci: mesa: (pass|fail)` line. v2: - Add an 1 second sleep before exiting the test script, to give enough time to print the result message without conflicting with LAVA ENDTC signal from kmsg Closes: #6714 Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17175>
This commit is contained in:
parent
58313f3257
commit
3b8d10d270
|
@ -157,5 +157,9 @@ 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
|
||||
|
||||
set +x
|
||||
echo "hwci: mesa: $RESULT"
|
||||
# Sleep a bit to avoid kernel dump message interleave from LAVA ENDTC signal
|
||||
sleep 1
|
||||
exit $EXIT_CODE
|
||||
|
|
|
@ -313,7 +313,7 @@ class LAVAJob:
|
|||
"""
|
||||
log_lines = [l["msg"] for l in lava_lines if l["lvl"] == "target"]
|
||||
for line in log_lines:
|
||||
if result := re.search(r"hwci: mesa: (\S*)", line):
|
||||
if result := re.search(r"hwci: mesa: (pass|fail)", line):
|
||||
self.is_finished = True
|
||||
self.status = result.group(1)
|
||||
color = LAVAJob.color_status_map.get(self.status, CONSOLE_LOG_COLOR_RED)
|
||||
|
|
|
@ -421,6 +421,7 @@ GITLAB_SECTION_MANGLED_SCENARIOS = {
|
|||
),
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"message, fixed_message",
|
||||
GITLAB_SECTION_MANGLED_SCENARIOS.values(),
|
||||
|
@ -464,3 +465,51 @@ LAVA_DEBUG_SPAM_MESSAGES = {
|
|||
)
|
||||
def test_filter_debug_messages(message, expectation):
|
||||
assert filter_debug_messages(message) == expectation
|
||||
|
||||
|
||||
LAVA_RESULT_LOG_SCENARIOS = {
|
||||
# the submitter should accept xtrace logs
|
||||
"Bash xtrace echo with kmsg interleaving": (
|
||||
create_lava_yaml_msg(
|
||||
msg="echo hwci: mesa: pass[ 737.673352] <LAVA_SIGNAL_ENDTC mesa-ci>",
|
||||
lvl="target",
|
||||
),
|
||||
"pass",
|
||||
),
|
||||
# the submitter should accept xtrace logs
|
||||
"kmsg result print": (
|
||||
create_lava_yaml_msg(
|
||||
msg="[ 737.673352] hwci: mesa: pass",
|
||||
lvl="target",
|
||||
),
|
||||
"pass",
|
||||
),
|
||||
# if the job result echo has a very bad luck, it still can be interleaved
|
||||
# with kmsg
|
||||
"echo output with kmsg interleaving": (
|
||||
create_lava_yaml_msg(
|
||||
msg="hwci: mesa: pass[ 737.673352] <LAVA_SIGNAL_ENDTC mesa-ci>",
|
||||
lvl="target",
|
||||
),
|
||||
"pass",
|
||||
),
|
||||
"fail case": (
|
||||
create_lava_yaml_msg(
|
||||
msg="hwci: mesa: fail",
|
||||
lvl="target",
|
||||
),
|
||||
"fail",
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"message, expectation",
|
||||
LAVA_RESULT_LOG_SCENARIOS.values(),
|
||||
ids=LAVA_RESULT_LOG_SCENARIOS.keys(),
|
||||
)
|
||||
def test_filter_debug_messages(message, expectation, mock_proxy):
|
||||
job = LAVAJob(mock_proxy(), "")
|
||||
job.parse_job_result_from_log([message])
|
||||
|
||||
assert job.status == expectation
|
||||
|
|
Loading…
Reference in New Issue