mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 07:28:54 +08:00
Tools/HIL/run_nsh_cmd.py: fail if ERROR printed in output
This commit is contained in:
@@ -35,7 +35,7 @@ def do_param_set_cmd(port, baudrate, param_name, param_value):
|
||||
ser = serial.Serial(port, baudrate, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=0.1, xonxoff=True, rtscts=False, dsrdtr=False)
|
||||
|
||||
timeout_start = time.time()
|
||||
timeout = 10 # 10 seconds
|
||||
timeout = 30 # 30 seconds
|
||||
|
||||
# wait for nsh prompt
|
||||
while True:
|
||||
|
||||
@@ -37,7 +37,7 @@ 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)
|
||||
|
||||
timeout_start = time.time()
|
||||
timeout = 10 # 10 seconds
|
||||
timeout = 30 # 30 seconds
|
||||
|
||||
# wait for nsh prompt
|
||||
while True:
|
||||
@@ -90,13 +90,19 @@ def do_nsh_cmd(port, baudrate, cmd):
|
||||
timeout_start = time.time()
|
||||
timeout = 180 # 3 minutes
|
||||
|
||||
return_code = 0
|
||||
|
||||
while True:
|
||||
serial_line = ser.readline().decode("ascii", errors='ignore')
|
||||
|
||||
if success_cmd in serial_line:
|
||||
sys.exit(return_code)
|
||||
break
|
||||
else:
|
||||
if len(serial_line) > 0:
|
||||
if "ERROR " in serial_line:
|
||||
return_code = -1
|
||||
|
||||
print_line(serial_line)
|
||||
|
||||
if "nsh>" in serial_line:
|
||||
|
||||
@@ -39,7 +39,7 @@ 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)
|
||||
|
||||
timeout_start = time.time()
|
||||
timeout = 10 # 10 seconds
|
||||
timeout = 30 # 30 seconds
|
||||
|
||||
# wait for nsh prompt
|
||||
while True:
|
||||
|
||||
Reference in New Issue
Block a user