HIL: add --ignore-stdout-errors to run_nsh_cmd.py and use for 'tests dataman'

As this test is expected to contain errors.
This commit is contained in:
Beat Küng 2023-06-19 11:17:17 +02:00
parent 5c73d24765
commit 9aa355a08c
2 changed files with 7 additions and 5 deletions

View File

@ -362,7 +362,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "sd_stress"'
// test dataman
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "tests dataman" || true'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "tests dataman" --ignore-stdout-errors'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "tests file" || true'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "uorb_tests"'
@ -449,7 +449,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "uorb_tests latency_test" || true'
// test dataman
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "tests dataman" || true'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "tests dataman" --ignore-stdout-errors'
}
}
stage("status") {

View File

@ -39,7 +39,7 @@ def print_line(line):
print('{0}'.format(line), end='')
def do_nsh_cmd(port_url, baudrate, cmd):
def do_nsh_cmd(port_url, baudrate, cmd, ignore_stdout_errors=False):
ser = serial.serial_for_url(url=port_url, baudrate=baudrate, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False, inter_byte_timeout=1)
timeout_start = time.monotonic()
@ -106,7 +106,7 @@ def do_nsh_cmd(port_url, baudrate, cmd):
if success_cmd in serial_line:
sys.exit(return_code)
else:
if "ERROR " in serial_line:
if "ERROR " in serial_line and not ignore_stdout_errors:
return_code = -1
print_line(serial_line)
@ -148,6 +148,8 @@ def main():
parser.add_argument('--device', "-d", nargs='?', default=default_device, help='', required=device_required)
parser.add_argument("--baudrate", "-b", dest="baudrate", type=int, help="serial port baud rate (default=57600)", default=57600)
parser.add_argument("--cmd", "-c", dest="cmd", help="Command to run")
parser.add_argument('--ignore-stdout-errors', action='store_true',
help='Ignore errors printed to stdout')
args = parser.parse_args()
tmp_file = "{0}/pyserial_spy_file.txt".format(tempfile.gettempdir())
@ -155,7 +157,7 @@ def main():
print("pyserial url: {0}".format(port_url))
do_nsh_cmd(port_url, args.baudrate, args.cmd)
do_nsh_cmd(port_url, args.baudrate, args.cmd, args.ignore_stdout_errors)
if __name__ == "__main__":
main()