Skip to content

Commit

Permalink
Adapt cmake to extract the TEST_F gtest tests
Browse files Browse the repository at this point in the history
Signed-off-by: laura-eprosima <[email protected]>
  • Loading branch information
laura-eprosima committed Jul 12, 2021
1 parent 81370e6 commit aaf725e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,6 @@ ENV/
.catkin_workspace
devel/
build/

# vscode
.txt.user
3 changes: 2 additions & 1 deletion core/cmake/common/gtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,15 @@ macro(add_gtest)
endif()

foreach(GTEST_SOURCE_FILE ${GTEST_SOURCES})
file(STRINGS ${GTEST_SOURCE_FILE} GTEST_TEST_NAMES REGEX "^TEST")
file(STRINGS ${GTEST_SOURCE_FILE} GTEST_TEST_NAMES REGEX "^TEST_F|^TEST")
foreach(GTEST_TEST_NAME ${GTEST_TEST_NAMES})
string(REGEX REPLACE ["\) \(,"] ";" GTEST_TEST_NAME ${GTEST_TEST_NAME})
list(GET GTEST_TEST_NAME 1 GTEST_GROUP_NAME)
list(GET GTEST_TEST_NAME 3 GTEST_TEST_NAME)
add_test(NAME ${GTEST_GROUP_NAME}.${GTEST_TEST_NAME}
COMMAND ${command} --gtest_filter=${GTEST_GROUP_NAME}.${GTEST_TEST_NAME}:*/${GTEST_GROUP_NAME}.${GTEST_TEST_NAME}/*)


# Add environment
set(GTEST_ENVIRONMENT "")
if(WIN32)
Expand Down

0 comments on commit aaf725e

Please sign in to comment.