From 8ddb99971fa7ad96a8c31e49c5db6ee27ea67b27 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Thu, 30 Aug 2018 10:30:37 -0400 Subject: [PATCH] tests template skip mavlink except for mavlink test --- Tools/sitl_run.sh | 2 +- platforms/posix/cmake/sitl_tests.cmake | 22 +++++++++++++-- .../test/{tests_template.in => test_mavlink} | 2 +- posix-configs/SITL/init/test/test_template.in | 28 +++++++++++++++++++ 4 files changed, 49 insertions(+), 5 deletions(-) rename posix-configs/SITL/init/test/{tests_template.in => test_mavlink} (95%) create mode 100644 posix-configs/SITL/init/test/test_template.in diff --git a/Tools/sitl_run.sh b/Tools/sitl_run.sh index 5a90cf949d..b195e0a4c3 100755 --- a/Tools/sitl_run.sh +++ b/Tools/sitl_run.sh @@ -98,7 +98,7 @@ pushd "$rootfs" >/dev/null # Do not exit on failure now from here on because we want the complete cleanup set +e -if [[ ${model} == tests* ]] || [[ ${model} == *_generated ]]; then +if [[ ${model} == test_* ]] || [[ ${model} == *_generated ]]; then sitl_command="$sitl_bin $no_pxh $src_path/ROMFS/px4fmu_test -s ${src_path}/${rcS_path}/${model} -t $src_path/test_data" else sitl_command="$sitl_bin $no_pxh $src_path/ROMFS/px4fmu_common -s etc/init.d-posix/rcS -t $src_path/test_data" diff --git a/platforms/posix/cmake/sitl_tests.cmake b/platforms/posix/cmake/sitl_tests.cmake index 0edff1e7e6..47209c59f3 100644 --- a/platforms/posix/cmake/sitl_tests.cmake +++ b/platforms/posix/cmake/sitl_tests.cmake @@ -19,7 +19,6 @@ set(tests int mathlib matrix - mavlink microbench_hrt microbench_math microbench_matrix @@ -45,7 +44,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") endif() foreach(test_name ${tests}) - configure_file(${PX4_SOURCE_DIR}/posix-configs/SITL/init/test/tests_template.in ${PX4_SOURCE_DIR}/posix-configs/SITL/init/test/tests_${test_name}_generated) + configure_file(${PX4_SOURCE_DIR}/posix-configs/SITL/init/test/test_template.in ${PX4_SOURCE_DIR}/posix-configs/SITL/init/test/test_${test_name}_generated) add_test(NAME ${test_name} COMMAND ${PX4_SOURCE_DIR}/Tools/sitl_run.sh @@ -53,7 +52,7 @@ foreach(test_name ${tests}) posix-configs/SITL/init/test none none - tests_${test_name}_generated + test_${test_name}_generated ${PX4_SOURCE_DIR} ${PX4_BINARY_DIR} WORKING_DIRECTORY ${SITL_WORKING_DIR}) @@ -62,6 +61,23 @@ foreach(test_name ${tests}) set_tests_properties(${test_name} PROPERTIES PASS_REGULAR_EXPRESSION "${test_name} PASSED") endforeach() + +# Mavlink test requires mavlink running +add_test(NAME mavlink + COMMAND ${PX4_SOURCE_DIR}/Tools/sitl_run.sh + $ + posix-configs/SITL/init/test + none + none + test_mavlink + ${PX4_SOURCE_DIR} + ${PX4_BINARY_DIR} + WORKING_DIRECTORY ${SITL_WORKING_DIR}) + +set_tests_properties(mavlink PROPERTIES FAIL_REGULAR_EXPRESSION "mavlink FAILED") +set_tests_properties(mavlink PROPERTIES PASS_REGULAR_EXPRESSION "mavlink PASSED") + + # run arbitrary commands set(test_cmds hello diff --git a/posix-configs/SITL/init/test/tests_template.in b/posix-configs/SITL/init/test/test_mavlink similarity index 95% rename from posix-configs/SITL/init/test/tests_template.in rename to posix-configs/SITL/init/test/test_mavlink index f31b7d0937..b6692cdd30 100644 --- a/posix-configs/SITL/init/test/tests_template.in +++ b/posix-configs/SITL/init/test/test_mavlink @@ -24,7 +24,7 @@ ver all mavlink start -x -u 14556 -r 2000000 mavlink boot_complete -tests @test_name@ +tests mavlink dataman status diff --git a/posix-configs/SITL/init/test/test_template.in b/posix-configs/SITL/init/test/test_template.in new file mode 100644 index 0000000000..a7c68e92b6 --- /dev/null +++ b/posix-configs/SITL/init/test/test_template.in @@ -0,0 +1,28 @@ +#!/bin/sh +# PX4 commands need the 'px4-' prefix in bash. +# (px4-alias.sh is expected to be in the PATH) +source px4-alias.sh + +uorb start + +param load +param set SYS_RESTART_TYPE 0 + +dataman start + +simulator start -t +tone_alarm start +gyrosim start +accelsim start +barosim start +gpssim start +measairspeedsim start +pwm_out_sim start + +ver all + +tests @test_name@ + +dataman status + +shutdown