Mesa (master): ci/bare-metal: Use re.search() instead re.match() for our line matching.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Sep 3 23:42:01 UTC 2020


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

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Aug 31 13:38:15 2020 -0700

ci/bare-metal: Use re.search() instead re.match() for our line matching.

match() looks for the start of the line to match our regex, while search
just looks for the regex anywhere in the line.  I messed this up when
converting our greps in shell to python, which was part of breaking the
POWER_GOOD flake detection.  Most of our matches worked, but let's
consistently use this one so we don't mess this up in the future.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6529>

---

 .gitlab-ci/bare-metal/cros_servo_run.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci/bare-metal/cros_servo_run.py b/.gitlab-ci/bare-metal/cros_servo_run.py
index de38f9a3879..b416f133adc 100755
--- a/.gitlab-ci/bare-metal/cros_servo_run.py
+++ b/.gitlab-ci/bare-metal/cros_servo_run.py
@@ -48,31 +48,31 @@ class CrosServoRun:
         # Emit a ^N character to request network boot, because we don't have a
         # direct-to-netboot firmware on cheza.
         for line in self.cpu_ser.lines():
-            if re.match("load_archive: loading locale_en.bin", line):
+            if re.search("load_archive: loading locale_en.bin", line):
                 self.cpu_write("\016")
                 break
 
         tftp_failures = 0
         for line in self.cpu_ser.lines():
-            if re.match("---. end Kernel panic", line):
+            if re.search("---. end Kernel panic", line):
                 return 1
 
             # The Cheza boards have issues with failing to bring up power to
             # the system sometimes, possibly dependent on ambient temperature
             # in the farm.
-            if re.match("POWER_GOOD not seen in time", line):
+            if re.search("POWER_GOOD not seen in time", line):
                 return 2
 
             # The Cheza firmware seems to occasionally get stuck looping in
             # this error state during TFTP booting, possibly based on amount of
             # network traffic around it, but it'll usually recover after a
             # reboot.
-            if re.match("R8152: Bulk read error 0xffffffbf", line):
+            if re.search("R8152: Bulk read error 0xffffffbf", line):
                 tftp_failures += 1
                 if tftp_failures >= 100:
                     return 2
 
-            result = re.match("bare-metal result: (\S*)", line)
+            result = re.search("bare-metal result: (\S*)", line)
             if result:
                 if result.group(1) == "pass":
                     return 0



More information about the mesa-commit mailing list