Skip to content

Commit 051af4c

Browse files
committed
cmake, test: Introduce SECP256K1_TESTNAME_PREFIX variable
This change enables downstream projects to add a custom prefix to the libsecp256k1 tests, facilitating the use of `ctest` regex matching options.
1 parent 3fdf146 commit 051af4c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

examples/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function(add_example name)
99
$<$<PLATFORM_ID:Windows>:bcrypt>
1010
)
1111
set(test_name ${name}_example)
12-
add_test(NAME ${test_name} COMMAND ${target_name})
12+
add_test(NAME ${SECP256K1_TESTNAME_PREFIX}${test_name} COMMAND ${target_name})
1313
if(BUILD_SHARED_LIBS AND MSVC)
1414
# The DLL must reside either in the same folder where the executable is
1515
# or somewhere in PATH. Using the latter option.

src/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ endif()
8787
if(SECP256K1_BUILD_TESTS)
8888
add_executable(noverify_tests tests.c)
8989
target_link_libraries(noverify_tests secp256k1_precomputed secp256k1_asm)
90-
add_test(NAME noverify_tests COMMAND noverify_tests)
90+
add_test(NAME ${SECP256K1_TESTNAME_PREFIX}noverify_tests COMMAND noverify_tests)
9191
if(NOT CMAKE_BUILD_TYPE STREQUAL "Coverage")
9292
add_executable(tests tests.c)
9393
target_compile_definitions(tests PRIVATE VERIFY)
9494
target_link_libraries(tests secp256k1_precomputed secp256k1_asm)
95-
add_test(NAME tests COMMAND tests)
95+
add_test(NAME ${SECP256K1_TESTNAME_PREFIX}tests COMMAND tests)
9696
endif()
9797
endif()
9898

@@ -101,7 +101,7 @@ if(SECP256K1_BUILD_EXHAUSTIVE_TESTS)
101101
add_executable(exhaustive_tests tests_exhaustive.c)
102102
target_link_libraries(exhaustive_tests secp256k1_asm)
103103
target_compile_definitions(exhaustive_tests PRIVATE $<$<NOT:$<CONFIG:Coverage>>:VERIFY>)
104-
add_test(NAME exhaustive_tests COMMAND exhaustive_tests)
104+
add_test(NAME ${SECP256K1_TESTNAME_PREFIX}exhaustive_tests COMMAND exhaustive_tests)
105105
endif()
106106

107107
if(SECP256K1_BUILD_CTIME_TESTS)

0 commit comments

Comments
 (0)