cmake: Use full signature of add_test() command

An executable target in the `COMMAND` option will automatically be
replaced by the location of the executable created at build time.

This change fixes tests for Windows binaries using Wine.
This commit is contained in:
Hennadii Stepanov 2023-04-29 09:49:25 +01:00
parent 4b0f711d46
commit 755629bc03
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F
3 changed files with 7 additions and 7 deletions

View File

@ -403,7 +403,7 @@ task:
- cmake --build build --config RelWithDebInfo -- -property:UseMultiToolTask=true;CL_MPcount=5 - cmake --build build --config RelWithDebInfo -- -property:UseMultiToolTask=true;CL_MPcount=5
check_script: check_script:
- '%x64_NATIVE_TOOLS%' - '%x64_NATIVE_TOOLS%'
- ctest --test-dir build -j 5 - ctest -C RelWithDebInfo --test-dir build -j 5
- build\src\RelWithDebInfo\bench_ecmult.exe - build\src\RelWithDebInfo\bench_ecmult.exe
- build\src\RelWithDebInfo\bench_internal.exe - build\src\RelWithDebInfo\bench_internal.exe
- build\src\RelWithDebInfo\bench.exe - build\src\RelWithDebInfo\bench.exe

View File

@ -12,16 +12,16 @@ endif()
add_executable(ecdsa_example ecdsa.c) add_executable(ecdsa_example ecdsa.c)
target_link_libraries(ecdsa_example example) target_link_libraries(ecdsa_example example)
add_test(ecdsa_example ecdsa_example) add_test(NAME ecdsa_example COMMAND ecdsa_example)
if(SECP256K1_ENABLE_MODULE_ECDH) if(SECP256K1_ENABLE_MODULE_ECDH)
add_executable(ecdh_example ecdh.c) add_executable(ecdh_example ecdh.c)
target_link_libraries(ecdh_example example) target_link_libraries(ecdh_example example)
add_test(ecdh_example ecdh_example) add_test(NAME ecdh_example COMMAND ecdh_example)
endif() endif()
if(SECP256K1_ENABLE_MODULE_SCHNORRSIG) if(SECP256K1_ENABLE_MODULE_SCHNORRSIG)
add_executable(schnorr_example schnorr.c) add_executable(schnorr_example schnorr.c)
target_link_libraries(schnorr_example example) target_link_libraries(schnorr_example example)
add_test(schnorr_example schnorr_example) add_test(NAME schnorr_example COMMAND schnorr_example)
endif() endif()

View File

@ -53,12 +53,12 @@ endif()
if(SECP256K1_BUILD_TESTS) if(SECP256K1_BUILD_TESTS)
add_executable(noverify_tests tests.c) add_executable(noverify_tests tests.c)
target_link_libraries(noverify_tests secp256k1_precomputed secp256k1_asm) target_link_libraries(noverify_tests secp256k1_precomputed secp256k1_asm)
add_test(noverify_tests noverify_tests) add_test(NAME noverify_tests COMMAND noverify_tests)
if(NOT CMAKE_BUILD_TYPE STREQUAL "Coverage") if(NOT CMAKE_BUILD_TYPE STREQUAL "Coverage")
add_executable(tests tests.c) add_executable(tests tests.c)
target_compile_definitions(tests PRIVATE VERIFY) target_compile_definitions(tests PRIVATE VERIFY)
target_link_libraries(tests secp256k1_precomputed secp256k1_asm) target_link_libraries(tests secp256k1_precomputed secp256k1_asm)
add_test(tests tests) add_test(NAME tests COMMAND tests)
endif() endif()
endif() endif()
@ -67,7 +67,7 @@ if(SECP256K1_BUILD_EXHAUSTIVE_TESTS)
add_executable(exhaustive_tests tests_exhaustive.c) add_executable(exhaustive_tests tests_exhaustive.c)
target_link_libraries(exhaustive_tests secp256k1_asm) target_link_libraries(exhaustive_tests secp256k1_asm)
target_compile_definitions(exhaustive_tests PRIVATE $<$<NOT:$<CONFIG:Coverage>>:VERIFY>) target_compile_definitions(exhaustive_tests PRIVATE $<$<NOT:$<CONFIG:Coverage>>:VERIFY>)
add_test(exhaustive_tests exhaustive_tests) add_test(NAME exhaustive_tests COMMAND exhaustive_tests)
endif() endif()
if(SECP256K1_BUILD_CTIME_TESTS) if(SECP256K1_BUILD_CTIME_TESTS)