From d30e30a2a6acbfe830b93965cee140c28462126c Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Sat, 15 Jun 2019 11:09:21 -0400 Subject: [PATCH] Jenkins HIL run more tests --- .ci/Jenkinsfile-hardware | 2 +- Tools/HIL/run_tests.py | 55 ++++++++++++++++++++++++++++++++-------- 2 files changed, 46 insertions(+), 11 deletions(-) diff --git a/.ci/Jenkinsfile-hardware b/.ci/Jenkinsfile-hardware index 373730fe45..5bd2a6effa 100644 --- a/.ci/Jenkinsfile-hardware +++ b/.ci/Jenkinsfile-hardware @@ -411,7 +411,7 @@ pipeline { unstash 'px4_fmu-v5_stackcheck' sh './platforms/nuttx/Debug/jlink_gdb_upload.sh build/px4_fmu-v5_stackcheck/px4_fmu-v5_stackcheck.elf' sh './Tools/HIL/monitor_firmware_upload.py --device `find /dev/serial -name *usb-FTDI_*` --baudrate 57600' - sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`' + // sh './Tools/HIL/run_tests.py --device `find /dev/serial -name *usb-FTDI_*`' // TODO: currently unusably slow } catch (Exception err) { // always report passed for now currentBuild.result = 'SUCCESS' diff --git a/Tools/HIL/run_tests.py b/Tools/HIL/run_tests.py index 3d4e92fa72..bca87cd577 100755 --- a/Tools/HIL/run_tests.py +++ b/Tools/HIL/run_tests.py @@ -6,36 +6,42 @@ from subprocess import call, Popen from argparse import ArgumentParser import re -def do_tests(port, baudrate): +def do_test(port, baudrate, test_name): databits = serial.EIGHTBITS stopbits = serial.STOPBITS_ONE parity = serial.PARITY_NONE ser = serial.Serial(port, baudrate, databits, parity, stopbits, 100) ser.write('\n\n') - + finished = 0 while finished == 0: serial_line = ser.readline() - print(serial_line.replace('\n','')) + print(serial_line.replace('\n','')) if "nsh>" in serial_line: finished = 1 time.sleep(0.05) - ser.write('tests perf\n') + ser.write('tests ' + test_name + '\n') finished = 0 + success = False while finished == 0: serial_line = ser.readline() - print(serial_line.replace('\n','')) + print(serial_line.replace('\n','')) - if "perf PASSED" in serial_line: + if test_name + " PASSED" in serial_line: finished = 1 - ser.close() + success = True + elif test_name + " FAILED" in serial_line: + finished = 1 + success = False time.sleep(0.05) - ser.close() + ser.close() + + return success def main(): parser = ArgumentParser(description=__doc__) @@ -43,7 +49,36 @@ def main(): parser.add_argument("--baudrate", "-b", dest="baudrate", type=int, help="Mavlink port baud rate (default=57600)", default=57600) args = parser.parse_args() - do_tests(args.device, args.baudrate) + + do_test(args.device, args.baudrate, "autodeclination") + do_test(args.device, args.baudrate, "bezier") + do_test(args.device, args.baudrate, "bson") + do_test(args.device, args.baudrate, "commander") + do_test(args.device, args.baudrate, "controllib") + do_test(args.device, args.baudrate, "conv") + do_test(args.device, args.baudrate, "ctlmath") + #do_test(args.device, args.baudrate, "dataman") + do_test(args.device, args.baudrate, "float") + do_test(args.device, args.baudrate, "hrt") + do_test(args.device, args.baudrate, "int") + do_test(args.device, args.baudrate, "IntrusiveQueue") + do_test(args.device, args.baudrate, "List") + do_test(args.device, args.baudrate, "mathlib") + do_test(args.device, args.baudrate, "matrix") + do_test(args.device, args.baudrate, "microbench_hrt") + do_test(args.device, args.baudrate, "microbench_math") + do_test(args.device, args.baudrate, "microbench_matrix") + do_test(args.device, args.baudrate, "microbench_uorb") + #do_test(args.device, args.baudrate, "mixer") + do_test(args.device, args.baudrate, "param") + do_test(args.device, args.baudrate, "parameters") + do_test(args.device, args.baudrate, "perf") + do_test(args.device, args.baudrate, "search_min") + do_test(args.device, args.baudrate, "sleep") + do_test(args.device, args.baudrate, "smoothz") + do_test(args.device, args.baudrate, "time") + do_test(args.device, args.baudrate, "uorb") + do_test(args.device, args.baudrate, "versioning") if __name__ == "__main__": - main() \ No newline at end of file + main()