@@ -144,16 +144,42 @@ if(SECP256K1_BUILD_TESTS)
144144 list (APPEND TEST_DEFINITIONS SUPPORTS_CONCURRENCY=1)
145145 endif ()
146146
147- function (add_executable_and_tests exe_name verify_definition)
147+ set (test_targets "" )
148+ set (test_names "" )
149+ # Start with the longest-running tests.
150+ list (APPEND test_targets ellswift)
151+ list (APPEND test_names ellswift)
152+ list (APPEND test_targets ecmult_constants)
153+ list (APPEND test_names ecmult_constants)
154+ list (APPEND test_targets "ecmult_pre_g wnaf point_times_order ecmult_near_split_bound ecmult_chain ecmult_gen_blind ecmult_const_tests ecmult_multi_tests ec_combine" )
155+ list (APPEND test_names ecmult)
156+ # Continue with the remaining tests.
157+ list (APPEND test_targets integer scalar field group ec ecdh ecdsa recovery extrakeys schnorrsig musig)
158+ list (APPEND test_names integer scalar field group ec ecdh ecdsa recovery extrakeys schnorrsig musig)
159+ # Combine short, trivial tests for log brevity.
160+ list (APPEND test_targets "general hash utils" )
161+ list (APPEND test_names "general,hash,utils" )
162+
163+ function (add_executable_and_tests exe_name verify_definition label)
148164 add_executable (${exe_name} tests.c)
149165 target_link_libraries (${exe_name} secp256k1_precomputed secp256k1_asm)
150166 target_compile_definitions (${exe_name} PRIVATE ${verify_definition} ${TEST_DEFINITIONS} )
151- add_test (NAME secp256k1_${exe_name} COMMAND ${exe_name} )
167+ foreach (test_target test_name IN ZIP_LISTS test_targets test_names)
168+ string (REPLACE " " ";" test_target "${test_target} " )
169+ list (TRANSFORM test_target PREPEND "--target=" )
170+ add_test (NAME ${label} ::${test_name}
171+ COMMAND ${exe_name} ${test_target} --log =1
172+ COMMAND_EXPAND_LISTS
173+ )
174+ set_tests_properties (${label} ::${test_name} PROPERTIES
175+ SKIP_REGULAR_EXPRESSION "module disabled"
176+ )
177+ endforeach ()
152178 endfunction ()
153179
154- add_executable_and_tests(noverify_tests "" )
180+ add_executable_and_tests(noverify_tests "" secp256k1_noverify )
155181 if (NOT CMAKE_BUILD_TYPE STREQUAL "Coverage" )
156- add_executable_and_tests(tests VERIFY)
182+ add_executable_and_tests(tests VERIFY secp256k1_verify )
157183 endif ()
158184 unset (TEST_DEFINITIONS)
159185endif ()
0 commit comments