rahman
rahman

Reputation: 4948

How to pass --gtest_filter to ctest

I am migrating one of my test folders to gtest, it includes multiple files each having its own test Fixture.

So far, my -simplified- cmake is :

file(GLOB SOURCES *.c)
set(EXECUTABLE_NAME "mytest")
add_executable(${EXECUTABLE_NAME} ${SOURCES})
gtest_add_tests(TARGET ${EXECUTABLE_NAME} TEST_LIST ${EXECUTABLE_NAME}_TESTS)
# add_test(NAME ${EXECUTABLE_NAME} COMMAND ${EXECUTABLE_NAME}) #tried

So far, ctest -N shows as many tests while I wish to:

create a single test and be able to pass gtest_filter to run only one of the files/test-suites. Something like this:

ctest --gtest_filter=*BLAH*

I should be able to do this in windows as well as linux.

Upvotes: 0

Views: 104

Answers (0)

Related Questions