gtest cmake: fix unit test filter

This commit is contained in:
Matthias Grob 2024-11-19 20:32:40 +01:00 committed by Daniel Agar
parent 129c0f188a
commit 1aadbf85af

View File

@ -408,14 +408,15 @@ include(px4_add_gtest)
if(BUILD_TESTING)
include(gtest)
set(TESTFILTERARG "")
# Ensure there's no -R without any filter expression since that trips newer ctest versions
if(TESTFILTER)
set(TESTFILTERARG "-R ${TESTFILTER}")
set(TESTFILTERARG "-R")
else()
set(TESTFILTERARG "")
endif()
add_custom_target(test_results
COMMAND GTEST_COLOR=1 ${CMAKE_CTEST_COMMAND} --output-on-failure -T Test ${TESTFILTERARG}
COMMAND GTEST_COLOR=1 ${CMAKE_CTEST_COMMAND} --output-on-failure -T Test ${TESTFILTERARG} ${TESTFILTER}
DEPENDS
px4
examples__dyn_hello