2017-01-04 23:19:08 -04:00
|
|
|
#=============================================================================
|
|
|
|
# tests
|
|
|
|
#
|
|
|
|
|
|
|
|
# TODO: find a way to keep this in sync with tests_main
|
|
|
|
set(tests
|
|
|
|
autodeclination
|
|
|
|
bson
|
|
|
|
commander
|
|
|
|
controllib
|
|
|
|
conv
|
2018-04-09 02:47:22 -03:00
|
|
|
ctlmath
|
2017-02-15 15:18:50 -04:00
|
|
|
dataman
|
2017-01-04 23:19:08 -04:00
|
|
|
file2
|
|
|
|
float
|
|
|
|
gpio
|
|
|
|
hrt
|
|
|
|
hysteresis
|
|
|
|
int
|
|
|
|
mathlib
|
|
|
|
matrix
|
|
|
|
mavlink
|
|
|
|
mc_pos_control
|
2018-06-18 10:51:58 -03:00
|
|
|
microbench
|
2017-01-04 23:19:08 -04:00
|
|
|
mixer
|
|
|
|
param
|
2017-06-05 17:23:00 -03:00
|
|
|
parameters
|
2017-01-04 23:19:08 -04:00
|
|
|
perf
|
|
|
|
rc
|
|
|
|
servo
|
|
|
|
sf0x
|
|
|
|
sleep
|
|
|
|
uorb
|
2017-10-05 06:19:35 -03:00
|
|
|
versioning
|
2017-01-04 23:19:08 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
list(REMOVE_ITEM tests
|
|
|
|
hysteresis
|
|
|
|
mixer
|
|
|
|
uorb
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
foreach(test_name ${tests})
|
2017-09-27 19:25:48 -03:00
|
|
|
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)
|
2017-01-04 23:19:08 -04:00
|
|
|
|
|
|
|
add_test(NAME ${test_name}
|
|
|
|
COMMAND ${PX4_SOURCE_DIR}/Tools/sitl_run.sh
|
|
|
|
$<TARGET_FILE:px4>
|
|
|
|
posix-configs/SITL/init/test
|
|
|
|
none
|
|
|
|
none
|
2017-09-27 19:25:48 -03:00
|
|
|
tests_${test_name}_generated
|
2017-01-04 23:19:08 -04:00
|
|
|
${PX4_SOURCE_DIR}
|
|
|
|
${PX4_BINARY_DIR}
|
2018-01-31 19:49:09 -04:00
|
|
|
WORKING_DIRECTORY ${SITL_WORKING_DIR})
|
2017-01-04 23:19:08 -04:00
|
|
|
|
2017-02-15 15:18:50 -04:00
|
|
|
set_tests_properties(${test_name} PROPERTIES FAIL_REGULAR_EXPRESSION "${test_name} FAILED")
|
2017-01-04 23:19:08 -04:00
|
|
|
set_tests_properties(${test_name} PROPERTIES PASS_REGULAR_EXPRESSION "${test_name} PASSED")
|
|
|
|
endforeach()
|
|
|
|
|
2017-09-27 19:25:48 -03:00
|
|
|
# run arbitrary commands
|
|
|
|
set(test_cmds
|
|
|
|
hello
|
|
|
|
hrt_test
|
|
|
|
muorb_test
|
|
|
|
vcdev_test
|
|
|
|
wqueue_test
|
|
|
|
)
|
|
|
|
|
|
|
|
foreach(cmd_name ${test_cmds})
|
|
|
|
configure_file(${PX4_SOURCE_DIR}/posix-configs/SITL/init/test/cmd_template.in ${PX4_SOURCE_DIR}/posix-configs/SITL/init/test/cmd_${cmd_name}_generated)
|
|
|
|
|
|
|
|
add_test(NAME posix_${cmd_name}
|
|
|
|
COMMAND ${PX4_SOURCE_DIR}/Tools/sitl_run.sh
|
|
|
|
$<TARGET_FILE:px4>
|
|
|
|
posix-configs/SITL/init/test
|
|
|
|
none
|
|
|
|
none
|
|
|
|
cmd_${cmd_name}_generated
|
|
|
|
${PX4_SOURCE_DIR}
|
|
|
|
${PX4_BINARY_DIR}
|
2018-01-31 19:49:09 -04:00
|
|
|
WORKING_DIRECTORY ${SITL_WORKING_DIR})
|
2017-09-27 19:25:48 -03:00
|
|
|
|
|
|
|
set_tests_properties(posix_${cmd_name} PROPERTIES PASS_REGULAR_EXPRESSION "Shutting down")
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
2017-01-04 23:19:08 -04:00
|
|
|
add_custom_target(test_results
|
|
|
|
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -T Test
|
|
|
|
DEPENDS px4
|
|
|
|
USES_TERMINAL
|
|
|
|
COMMENT "Running tests in sitl"
|
|
|
|
WORKING_DIRECTORY ${PX4_BINARY_DIR})
|
|
|
|
set_target_properties(test_results PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
|
|
|
|
2017-06-01 09:47:33 -03:00
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL Coverage)
|
2018-05-05 17:55:36 -03:00
|
|
|
setup_target_for_coverage(test_coverage "${CMAKE_CTEST_COMMAND} --output-on-failure -T Test" tests)
|
|
|
|
setup_target_for_coverage(generate_coverage "${CMAKE_COMMAND} -E echo" generic)
|
2017-06-01 09:47:33 -03:00
|
|
|
endif()
|
|
|
|
|
2017-01-04 23:19:08 -04:00
|
|
|
add_custom_target(test_results_junit
|
|
|
|
COMMAND xsltproc ${PX4_SOURCE_DIR}/Tools/CTest2JUnit.xsl Testing/`head -n 1 < Testing/TAG`/Test.xml > JUnitTestResults.xml
|
2017-11-05 16:04:14 -04:00
|
|
|
DEPENDS test_results
|
2017-01-04 23:19:08 -04:00
|
|
|
COMMENT "Converting ctest output to junit xml"
|
|
|
|
WORKING_DIRECTORY ${PX4_BINARY_DIR})
|
|
|
|
set_target_properties(test_results_junit PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
|
|
|
|
|
|
|
add_custom_target(test_cdash_submit
|
|
|
|
COMMAND ${CMAKE_CTEST_COMMAND} -D Experimental
|
|
|
|
USES_TERMINAL
|
|
|
|
WORKING_DIRECTORY ${PX4_BINARY_DIR})
|
|
|
|
set_target_properties(test_cdash_submit PROPERTIES EXCLUDE_FROM_ALL TRUE)
|