Mesa (main): ci/bare-metal: Add per-boot-stage timeouts for fastboot and poe.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 21 22:18:46 UTC 2022
Module: Mesa
Branch: main
Commit: ca453714aa4add8faec1e11a8f5866932ca8261a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ca453714aa4add8faec1e11a8f5866932ca8261a
Author: Emma Anholt <emma at anholt.net>
Date: Thu Jun 16 13:37:55 2022 -0700
ci/bare-metal: Add per-boot-stage timeouts for fastboot and poe.
This should avoid the 1-hour timeouts if something goes wrong, and just
restart.
Fixes: #6682
Acked-by: Juan A. Suarez <jasuarez at igalia.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17096>
---
.gitlab-ci/bare-metal/fastboot_run.py | 4 ++--
.gitlab-ci/bare-metal/poe_run.py | 4 ++--
.gitlab-ci/bare-metal/serial_buffer.py | 32 ++++++++++++++++++++++++--------
3 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/.gitlab-ci/bare-metal/fastboot_run.py b/.gitlab-ci/bare-metal/fastboot_run.py
index 41ee29933dc..ca27b6fe7e3 100755
--- a/.gitlab-ci/bare-metal/fastboot_run.py
+++ b/.gitlab-ci/bare-metal/fastboot_run.py
@@ -56,7 +56,7 @@ class FastbootRun:
return 1
fastboot_ready = False
- for line in self.ser.lines():
+ for line in self.ser.lines(timeout=2 * 60, phase="bootloader"):
if re.search("fastboot: processing commands", line) or \
re.search("Listening for fastboot command on", line):
fastboot_ready = True
@@ -76,7 +76,7 @@ class FastbootRun:
return 1
print_more_lines = -1
- for line in self.ser.lines():
+ for line in self.ser.lines(timeout=20 * 60, phase="test"):
if print_more_lines == 0:
return 2
if print_more_lines > 0:
diff --git a/.gitlab-ci/bare-metal/poe_run.py b/.gitlab-ci/bare-metal/poe_run.py
index 155256efa53..30cbc7795b0 100755
--- a/.gitlab-ci/bare-metal/poe_run.py
+++ b/.gitlab-ci/bare-metal/poe_run.py
@@ -50,7 +50,7 @@ class PoERun:
return 1
boot_detected = False
- for line in self.ser.lines():
+ for line in self.ser.lines(timeout=5 * 60, phase="bootloader"):
if re.search("Booting Linux", line):
boot_detected = True
break
@@ -60,7 +60,7 @@ class PoERun:
"Something wrong; couldn't detect the boot start up sequence")
return 2
- for line in self.ser.lines():
+ for line in self.ser.lines(timeout=20 * 60, phase="test"):
if re.search("---. end Kernel panic", line):
return 1
diff --git a/.gitlab-ci/bare-metal/serial_buffer.py b/.gitlab-ci/bare-metal/serial_buffer.py
index bcf2b87e32a..1dc7596df66 100755
--- a/.gitlab-ci/bare-metal/serial_buffer.py
+++ b/.gitlab-ci/bare-metal/serial_buffer.py
@@ -131,14 +131,30 @@ class SerialBuffer:
self.line_queue.put(line)
line = bytearray()
- def get_line(self):
- line = self.line_queue.get()
- if line == self.sentinel:
- self.lines_thread.join()
- return line
-
- def lines(self):
- return iter(self.get_line, self.sentinel)
+ def lines(self, timeout=None, phase=None):
+ start_time = time.monotonic()
+ while True:
+ read_timeout = None
+ if timeout:
+ read_timeout = timeout - (time.monotonic() - start_time)
+ if read_timeout <= 0:
+ print("read timeout waiting for serial during {}".format(phase))
+ self.close()
+ break
+
+ try:
+ line = self.line_queue.get(timeout=read_timeout)
+ except queue.Empty:
+ print("read timeout waiting for serial during {}".format(phase))
+ self.close()
+ break
+
+ if line == self.sentinel:
+ print("End of serial output")
+ self.lines_thread.join()
+ break
+
+ yield line
def main():
More information about the mesa-commit
mailing list