From 1b7f4b6003917223880773177c8015771b0c0518 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Mon, 22 Nov 2021 11:17:48 -0500 Subject: [PATCH] Jenkins HIL test loading all airframes --- .ci/Jenkinsfile-hardware | 25 ++++++++++++++-------- Tools/HIL/test_airframes.sh | 41 +++++++++++++++++++++++++++++++++++++ Tools/px4airframes/rcout.py | 1 + 3 files changed, 58 insertions(+), 9 deletions(-) create mode 100755 Tools/HIL/test_airframes.sh diff --git a/.ci/Jenkinsfile-hardware b/.ci/Jenkinsfile-hardware index 8fefb6c766..786231fbcf 100644 --- a/.ci/Jenkinsfile-hardware +++ b/.ci/Jenkinsfile-hardware @@ -21,7 +21,7 @@ pipeline { sh 'make cubepilot_cubeorange_bootloader' sh 'make cubepilot_cubeorange_test' sh 'ccache -s' - stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*.py', name: 'cubepilot_cubeorange_test' + stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*, build/cubepilot_cubeorange_test/etc/init.d/airframes/*', name: 'cubepilot_cubeorange_test' } post { always { @@ -48,6 +48,9 @@ pipeline { steps { // run tests runTests() + + // load all airframes + // sh("./Tools/HIL/test_airframes.sh `find /dev/serial -name *usb-*` `cd build/cubepilot_cubeorange_test/etc/init.d/airframes/; find . -regex '.*/[0-9].*' -exec basename {} \\; | cut -d '_' -f 1` || true") // test loading all airframes\ } } stage("status") { @@ -92,7 +95,7 @@ pipeline { sh 'make cuav_x7pro_bootloader' sh 'make cuav_x7pro_test' sh 'ccache -s' - stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*.py', name: 'cuav_x7pro_test' + stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*', name: 'cuav_x7pro_test' } post { always { @@ -161,7 +164,7 @@ pipeline { sh 'make px4_fmu-v3_test' sh 'make px4_fmu-v3_test bootloader_elf' sh 'ccache -s' - stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*.py', name: 'px4_fmu-v3_test' + stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*', name: 'px4_fmu-v3_test' } post { always { @@ -230,7 +233,7 @@ pipeline { sh 'make px4_fmu-v4_test' sh 'make px4_fmu-v4_test bootloader_elf' sh 'ccache -s' - stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*.py', name: 'px4_fmu-v4_test' + stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*', name: 'px4_fmu-v4_test' } post { always { @@ -298,7 +301,7 @@ pipeline { sh 'make px4_fmu-v4pro_test' sh 'make px4_fmu-v4pro_test bootloader_elf' sh 'ccache -s' - stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*.py', name: 'px4_fmu-v4pro_test' + stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*', name: 'px4_fmu-v4pro_test' } post { always { @@ -367,7 +370,7 @@ pipeline { sh 'make px4_fmu-v5_debug' sh 'make px4_fmu-v5_debug bootloader_elf' sh 'ccache -s' - stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*.py', name: 'px4_fmu-v5_debug' + stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*', name: 'px4_fmu-v5_debug' } post { always { @@ -447,7 +450,7 @@ pipeline { sh 'make px4_fmu-v5_stackcheck' sh 'make px4_fmu-v5_stackcheck bootloader_elf' sh 'ccache -s' - stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*.py', name: 'px4_fmu-v5_stackcheck' + stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*', name: 'px4_fmu-v5_stackcheck' } post { always { @@ -526,7 +529,7 @@ pipeline { sh 'make px4_fmu-v5_test' sh 'make px4_fmu-v5_test bootloader_elf' sh 'ccache -s' - stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*.py', name: 'px4_fmu-v5_test' + stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*', name: 'px4_fmu-v5_test' } post { always { @@ -595,7 +598,7 @@ pipeline { sh 'make nxp_fmuk66-v3_test' //sh 'make nxp_fmuk66-v3_test bootloader_elf' sh 'ccache -s' - stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*.py', name: 'nxp_fmuk66-v3_test' + stash includes: 'build/*/*.elf, platforms/nuttx/Debug/*, Tools/HIL/*', name: 'nxp_fmuk66-v3_test' } post { always { @@ -756,6 +759,10 @@ void resetParameters() { } void runTests() { + + // test loading a range of airframes + sh './Tools/HIL/test_airframes.sh `find /dev/serial -name *usb-*` 1000 1001 2100 3000 4001 6001 8001 10016' + resetParameters() sh './Tools/HIL/nsh_param_set.py --device `find /dev/serial -name *usb-*` --name "IMU_GYRO_CAL_EN" --value "0" || true' // disable during testing diff --git a/Tools/HIL/test_airframes.sh b/Tools/HIL/test_airframes.sh new file mode 100755 index 0000000000..51f1ecd4f5 --- /dev/null +++ b/Tools/HIL/test_airframes.sh @@ -0,0 +1,41 @@ +#! /bin/bash + +# exit when any command fails +set -e + +DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) + +SERIAL_DEVICE=$1 + +if [ ! -e "${SERIAL_DEVICE}" ] +then + echo "Invalid serial device ${SERIAL_DEVICE}" + exit -1 +fi + +# all airframes (from ROMFS/px4fmu_common/init.d/airframes/) +# $(find . -regex '.*/[0-9].*' -exec basename {} \; | cut -d "_" -f 1) +ALL_AIRFRAMES=${@:2} +echo "airframes: ${ALL_AIRFRAMES}" + +for airframe in $ALL_AIRFRAMES +do + echo + echo "##########################################################################################" + echo " Airframe: $airframe" + echo "##########################################################################################" + echo + + ${DIR}/nsh_param_set.py --device ${SERIAL_DEVICE} --name SYS_AUTOSTART --value $airframe + ${DIR}/nsh_param_set.py --device ${SERIAL_DEVICE} --name CBRK_BUZZER --value 782097 + ${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'param reset SYS_HITL' + ${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'param save' + + ${DIR}/reboot.py --device ${SERIAL_DEVICE} + + ${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'ps' + ${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'work_queue status' + + ${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'pwm info' + +done diff --git a/Tools/px4airframes/rcout.py b/Tools/px4airframes/rcout.py index 330c0793ab..302cbf012d 100644 --- a/Tools/px4airframes/rcout.py +++ b/Tools/px4airframes/rcout.py @@ -74,6 +74,7 @@ class RCOutput(): result += "\n" result += "if [ ${AIRFRAME} != none ]\n" result += "then\n" + result += "\techo \"Loading airframe: /etc/init.d/airframes/${AIRFRAME}\"\n" result += "\t. /etc/init.d/airframes/${AIRFRAME}\n" if not post_start: result += "else\n"