Browse Source

tests template skip mavlink except for mavlink test

sbg
Daniel Agar 7 years ago
parent
commit
8ddb99971f
  1. 2
      Tools/sitl_run.sh
  2. 22
      platforms/posix/cmake/sitl_tests.cmake
  3. 2
      posix-configs/SITL/init/test/test_mavlink
  4. 28
      posix-configs/SITL/init/test/test_template.in

2
Tools/sitl_run.sh

@ -98,7 +98,7 @@ pushd "$rootfs" >/dev/null @@ -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"

22
platforms/posix/cmake/sitl_tests.cmake

@ -19,7 +19,6 @@ set(tests @@ -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") @@ -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}) @@ -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}) @@ -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
$<TARGET_FILE:px4>
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

2
posix-configs/SITL/init/test/tests_template.in → posix-configs/SITL/init/test/test_mavlink

@ -24,7 +24,7 @@ ver all @@ -24,7 +24,7 @@ ver all
mavlink start -x -u 14556 -r 2000000
mavlink boot_complete
tests @test_name@
tests mavlink
dataman status

28
posix-configs/SITL/init/test/test_template.in

@ -0,0 +1,28 @@ @@ -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
Loading…
Cancel
Save