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 authored and Miguel Barro committed May 24, 2023
1 parent 7be2e67 commit 4ef43b3
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 @@ -77,14 +77,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 4ef43b3

Please sign in to comment.