cmake: Integrate DiscoverTests and normalize test names
Updates the build system to use the new DiscoverTests module. This also standardizes test names to use dot-separated parts for consistency.
This commit is contained in:
@@ -8,8 +8,7 @@ function(add_example name)
|
||||
secp256k1
|
||||
$<$<PLATFORM_ID:Windows>:bcrypt>
|
||||
)
|
||||
set(test_name ${name}_example)
|
||||
add_test(NAME secp256k1_${test_name} COMMAND ${target_name})
|
||||
add_test(NAME secp256k1.example.${name} COMMAND ${target_name})
|
||||
endfunction()
|
||||
|
||||
add_example(ecdsa)
|
||||
|
||||
@@ -148,7 +148,13 @@ if(SECP256K1_BUILD_TESTS)
|
||||
add_executable(${exe_name} tests.c)
|
||||
target_link_libraries(${exe_name} secp256k1_precomputed secp256k1_asm)
|
||||
target_compile_definitions(${exe_name} PRIVATE ${verify_definition} ${TEST_DEFINITIONS})
|
||||
add_test(NAME secp256k1_${exe_name} COMMAND ${exe_name})
|
||||
include(DiscoverTests)
|
||||
discover_tests(${exe_name}
|
||||
DISCOVERY_ARGS "--list_tests"
|
||||
DISCOVERY_MATCH "^\\t\\\\[ *[0-9]+\\\\] ([^ ].*)$"
|
||||
TEST_NAME_REPLACEMENT "secp256k1.${exe_name}.\\\\1"
|
||||
TEST_ARGS_REPLACEMENT "--target=\\\\1 --log=1"
|
||||
)
|
||||
endfunction()
|
||||
|
||||
add_executable_and_tests(noverify_tests "")
|
||||
@@ -163,7 +169,7 @@ if(SECP256K1_BUILD_EXHAUSTIVE_TESTS)
|
||||
add_executable(exhaustive_tests tests_exhaustive.c)
|
||||
target_link_libraries(exhaustive_tests secp256k1_asm)
|
||||
target_compile_definitions(exhaustive_tests PRIVATE $<$<NOT:$<CONFIG:Coverage>>:VERIFY>)
|
||||
add_test(NAME secp256k1_exhaustive_tests COMMAND exhaustive_tests)
|
||||
add_test(NAME secp256k1.exhaustive_tests COMMAND exhaustive_tests)
|
||||
endif()
|
||||
|
||||
if(SECP256K1_BUILD_CTIME_TESTS)
|
||||
|
||||
Reference in New Issue
Block a user