From 0330522e99c4dc28ba50e31e9e7da423b09c48a4 Mon Sep 17 00:00:00 2001 From: Guilherme Gallo Date: Sun, 9 Mar 2025 19:02:53 -0300 Subject: [PATCH] ci/lava: Fix LAVA lima jobs lima uses a different version from other farms, where some log output patches were not delivery yet, so let's use a temporary fix to make those job traces look as nice as the other ones. Signed-off-by: Guilherme Gallo Part-of: --- .gitlab-ci/lava/utils/log_follower.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.gitlab-ci/lava/utils/log_follower.py b/.gitlab-ci/lava/utils/log_follower.py index d4bd22a402a..1989e8529c2 100644 --- a/.gitlab-ci/lava/utils/log_follower.py +++ b/.gitlab-ci/lava/utils/log_follower.py @@ -262,6 +262,8 @@ class LogFollower: prefix = "$ " suffix = "" elif line["lvl"] == "target" and self.lava_farm != "collabora": + if self.lava_farm == "lima": + fix_lava_color_log(line) # gl_section_fix_gen will output the stored line if it can't find a # match for the first split line # So we can recover it and put it back to the buffer @@ -270,6 +272,24 @@ class LogFollower: return f'{prefix}{line["msg"]}{suffix}' + +def fix_lava_color_log(line): + """This function is a temporary solution for the color escape codes mangling + problem. There is some problem in message passing between the LAVA + dispatcher and the device under test (DUT). Here \x1b character is missing + before `[:digit::digit:?m` ANSI TTY color codes. When this problem is fixed + on the LAVA side, one should remove this function. + + Note: most LAVA farms don't have this problem, except for Lima, which uses + an older version of LAVA. + """ + line["msg"] = re.sub(r"(\[\d{1,2}m)", "\x1b" + r"\1", line["msg"]) + # Also fix ANSI escape codes mangling + line["msg"] = re.sub(r"(\[0K)", "\x1b" + r"\1", line["msg"]) + # Also fix ANSI color codes mangling + line["msg"] = re.sub(r"(\[0;3\d{1,2}m)", "\r\x1b" + r"\1", line["msg"]) + + def fix_lava_gitlab_section_log(): """This function is a temporary solution for the Gitlab section markers splitting problem. Gitlab parses the following lines to define a collapsible