Browse Source

Tools/HIL: only print timestamp if newline in output

master
Daniel Agar 4 years ago
parent
commit
f1d00fe697
  1. 7
      Tools/HIL/monitor_firmware_upload.py
  2. 8
      Tools/HIL/run_nsh_cmd.py
  3. 7
      Tools/HIL/run_tests.py

7
Tools/HIL/monitor_firmware_upload.py

@ -30,8 +30,11 @@ def print_line(line): @@ -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)

8
Tools/HIL/run_nsh_cmd.py

@ -30,8 +30,12 @@ def print_line(line): @@ -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)

7
Tools/HIL/run_tests.py

@ -32,8 +32,11 @@ def print_line(line): @@ -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)

Loading…
Cancel
Save