From 785d3cace47f15bae3f848954c03b9a82daf1074 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 31 Aug 2020 12:41:57 -0700 Subject: [PATCH] ci/bare-metal: Include a timestamp in our serial reads. gitlab CI doesn't include timestamps in its logs by default, but it's really useful for finding delays in our CI so stuff one in on the lines coming in from serial and being output to the gitlab log. The artifacts file is still the raw serial output. Part-of: --- .gitlab-ci/bare-metal/serial_buffer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci/bare-metal/serial_buffer.py b/.gitlab-ci/bare-metal/serial_buffer.py index 8ea9051fe1a..886bce64d14 100755 --- a/.gitlab-ci/bare-metal/serial_buffer.py +++ b/.gitlab-ci/bare-metal/serial_buffer.py @@ -22,6 +22,7 @@ # IN THE SOFTWARE. import argparse +from datetime import datetime,timezone import queue import serial import threading @@ -76,7 +77,10 @@ class SerialBuffer: line.append(b) if b == b'\n'[0]: line = line.decode(errors="replace") - print(self.prefix + line, flush=True, end='') + + time = datetime.now().strftime('%y-%m-%d %H:%M:%S') + print("{time} {prefix}{line}".format(time=time, prefix=self.prefix, line=line), flush=True, end='') + self.line_queue.put(line) line = bytearray() -- 2.30.2