ci/baremetal: highlight message errors
authorJuan A. Suarez Romero <jasuarez@igalia.com>
Mon, 1 Mar 2021 12:20:03 +0000 (13:20 +0100)
committerMarge Bot <eric+marge@anholt.net>
Mon, 1 Mar 2021 18:22:24 +0000 (18:22 +0000)
Highlight in red errors from the baremetal run, so user is more aware of
what happened.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9335>

.gitlab-ci/bare-metal/cros_servo_run.py
.gitlab-ci/bare-metal/fastboot_run.py
.gitlab-ci/bare-metal/poe_run.py

index 868f804..dc5014b 100755 (executable)
@@ -1,3 +1,4 @@
+
 #!/usr/bin/env python3
 #
 # Copyright © 2020 Google LLC
@@ -79,6 +80,11 @@ class CrosServoRun:
         print("W SERIAL-CPU> %s" % s)
         self.cpu_ser.serial.write(s.encode())
 
+    def print_error(self, message):
+        RED = '\033[0;31m'
+        NO_COLOR = '\033[0m'
+        print(RED + message + NO_COLOR)
+
     def run(self):
         # Flush any partial commands in the EC's prompt, then ask for a reboot.
         self.ec_write("\n")
@@ -96,7 +102,7 @@ class CrosServoRun:
             # the system sometimes, possibly dependent on ambient temperature
             # in the farm.
             if re.search("POWER_GOOD not seen in time", line):
-                print("Detected intermittent poweron failure, restarting run...")
+                self.print_error("Detected intermittent poweron failure, restarting run...")
                 return 2
 
         tftp_failures = 0
@@ -111,13 +117,13 @@ class CrosServoRun:
             if re.search("R8152: Bulk read error 0xffffffbf", line):
                 tftp_failures += 1
                 if tftp_failures >= 100:
-                    print("Detected intermittent tftp failure, restarting run...")
+                    self.print_error("Detected intermittent tftp failure, restarting run...")
                     return 2
 
             # There are very infrequent bus errors during power management transitions
             # on cheza, which we don't expect to be the case on future boards.
             if re.search("Kernel panic - not syncing: Asynchronous SError Interrupt", line):
-                print("Detected cheza power management bus error, restarting run...")
+                self.print_error("Detected cheza power management bus error, restarting run...")
                 return 2
 
             # These HFI response errors started appearing with the introduction
@@ -130,7 +136,7 @@ class CrosServoRun:
             # Given that it seems to trigger randomly near a GPU fault and then
             # break many tests after that, just restart the whole run.
             if re.search("a6xx_hfi_send_msg.*Unexpected message id .* on the response queue", line):
-                print("Detected cheza power management bus error, restarting run...")
+                self.print_error("Detected cheza power management bus error, restarting run...")
                 return 2
 
             result = re.search("bare-metal result: (\S*)", line)
@@ -140,7 +146,7 @@ class CrosServoRun:
                 else:
                     return 1
 
-        print("Reached the end of the CPU serial log without finding a result")
+        self.print_error("Reached the end of the CPU serial log without finding a result")
         return 1
 
 
index 6f28653..f680d4b 100755 (executable)
@@ -34,6 +34,11 @@ class FastbootRun:
         self.ser = SerialBuffer(args.dev, "results/serial-output.txt", "R SERIAL> ")
         self.fastboot="fastboot boot -s {ser} artifacts/fastboot.img".format(ser=args.fbserial)
 
+    def print_error(self, message):
+        RED = '\033[0;31m'
+        NO_COLOR = '\033[0m'
+        print(RED + message + NO_COLOR)
+
     def logged_system(self, cmd):
         print("Running '{}'".format(cmd))
         return os.system(cmd)
@@ -53,7 +58,7 @@ class FastbootRun:
                 return 1
 
         if not fastboot_ready:
-            print("Failed to get to fastboot prompt")
+            self.print_error("Failed to get to fastboot prompt")
             return 1
 
         if self.logged_system(self.fastboot) != 0:
@@ -66,7 +71,7 @@ class FastbootRun:
             # The db820c boards intermittently reboot.  Just restart the run
             # when if we see a reboot after we got past fastboot.
             if re.search("PON REASON", line):
-                print("Detected spontaneous reboot, restarting run...")
+                self.print_error("Detected spontaneous reboot, restarting run...")
                 return 2
 
             result = re.search("bare-metal result: (\S*)", line)
@@ -76,7 +81,7 @@ class FastbootRun:
                 else:
                     return 1
 
-        print("Reached the end of the CPU serial log without finding a result")
+        self.print_error("Reached the end of the CPU serial log without finding a result")
         return 1
 
 def main():
index 804522b..04388a4 100755 (executable)
@@ -34,6 +34,11 @@ class PoERun:
         self.powerdown = args.powerdown
         self.ser = SerialBuffer(args.dev, "results/serial-output.txt", "", args.timeout)
 
+    def print_error(self, message):
+        RED = '\033[0;31m'
+        NO_COLOR = '\033[0m'
+        print(RED + message + NO_COLOR)
+
     def logged_system(self, cmd):
         print("Running '{}'".format(cmd))
         return os.system(cmd)
@@ -49,7 +54,7 @@ class PoERun:
                 break
 
         if not boot_detected:
-            print("Something wrong; couldn't detect the boot start up sequence")
+            self.print_error("Something wrong; couldn't detect the boot start up sequence")
             self.logged_system(self.powerdown)
             return 2
 
@@ -59,7 +64,7 @@ class PoERun:
 
             # Binning memory problems
             if re.search("binner overflow mem", line):
-                print("Memory overflow in the binner; GPU hang")
+                self.print_error("Memory overflow in the binner; GPU hang")
                 return 1
 
             result = re.search("bare-metal result: (\S*)", line)
@@ -69,7 +74,7 @@ class PoERun:
                 else:
                     return 1
 
-        print("Reached the end of the CPU serial log without finding a result")
+        self.print_error("Reached the end of the CPU serial log without finding a result")
         return 1
 
 def main():