From e45d37296892ce786acb2464302d197237c44e4d Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Mon, 1 Mar 2021 13:20:03 +0100 Subject: [PATCH] ci/baremetal: highlight message errors Highlight in red errors from the baremetal run, so user is more aware of what happened. Signed-off-by: Juan A. Suarez Romero Reviewed-by: Eric Anholt Part-of: --- .gitlab-ci/bare-metal/cros_servo_run.py | 16 +++++++++++----- .gitlab-ci/bare-metal/fastboot_run.py | 11 ++++++++--- .gitlab-ci/bare-metal/poe_run.py | 11 ++++++++--- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci/bare-metal/cros_servo_run.py b/.gitlab-ci/bare-metal/cros_servo_run.py index 868f8049994..dc5014bb283 100755 --- a/.gitlab-ci/bare-metal/cros_servo_run.py +++ b/.gitlab-ci/bare-metal/cros_servo_run.py @@ -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 diff --git a/.gitlab-ci/bare-metal/fastboot_run.py b/.gitlab-ci/bare-metal/fastboot_run.py index 6f286539488..f680d4b02f1 100755 --- a/.gitlab-ci/bare-metal/fastboot_run.py +++ b/.gitlab-ci/bare-metal/fastboot_run.py @@ -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(): diff --git a/.gitlab-ci/bare-metal/poe_run.py b/.gitlab-ci/bare-metal/poe_run.py index 804522bad6d..04388a47641 100755 --- a/.gitlab-ci/bare-metal/poe_run.py +++ b/.gitlab-ci/bare-metal/poe_run.py @@ -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():