3 # Copyright © 2020 Igalia, S.L.
5 # Permission is hereby granted, free of charge, to any person obtaining a
6 # copy of this software and associated documentation files (the "Software"),
7 # to deal in the Software without restriction, including without limitation
8 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 # and/or sell copies of the Software, and to permit persons to whom the
10 # Software is furnished to do so, subject to the following conditions:
12 # The above copyright notice and this permission notice (including the next
13 # paragraph) shall be included in all copies or substantial portions of the
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
27 from serial_buffer import SerialBuffer
33 def __init__(self, args, test_timeout):
34 self.powerup = args.powerup
35 self.powerdown = args.powerdown
36 self.ser = SerialBuffer(
37 args.dev, "results/serial-output.txt", "")
38 self.test_timeout = test_timeout
40 def print_error(self, message):
43 print(RED + message + NO_COLOR)
45 def logged_system(self, cmd):
46 print("Running '{}'".format(cmd))
50 if self.logged_system(self.powerup) != 0:
54 for line in self.ser.lines(timeout=5 * 60, phase="bootloader"):
55 if re.search("Booting Linux", line):
61 "Something wrong; couldn't detect the boot start up sequence")
64 for line in self.ser.lines(timeout=self.test_timeout, phase="test"):
65 if re.search("---. end Kernel panic", line):
68 # Binning memory problems
69 if re.search("binner overflow mem", line):
70 self.print_error("Memory overflow in the binner; GPU hang")
73 if re.search("nouveau 57000000.gpu: bus: MMIO read of 00000000 FAULT at 137000", line):
74 self.print_error("nouveau jetson boot bug, retrying.")
78 if re.search("NETDEV WATCHDOG:.* transmit queue 0 timed out", line):
79 self.print_error("nouveau jetson tk1 network fail, retrying.")
82 result = re.search("hwci: mesa: (\S*)", line)
84 if result.group(1) == "pass":
90 "Reached the end of the CPU serial log without finding a result")
95 parser = argparse.ArgumentParser()
96 parser.add_argument('--dev', type=str,
97 help='Serial device to monitor', required=True)
98 parser.add_argument('--powerup', type=str,
99 help='shell command for rebooting', required=True)
100 parser.add_argument('--powerdown', type=str,
101 help='shell command for powering off', required=True)
103 '--test-timeout', type=int, help='Test phase timeout (minutes)', required=True)
104 args = parser.parse_args()
106 poe = PoERun(args, args.test_timeout * 60)
109 poe.logged_system(args.powerdown)
114 if __name__ == '__main__':