diff --git a/Tools/HIL/monitor_firmware_upload.py b/Tools/HIL/monitor_firmware_upload.py index c56b0a48ab..b5df4691b6 100755 --- a/Tools/HIL/monitor_firmware_upload.py +++ b/Tools/HIL/monitor_firmware_upload.py @@ -30,8 +30,11 @@ def print_line(line): if "FAILED" in line: line = line.replace("FAILED", f"{COLOR_RED}FAILED{COLOR_RESET}", 1) - current_time = datetime.datetime.now() - print('[{0}] {1}'.format(current_time.isoformat(timespec='milliseconds'), line), end='') + if "\n" in line: + current_time = datetime.datetime.now() + print('[{0}] {1}'.format(current_time.isoformat(timespec='milliseconds'), line), end='') + else: + print('{0}'.format(line), end='') def monitor_firmware_upload(port, baudrate): ser = serial.Serial(port, baudrate, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=1, xonxoff=True, rtscts=False, dsrdtr=False) diff --git a/Tools/HIL/run_nsh_cmd.py b/Tools/HIL/run_nsh_cmd.py index 5534e7d326..1874f6e599 100755 --- a/Tools/HIL/run_nsh_cmd.py +++ b/Tools/HIL/run_nsh_cmd.py @@ -30,8 +30,12 @@ def print_line(line): if "FAILED" in line: line = line.replace("FAILED", f"{COLOR_RED}FAILED{COLOR_RESET}", 1) - current_time = datetime.datetime.now() - print('[{0}] {1}'.format(current_time.isoformat(timespec='milliseconds'), line), end='') + if "\n" in line: + current_time = datetime.datetime.now() + print('[{0}] {1}'.format(current_time.isoformat(timespec='milliseconds'), line), end='') + else: + print('{0}'.format(line), end='') + def do_nsh_cmd(port, baudrate, cmd): ser = serial.Serial(port, baudrate, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=0.2, xonxoff=True, rtscts=False, dsrdtr=False) diff --git a/Tools/HIL/run_tests.py b/Tools/HIL/run_tests.py index 4682c25c31..bca707cc7c 100755 --- a/Tools/HIL/run_tests.py +++ b/Tools/HIL/run_tests.py @@ -32,8 +32,11 @@ def print_line(line): if "FAILED" in line: line = line.replace("FAILED", f"{COLOR_RED}FAILED{COLOR_RESET}", 1) - current_time = datetime.datetime.now() - print('[{0}] {1}'.format(current_time.isoformat(timespec='milliseconds'), line), end='') + if "\n" in line: + current_time = datetime.datetime.now() + print('[{0}] {1}'.format(current_time.isoformat(timespec='milliseconds'), line), end='') + else: + print('{0}'.format(line), end='') def do_test(port, baudrate, test_name): ser = serial.Serial(port, baudrate, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=0.2, xonxoff=True, rtscts=False, dsrdtr=False)