ci/lava: Filter out undesired messages
Some LAVA jobs emit lots of messages "Listened to connection for namespace 'common' for up to 1s" in a row at the end of the logs, making difficult to see the result of the test script. This commit removes those lines until a proper solution is deployed on the LAVA side. Closes: #6116 Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com> Acked-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17151>
This commit is contained in:

committed by
Marge Bot

parent
64d074879b
commit
cee1c4fc7f
@@ -402,6 +402,25 @@ def fix_lava_gitlab_section_log(line):
|
|||||||
line["msg"] = f"\x1b[0K{marker}:{timestamp}:{id_collapsible}\r\x1b[0K{header}"
|
line["msg"] = f"\x1b[0K{marker}:{timestamp}:{id_collapsible}\r\x1b[0K{header}"
|
||||||
|
|
||||||
|
|
||||||
|
def filter_debug_messages(line: dict[str, str]) -> bool:
|
||||||
|
"""Filter some LAVA debug messages that does not add much information to the
|
||||||
|
developer and may clutter the trace log."""
|
||||||
|
if line["lvl"] != "debug":
|
||||||
|
return False
|
||||||
|
# line["msg"] can be a list[str] when there is a kernel dump
|
||||||
|
if not isinstance(line["msg"], str):
|
||||||
|
return False
|
||||||
|
|
||||||
|
if re.match(
|
||||||
|
# Sometimes LAVA dumps this messages lots of times when the LAVA job is
|
||||||
|
# reaching the end.
|
||||||
|
r"^Listened to connection for namespace",
|
||||||
|
line["msg"],
|
||||||
|
):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def parse_lava_lines(new_lines) -> list[str]:
|
def parse_lava_lines(new_lines) -> list[str]:
|
||||||
parsed_lines: list[str] = []
|
parsed_lines: list[str] = []
|
||||||
for line in new_lines:
|
for line in new_lines:
|
||||||
@@ -413,6 +432,8 @@ def parse_lava_lines(new_lines) -> list[str]:
|
|||||||
elif line["lvl"] in ["warning", "error"]:
|
elif line["lvl"] in ["warning", "error"]:
|
||||||
prefix = CONSOLE_LOG_COLOR_RED
|
prefix = CONSOLE_LOG_COLOR_RED
|
||||||
suffix = CONSOLE_LOG_COLOR_RESET
|
suffix = CONSOLE_LOG_COLOR_RESET
|
||||||
|
elif filter_debug_messages(line):
|
||||||
|
continue
|
||||||
elif line["lvl"] == "input":
|
elif line["lvl"] == "input":
|
||||||
prefix = "$ "
|
prefix = "$ "
|
||||||
suffix = ""
|
suffix = ""
|
||||||
|
@@ -37,6 +37,7 @@ from lava.lava_job_submitter import (
|
|||||||
DEVICE_HANGING_TIMEOUT_SEC,
|
DEVICE_HANGING_TIMEOUT_SEC,
|
||||||
NUMBER_OF_RETRIES_TIMEOUT_DETECTION,
|
NUMBER_OF_RETRIES_TIMEOUT_DETECTION,
|
||||||
LAVAJob,
|
LAVAJob,
|
||||||
|
filter_debug_messages,
|
||||||
fix_lava_color_log,
|
fix_lava_color_log,
|
||||||
fix_lava_gitlab_section_log,
|
fix_lava_gitlab_section_log,
|
||||||
follow_job_execution,
|
follow_job_execution,
|
||||||
@@ -420,7 +421,6 @@ GITLAB_SECTION_MANGLED_SCENARIOS = {
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"message, fixed_message",
|
"message, fixed_message",
|
||||||
GITLAB_SECTION_MANGLED_SCENARIOS.values(),
|
GITLAB_SECTION_MANGLED_SCENARIOS.values(),
|
||||||
@@ -430,3 +430,37 @@ def test_fix_lava_gitlab_section_log(message, fixed_message):
|
|||||||
fix_lava_gitlab_section_log(message)
|
fix_lava_gitlab_section_log(message)
|
||||||
|
|
||||||
assert message["msg"] == fixed_message
|
assert message["msg"] == fixed_message
|
||||||
|
|
||||||
|
|
||||||
|
LAVA_DEBUG_SPAM_MESSAGES = {
|
||||||
|
"Listened to connection in debug level": (
|
||||||
|
create_lava_yaml_msg(
|
||||||
|
msg="Listened to connection for namespace 'common' for up to 1s",
|
||||||
|
lvl="debug",
|
||||||
|
),
|
||||||
|
True,
|
||||||
|
),
|
||||||
|
"Listened to connection in debug level - v2": (
|
||||||
|
create_lava_yaml_msg(
|
||||||
|
msg="Listened to connection for namespace 'prepare' for up to 9s",
|
||||||
|
lvl="debug",
|
||||||
|
),
|
||||||
|
True,
|
||||||
|
),
|
||||||
|
"Listened to connection in target level": (
|
||||||
|
create_lava_yaml_msg(
|
||||||
|
msg="Listened to connection for namespace 'common' for up to 1s",
|
||||||
|
lvl="target",
|
||||||
|
),
|
||||||
|
False,
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"message, expectation",
|
||||||
|
LAVA_DEBUG_SPAM_MESSAGES.values(),
|
||||||
|
ids=LAVA_DEBUG_SPAM_MESSAGES.keys(),
|
||||||
|
)
|
||||||
|
def test_filter_debug_messages(message, expectation):
|
||||||
|
assert filter_debug_messages(message) == expectation
|
||||||
|
Reference in New Issue
Block a user