Skip to content

Commit 6060dc3

Browse files
committed
update catch2 macro, fix conflicts
1 parent d846200 commit 6060dc3

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

lib/CMakeLists.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,22 @@ if(BUILD_TESTING)
5050
# done in one TEST_CASE expected to carry over into the next TEST_CASE. This
5151
# macro allows us to add common command line arguments to all tests. For now,
5252
# we ensure declaration order execution via --order decl.
53+
# macro(add_catch2_test)
54+
# set(oneValueArgs NAME ENVIRONMENT)
55+
# cmake_parse_arguments(CATCH2_TEST "" ${oneValueArgs} "" ${ARGN})
56+
# catch_discover_tests(${CATCH2_TEST_NAME} PROPERTIES ENVIRONMENT ${CATCH2_TEST_ENVIRONMENT})
57+
# endmacro()
5358
macro(add_catch2_test)
54-
set(oneValueArgs NAME ENVIRONMENT)
55-
cmake_parse_arguments(CATCH2_TEST "" ${oneValueArgs} "" ${ARGN})
56-
catch_discover_tests(${CATCH2_TEST_NAME} PROPERTIES ENVIRONMENT ${CATCH2_TEST_ENVIRONMENT})
59+
cmake_parse_arguments(CATCH2_TEST "" "NAME" "ENVIRONMENT" ${ARGN})
60+
61+
set(_catch_properties)
62+
if(CATCH2_TEST_ENVIRONMENT)
63+
list(APPEND _catch_properties ENVIRONMENT "${CATCH2_TEST_ENVIRONMENT}")
64+
endif()
65+
66+
catch_discover_tests(${CATCH2_TEST_NAME} PROPERTIES ${_catch_properties})
5767
endmacro()
68+
5869
endif()
5970

6071
if(NOT TARGET yaml-cpp::yaml-cpp)

plugins/esi/test/CMakeLists.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@ target_link_libraries(esitest PUBLIC esi-common esicore)
2121
macro(ADD_ESI_TEST NAME)
2222
add_executable(${NAME} print_funcs.cc ${ARGN})
2323
target_link_libraries(${NAME} PRIVATE esitest)
24-
add_catch2_test(NAME ${NAME} COMMAND $<TARGET_FILE:${NAME}>)
25-
# Use ASan leak suppression for intentional DbgCtl leaks (issue #12776)
26-
set_tests_properties(
27-
${NAME} PROPERTIES ENVIRONMENT
28-
"LSAN_OPTIONS=suppressions=${CMAKE_CURRENT_SOURCE_DIR}/esi_test_leak_suppression.txt"
24+
add_catch2_test(
25+
NAME ${NAME} ENVIRONMENT "LSAN_OPTIONS=suppressions=${CMAKE_CURRENT_SOURCE_DIR}/esi_test_leak_suppression.txt"
2926
)
3027
endmacro()
3128

0 commit comments

Comments
 (0)