Mesa (main): ci/lava: Filter out undesired messages

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 22 02:17:18 UTC 2022


Module: Mesa
Branch: main
Commit: cee1c4fc7f35c74103af50d6b6ccfe46e3ccc384
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cee1c4fc7f35c74103af50d6b6ccfe46e3ccc384

Author: Guilherme Gallo <guilherme.gallo at collabora.com>
Date:   Mon Jun 20 19:12:28 2022 -0300

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 at collabora.com>
Acked-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17151>

---

 .gitlab-ci/lava/lava_job_submitter.py       | 21 +++++++++++++++++
 .gitlab-ci/tests/test_lava_job_submitter.py | 36 ++++++++++++++++++++++++++++-
 2 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci/lava/lava_job_submitter.py b/.gitlab-ci/lava/lava_job_submitter.py
index 3c53c440d47..f9d4d89b893 100755
--- a/.gitlab-ci/lava/lava_job_submitter.py
+++ b/.gitlab-ci/lava/lava_job_submitter.py
@@ -402,6 +402,25 @@ def fix_lava_gitlab_section_log(line):
         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]:
     parsed_lines: list[str] = []
     for line in new_lines:
@@ -413,6 +432,8 @@ def parse_lava_lines(new_lines) -> list[str]:
         elif line["lvl"] in ["warning", "error"]:
             prefix = CONSOLE_LOG_COLOR_RED
             suffix = CONSOLE_LOG_COLOR_RESET
+        elif filter_debug_messages(line):
+            continue
         elif line["lvl"] == "input":
             prefix = "$ "
             suffix = ""
diff --git a/.gitlab-ci/tests/test_lava_job_submitter.py b/.gitlab-ci/tests/test_lava_job_submitter.py
index def946c1ac9..76a43c33eff 100644
--- a/.gitlab-ci/tests/test_lava_job_submitter.py
+++ b/.gitlab-ci/tests/test_lava_job_submitter.py
@@ -37,6 +37,7 @@ from lava.lava_job_submitter import (
     DEVICE_HANGING_TIMEOUT_SEC,
     NUMBER_OF_RETRIES_TIMEOUT_DETECTION,
     LAVAJob,
+    filter_debug_messages,
     fix_lava_color_log,
     fix_lava_gitlab_section_log,
     follow_job_execution,
@@ -420,7 +421,6 @@ GITLAB_SECTION_MANGLED_SCENARIOS = {
     ),
 }
 
-
 @pytest.mark.parametrize(
     "message, fixed_message",
     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)
 
     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,
+    ),
+}
+
+
+ at 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



More information about the mesa-commit mailing list