ci/bare-metal: Apply autopep8 to our python scripts.

My editor likes to pep8 as I edit, and I'm tired of carefully not
committing those changes.

Acked-by: Juan A. Suarez <jasuarez@igalia.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17096>
This commit is contained in:
Emma Anholt 2022-06-16 14:55:45 -07:00 committed by Marge Bot
parent 909e7aaf57
commit 1e15ec1949
6 changed files with 55 additions and 27 deletions

View File

@ -108,7 +108,8 @@ class CrosServoRun:
# the system sometimes, possibly dependent on ambient temperature
# in the farm.
if re.search("POWER_GOOD not seen in time", line):
self.print_error("Detected intermittent poweron failure, restarting run...")
self.print_error(
"Detected intermittent poweron failure, restarting run...")
return 2
tftp_failures = 0
@ -123,13 +124,15 @@ class CrosServoRun:
if re.search("R8152: Bulk read error 0xffffffbf", line):
tftp_failures += 1
if tftp_failures >= 100:
self.print_error("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):
self.print_error("Detected cheza power management bus error, restarting run...")
self.print_error(
"Detected cheza power management bus error, restarting run...")
return 2
# If the network device dies, it's probably not graphics's fault, just try again.
@ -148,7 +151,8 @@ 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):
self.print_error("Detected cheza power management bus error, restarting run...")
self.print_error(
"Detected cheza power management bus error, restarting run...")
return 2
if re.search("coreboot.*bootblock starting", line):
@ -167,7 +171,8 @@ class CrosServoRun:
else:
return 1
self.print_error("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

View File

@ -28,13 +28,16 @@ from serial_buffer import SerialBuffer
import sys
import threading
class FastbootRun:
def __init__(self, args):
self.powerup = args.powerup
# We would like something like a 1 minute timeout, but the piglit traces
# jobs stall out for long periods of time.
self.ser = SerialBuffer(args.dev, "results/serial-output.txt", "R SERIAL> ", timeout=600)
self.fastboot="fastboot boot -s {ser} artifacts/fastboot.img".format(ser=args.fbserial)
self.ser = SerialBuffer(
args.dev, "results/serial-output.txt", "R SERIAL> ", timeout=600)
self.fastboot = "fastboot boot -s {ser} artifacts/fastboot.img".format(
ser=args.fbserial)
def close(self):
self.ser.close()
@ -55,16 +58,18 @@ class FastbootRun:
fastboot_ready = False
for line in self.ser.lines():
if re.search("fastboot: processing commands", line) or \
re.search("Listening for fastboot command on", line):
re.search("Listening for fastboot command on", line):
fastboot_ready = True
break
if re.search("data abort", line):
self.print_error("Detected crash during boot, restarting run...")
self.print_error(
"Detected crash during boot, restarting run...")
return 2
if not fastboot_ready:
self.print_error("Failed to get to fastboot prompt, restarting run...")
self.print_error(
"Failed to get to fastboot prompt, restarting run...")
return 2
if self.logged_system(self.fastboot) != 0:
@ -83,7 +88,8 @@ 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):
self.print_error("Detected spontaneous reboot, restarting run...")
self.print_error(
"Detected spontaneous reboot, restarting run...")
return 2
# db820c sometimes wedges around iommu fault recovery
@ -117,15 +123,21 @@ class FastbootRun:
else:
return 1
self.print_error("Reached the end of the CPU serial log without finding a result, restarting run...")
self.print_error(
"Reached the end of the CPU serial log without finding a result, restarting run...")
return 2
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--dev', type=str, help='Serial device (otherwise reading from serial-output.txt)')
parser.add_argument('--powerup', type=str, help='shell command for rebooting', required=True)
parser.add_argument('--powerdown', type=str, help='shell command for powering off', required=True)
parser.add_argument('--fbserial', type=str, help='fastboot serial number of the board', required=True)
parser.add_argument(
'--dev', type=str, help='Serial device (otherwise reading from serial-output.txt)')
parser.add_argument('--powerup', type=str,
help='shell command for rebooting', required=True)
parser.add_argument('--powerdown', type=str,
help='shell command for powering off', required=True)
parser.add_argument('--fbserial', type=str,
help='fastboot serial number of the board', required=True)
args = parser.parse_args()
fastboot = FastbootRun(args)
@ -142,5 +154,6 @@ def main():
sys.exit(retval)
if __name__ == '__main__':
main()

View File

@ -8,8 +8,8 @@ relay = sys.argv[2]
# our relays are "off" means "board is powered".
mode_swap = {
"on" : "off",
"off" : "on",
"on": "off",
"off": "on",
}
mode = mode_swap[mode]

View File

@ -28,11 +28,13 @@ from serial_buffer import SerialBuffer
import sys
import threading
class PoERun:
def __init__(self, args):
self.powerup = args.powerup
self.powerdown = args.powerdown
self.ser = SerialBuffer(args.dev, "results/serial-output.txt", "", args.timeout)
self.ser = SerialBuffer(
args.dev, "results/serial-output.txt", "", args.timeout)
def print_error(self, message):
RED = '\033[0;31m'
@ -54,7 +56,8 @@ class PoERun:
break
if not boot_detected:
self.print_error("Something wrong; couldn't detect the boot start up sequence")
self.print_error(
"Something wrong; couldn't detect the boot start up sequence")
return 2
for line in self.ser.lines():
@ -77,14 +80,19 @@ class PoERun:
else:
return 1
self.print_error("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 2
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--dev', type=str, help='Serial device to monitor', required=True)
parser.add_argument('--powerup', type=str, help='shell command for rebooting', required=True)
parser.add_argument('--powerdown', type=str, help='shell command for powering off', required=True)
parser.add_argument('--dev', type=str,
help='Serial device to monitor', required=True)
parser.add_argument('--powerup', type=str,
help='shell command for rebooting', required=True)
parser.add_argument('--powerdown', type=str,
help='shell command for powering off', required=True)
parser.add_argument('--timeout', type=int, default=60,
help='time in seconds to wait for activity', required=False)
args = parser.parse_args()
@ -96,5 +104,6 @@ def main():
sys.exit(retval)
if __name__ == '__main__':
main()

View File

@ -28,8 +28,9 @@ import serial
import threading
import time
class SerialBuffer:
def __init__(self, dev, filename, prefix, timeout = None):
def __init__(self, dev, filename, prefix, timeout=None):
self.filename = filename
self.dev = dev

View File

@ -28,8 +28,8 @@
import sys
import telnetlib
host=sys.argv[1]
port=sys.argv[2]
host = sys.argv[1]
port = sys.argv[2]
tn = telnetlib.Telnet(host, port, 1000000)