mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-21 01:12:11 +00:00
testing build: add possibility to filter tests with ctest regex
This commit is contained in:
@@ -418,13 +418,14 @@ option(CMAKE_TESTING "Configure test targets" OFF)
|
|||||||
if(CMAKE_TESTING)
|
if(CMAKE_TESTING)
|
||||||
include(CTest)
|
include(CTest)
|
||||||
endif()
|
endif()
|
||||||
|
set(TESTFILTER "" CACHE STRING "Filter string for ctest to selectively only run specific tests (ctest -R)")
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH ${PX4_SOURCE_DIR}/cmake/gtest/)
|
list(APPEND CMAKE_MODULE_PATH ${PX4_SOURCE_DIR}/cmake/gtest/)
|
||||||
include(px4_add_gtest)
|
include(px4_add_gtest)
|
||||||
|
|
||||||
if(BUILD_TESTING)
|
if(BUILD_TESTING)
|
||||||
include(gtest)
|
include(gtest)
|
||||||
add_custom_target(unit_test COMMAND GTEST_COLOR=1 ${CMAKE_CTEST_COMMAND} -V -R UnitTest- USES_TERMINAL)
|
add_custom_target(unit_test COMMAND GTEST_COLOR=1 ${CMAKE_CTEST_COMMAND} -V -R ${TESTFILTER} USES_TERMINAL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
|
|||||||
1
Makefile
1
Makefile
@@ -349,6 +349,7 @@ unit_test:
|
|||||||
tests:
|
tests:
|
||||||
$(eval CMAKE_ARGS += -DCMAKE_TESTING=ON)
|
$(eval CMAKE_ARGS += -DCMAKE_TESTING=ON)
|
||||||
$(eval CMAKE_ARGS += -DCONFIG=px4_sitl_test)
|
$(eval CMAKE_ARGS += -DCONFIG=px4_sitl_test)
|
||||||
|
$(eval CMAKE_ARGS += -DTESTFILTER=$(TESTFILTER))
|
||||||
$(eval ARGS += test_results)
|
$(eval ARGS += test_results)
|
||||||
$(eval ASAN_OPTIONS += color=always:check_initialization_order=1:detect_stack_use_after_return=1)
|
$(eval ASAN_OPTIONS += color=always:check_initialization_order=1:detect_stack_use_after_return=1)
|
||||||
$(eval UBSAN_OPTIONS += color=always)
|
$(eval UBSAN_OPTIONS += color=always)
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ endforeach()
|
|||||||
|
|
||||||
|
|
||||||
add_custom_target(test_results
|
add_custom_target(test_results
|
||||||
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -T Test
|
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -T Test -R ${TESTFILTER}
|
||||||
DEPENDS
|
DEPENDS
|
||||||
px4
|
px4
|
||||||
examples__dyn_hello
|
examples__dyn_hello
|
||||||
|
|||||||
Reference in New Issue
Block a user