Paul Bakker | b06819b | 2011-01-18 16:18:38 +0000 | [diff] [blame] | 1 | set(libs |
Raef Coles | 995c66f | 2020-10-13 16:30:41 +0100 | [diff] [blame] | 2 | ${mbedtls_target} |
Paul Elliott | 2667eda | 2023-11-29 15:53:00 +0000 | [diff] [blame] | 3 | ${CMAKE_THREAD_LIBS_INIT} |
Paul Bakker | b06819b | 2011-01-18 16:18:38 +0000 | [diff] [blame] | 4 | ) |
| 5 | |
okhowang(王沛文) | 3c1b090 | 2020-03-25 19:55:32 +0800 | [diff] [blame] | 6 | if(NOT MBEDTLS_PYTHON_EXECUTABLE) |
| 7 | message(FATAL_ERROR "Cannot build test suites without Python 3") |
Nicholas Wilson | 733676b | 2015-11-14 13:09:01 +0000 | [diff] [blame] | 8 | endif() |
| 9 | |
Manuel Pégourié-Gonnard | 313bcfc | 2021-09-07 12:16:49 +0200 | [diff] [blame] | 10 | # generated .data files will go there |
| 11 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/suites) |
| 12 | |
Gilles Peskine | cca6ce8 | 2022-09-18 23:08:38 +0200 | [diff] [blame] | 13 | # Get base names for generated files |
David Horstmann | 1732b5d | 2021-10-19 16:43:53 +0100 | [diff] [blame] | 14 | execute_process( |
| 15 | COMMAND |
David Horstmann | 3e30ad9 | 2021-10-20 16:53:58 +0100 | [diff] [blame] | 16 | ${MBEDTLS_PYTHON_EXECUTABLE} |
Ronald Cron | b6254f5 | 2024-07-25 14:52:19 +0200 | [diff] [blame] | 17 | ${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_config_tests.py |
Gilles Peskine | e154e6f | 2024-05-23 16:31:22 +0200 | [diff] [blame] | 18 | --list-for-cmake |
| 19 | WORKING_DIRECTORY |
| 20 | ${CMAKE_CURRENT_SOURCE_DIR}/.. |
| 21 | OUTPUT_VARIABLE |
Ronald Cron | 81a674e | 2025-03-11 12:53:45 +0100 | [diff] [blame] | 22 | base_config_generated_data_files) |
Gilles Peskine | e154e6f | 2024-05-23 16:31:22 +0200 | [diff] [blame] | 23 | string(REGEX REPLACE "[^;]*/" "" |
Ronald Cron | 81a674e | 2025-03-11 12:53:45 +0100 | [diff] [blame] | 24 | base_config_generated_data_files "${base_config_generated_data_files}") |
David Horstmann | 7570d24 | 2021-10-20 16:27:24 +0100 | [diff] [blame] | 25 | |
Gilles Peskine | cca6ce8 | 2022-09-18 23:08:38 +0200 | [diff] [blame] | 26 | # Derive generated file paths in the build directory. The generated data |
| 27 | # files go into the suites/ subdirectory. |
| 28 | set(base_generated_data_files |
Ronald Cron | f76cd22 | 2024-07-09 14:24:35 +0200 | [diff] [blame] | 29 | ${base_config_generated_data_files}) |
Gilles Peskine | cca6ce8 | 2022-09-18 23:08:38 +0200 | [diff] [blame] | 30 | string(REGEX REPLACE "([^;]+)" "suites/\\1" |
| 31 | all_generated_data_files "${base_generated_data_files}") |
Gilles Peskine | e154e6f | 2024-05-23 16:31:22 +0200 | [diff] [blame] | 32 | set(config_generated_data_files "") |
Gilles Peskine | e154e6f | 2024-05-23 16:31:22 +0200 | [diff] [blame] | 33 | foreach(file ${base_config_generated_data_files}) |
| 34 | list(APPEND config_generated_data_files ${CMAKE_CURRENT_BINARY_DIR}/suites/${file}) |
| 35 | endforeach() |
David Horstmann | 1732b5d | 2021-10-19 16:43:53 +0100 | [diff] [blame] | 36 | |
David Horstmann | a8d1406 | 2021-10-20 17:14:23 +0100 | [diff] [blame] | 37 | if(GEN_FILES) |
Manuel Pégourié-Gonnard | e90e405 | 2021-09-08 13:27:09 +0200 | [diff] [blame] | 38 | add_custom_command( |
| 39 | OUTPUT |
Gilles Peskine | e154e6f | 2024-05-23 16:31:22 +0200 | [diff] [blame] | 40 | ${config_generated_data_files} |
| 41 | WORKING_DIRECTORY |
| 42 | ${CMAKE_CURRENT_SOURCE_DIR}/.. |
| 43 | COMMAND |
| 44 | ${MBEDTLS_PYTHON_EXECUTABLE} |
Ronald Cron | b6254f5 | 2024-07-25 14:52:19 +0200 | [diff] [blame] | 45 | ${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_config_tests.py |
Gilles Peskine | e154e6f | 2024-05-23 16:31:22 +0200 | [diff] [blame] | 46 | --directory ${CMAKE_CURRENT_BINARY_DIR}/suites |
| 47 | DEPENDS |
Ronald Cron | b6254f5 | 2024-07-25 14:52:19 +0200 | [diff] [blame] | 48 | ${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_config_tests.py |
Gilles Peskine | e154e6f | 2024-05-23 16:31:22 +0200 | [diff] [blame] | 49 | # Do not declare the configuration files as dependencies: they |
| 50 | # change too often in ways that don't affect the result |
| 51 | # ((un)commenting some options). |
| 52 | ) |
Gilles Peskine | 4773333 | 2025-03-01 14:28:20 +0100 | [diff] [blame] | 53 | |
| 54 | add_custom_command( |
| 55 | OUTPUT |
| 56 | ${CMAKE_CURRENT_SOURCE_DIR}/opt-testcases/handshake-generated.sh |
| 57 | WORKING_DIRECTORY |
| 58 | ${CMAKE_CURRENT_SOURCE_DIR}/.. |
| 59 | COMMAND |
| 60 | "${MBEDTLS_PYTHON_EXECUTABLE}" |
| 61 | "${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_tls_handshake_tests.py" |
| 62 | DEPENDS |
| 63 | ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/tls_test_case.py |
| 64 | ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_tls_handshake_tests.py |
| 65 | ) |
| 66 | add_custom_target(handshake-generated.sh |
| 67 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/opt-testcases/handshake-generated.sh) |
| 68 | set_target_properties(handshake-generated.sh PROPERTIES EXCLUDE_FROM_ALL NO) |
| 69 | add_dependencies(${ssl_opt_target} handshake-generated.sh) |
| 70 | |
Gilles Peskine | 40c090f | 2024-09-19 19:20:00 +0200 | [diff] [blame] | 71 | add_custom_command( |
| 72 | OUTPUT |
| 73 | ${CMAKE_CURRENT_SOURCE_DIR}/opt-testcases/tls13-compat.sh |
| 74 | WORKING_DIRECTORY |
| 75 | ${CMAKE_CURRENT_SOURCE_DIR}/.. |
| 76 | COMMAND |
| 77 | "${MBEDTLS_PYTHON_EXECUTABLE}" |
Elena Uziunaite | b74c3ea | 2024-10-08 13:02:48 +0100 | [diff] [blame] | 78 | "${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_tls13_compat_tests.py" |
Gilles Peskine | 40c090f | 2024-09-19 19:20:00 +0200 | [diff] [blame] | 79 | DEPENDS |
Elena Uziunaite | b74c3ea | 2024-10-08 13:02:48 +0100 | [diff] [blame] | 80 | ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_tls13_compat_tests.py |
Gilles Peskine | 40c090f | 2024-09-19 19:20:00 +0200 | [diff] [blame] | 81 | ) |
| 82 | add_custom_target(tls13-compat.sh |
| 83 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/opt-testcases/tls13-compat.sh) |
Gilles Peskine | fd6d279 | 2024-09-19 19:27:31 +0200 | [diff] [blame] | 84 | set_target_properties(tls13-compat.sh PROPERTIES EXCLUDE_FROM_ALL NO) |
Gilles Peskine | 63068d6 | 2024-09-24 19:09:57 +0200 | [diff] [blame] | 85 | add_dependencies(${ssl_opt_target} tls13-compat.sh) |
Gilles Peskine | 40c090f | 2024-09-19 19:20:00 +0200 | [diff] [blame] | 86 | |
Manuel Pégourié-Gonnard | e90e405 | 2021-09-08 13:27:09 +0200 | [diff] [blame] | 87 | else() |
Gilles Peskine | cca6ce8 | 2022-09-18 23:08:38 +0200 | [diff] [blame] | 88 | foreach(file ${all_generated_data_files}) |
David Horstmann | 1732b5d | 2021-10-19 16:43:53 +0100 | [diff] [blame] | 89 | link_to_source(${file}) |
| 90 | endforeach() |
Manuel Pégourié-Gonnard | e90e405 | 2021-09-08 13:27:09 +0200 | [diff] [blame] | 91 | endif() |
Jerry Yu | 3b86d1b | 2022-03-02 10:40:41 +0800 | [diff] [blame] | 92 | # CMake generates sub-makefiles for each target and calls them in subprocesses. |
| 93 | # Without this command, cmake will generate rules in each sub-makefile. As a result, |
| 94 | # they can cause race conditions in parallel builds. |
| 95 | # With this line, only 4 sub-makefiles include the above command, that reduces |
| 96 | # the risk of a race. |
Gilles Peskine | ef822c1 | 2024-05-28 19:07:24 +0200 | [diff] [blame] | 97 | add_custom_target(test_suite_config_generated_data DEPENDS ${config_generated_data_files}) |
David Horstmann | 3861062 | 2022-11-28 10:18:05 +0000 | [diff] [blame] | 98 | # If SKIP_TEST_SUITES is not defined with -D, get it from the environment. |
| 99 | if((NOT DEFINED SKIP_TEST_SUITES) AND (DEFINED ENV{SKIP_TEST_SUITES})) |
| 100 | set(SKIP_TEST_SUITES $ENV{SKIP_TEST_SUITES}) |
| 101 | endif() |
Gilles Peskine | ac372cc | 2018-11-29 10:15:06 +0000 | [diff] [blame] | 102 | # Test suites caught by SKIP_TEST_SUITES are built but not executed. |
| 103 | # "foo" as a skip pattern skips "test_suite_foo" and "test_suite_foo.bar" |
| 104 | # but not "test_suite_foobar". |
| 105 | string(REGEX REPLACE "[ ,;]" "|" SKIP_TEST_SUITES_REGEX "${SKIP_TEST_SUITES}") |
| 106 | string(REPLACE "." "\\." SKIP_TEST_SUITES_REGEX "${SKIP_TEST_SUITES_REGEX}") |
| 107 | set(SKIP_TEST_SUITES_REGEX "^(${SKIP_TEST_SUITES_REGEX})(\$|\\.)") |
| 108 | |
Paul Bakker | 7304376 | 2011-07-13 15:03:10 +0000 | [diff] [blame] | 109 | function(add_test_suite suite_name) |
| 110 | if(ARGV1) |
Manuel Pégourié-Gonnard | 216a183 | 2015-06-25 09:20:03 +0200 | [diff] [blame] | 111 | set(data_name ${ARGV1}) |
Paul Bakker | 7304376 | 2011-07-13 15:03:10 +0000 | [diff] [blame] | 112 | else() |
Manuel Pégourié-Gonnard | 216a183 | 2015-06-25 09:20:03 +0200 | [diff] [blame] | 113 | set(data_name ${suite_name}) |
Paul Bakker | 46c1794 | 2011-07-13 14:54:54 +0000 | [diff] [blame] | 114 | endif() |
| 115 | |
David Horstmann | ae7bd35 | 2021-10-19 19:05:42 +0100 | [diff] [blame] | 116 | # Get the test names of the tests with generated .data files |
| 117 | # from the generated_data_files list in parent scope. |
Ronald Cron | 7f410db | 2024-07-09 14:20:34 +0200 | [diff] [blame] | 118 | set(config_generated_data_names "") |
Ronald Cron | 7f410db | 2024-07-09 14:20:34 +0200 | [diff] [blame] | 119 | foreach(generated_data_file ${config_generated_data_files}) |
| 120 | # Get the plain filename |
| 121 | get_filename_component(generated_data_name ${generated_data_file} NAME) |
| 122 | # Remove the ".data" extension |
| 123 | get_name_without_last_ext(generated_data_name ${generated_data_name}) |
| 124 | # Remove leading "test_suite_" |
| 125 | string(SUBSTRING ${generated_data_name} 11 -1 generated_data_name) |
| 126 | list(APPEND config_generated_data_names ${generated_data_name}) |
| 127 | endforeach() |
David Horstmann | ae7bd35 | 2021-10-19 19:05:42 +0100 | [diff] [blame] | 128 | |
Ronald Cron | f76cd22 | 2024-07-09 14:24:35 +0200 | [diff] [blame] | 129 | if(";${config_generated_data_names};" MATCHES ";${data_name};") |
Gilles Peskine | ef822c1 | 2024-05-28 19:07:24 +0200 | [diff] [blame] | 130 | set(data_file |
| 131 | ${CMAKE_CURRENT_BINARY_DIR}/suites/test_suite_${data_name}.data) |
Ronald Cron | 7f410db | 2024-07-09 14:20:34 +0200 | [diff] [blame] | 132 | set(dependency test_suite_config_generated_data) |
Manuel Pégourié-Gonnard | ce3ba8f | 2021-05-14 12:03:37 +0200 | [diff] [blame] | 133 | else() |
| 134 | set(data_file |
| 135 | ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${data_name}.data) |
Gilles Peskine | ef822c1 | 2024-05-28 19:07:24 +0200 | [diff] [blame] | 136 | set(dependency |
Ronald Cron | f76cd22 | 2024-07-09 14:24:35 +0200 | [diff] [blame] | 137 | test_suite_config_generated_data) |
Manuel Pégourié-Gonnard | ce3ba8f | 2021-05-14 12:03:37 +0200 | [diff] [blame] | 138 | endif() |
| 139 | |
Paul Bakker | 367dae4 | 2009-06-28 21:50:27 +0000 | [diff] [blame] | 140 | add_custom_command( |
Manuel Pégourié-Gonnard | 42681f3 | 2021-05-14 10:53:43 +0200 | [diff] [blame] | 141 | OUTPUT |
David Horstmann | f602eb1 | 2021-10-20 16:40:56 +0100 | [diff] [blame] | 142 | # The output filename of generate_test_code.py is derived from the -d |
| 143 | # input argument. |
Manuel Pégourié-Gonnard | 42681f3 | 2021-05-14 10:53:43 +0200 | [diff] [blame] | 144 | test_suite_${data_name}.c |
| 145 | COMMAND |
| 146 | ${MBEDTLS_PYTHON_EXECUTABLE} |
Ronald Cron | b6254f5 | 2024-07-25 14:52:19 +0200 | [diff] [blame] | 147 | ${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_test_code.py |
Manuel Pégourié-Gonnard | 42681f3 | 2021-05-14 10:53:43 +0200 | [diff] [blame] | 148 | -f ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${suite_name}.function |
Manuel Pégourié-Gonnard | ce3ba8f | 2021-05-14 12:03:37 +0200 | [diff] [blame] | 149 | -d ${data_file} |
Ronald Cron | f76cd22 | 2024-07-09 14:24:35 +0200 | [diff] [blame] | 150 | -t ${CMAKE_CURRENT_SOURCE_DIR}/../tf-psa-crypto/tests/suites/main_test.function |
| 151 | -p ${CMAKE_CURRENT_SOURCE_DIR}/../tf-psa-crypto/tests/suites/host_test.function |
Manuel Pégourié-Gonnard | 42681f3 | 2021-05-14 10:53:43 +0200 | [diff] [blame] | 152 | -s ${CMAKE_CURRENT_SOURCE_DIR}/suites |
Ronald Cron | f76cd22 | 2024-07-09 14:24:35 +0200 | [diff] [blame] | 153 | --helpers-file ${CMAKE_CURRENT_SOURCE_DIR}/../tf-psa-crypto/tests/suites/helpers.function |
Manuel Pégourié-Gonnard | 42681f3 | 2021-05-14 10:53:43 +0200 | [diff] [blame] | 154 | -o . |
| 155 | DEPENDS |
Ronald Cron | b6254f5 | 2024-07-25 14:52:19 +0200 | [diff] [blame] | 156 | ${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_test_code.py |
Manuel Pégourié-Gonnard | 42681f3 | 2021-05-14 10:53:43 +0200 | [diff] [blame] | 157 | ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${suite_name}.function |
Manuel Pégourié-Gonnard | ce3ba8f | 2021-05-14 12:03:37 +0200 | [diff] [blame] | 158 | ${data_file} |
Ronald Cron | f76cd22 | 2024-07-09 14:24:35 +0200 | [diff] [blame] | 159 | ${CMAKE_CURRENT_SOURCE_DIR}/../tf-psa-crypto/tests/suites/main_test.function |
| 160 | ${CMAKE_CURRENT_SOURCE_DIR}/../tf-psa-crypto/tests/suites/host_test.function |
| 161 | ${CMAKE_CURRENT_SOURCE_DIR}/../tf-psa-crypto/tests/suites/helpers.function |
Manuel Pégourié-Gonnard | 42681f3 | 2021-05-14 10:53:43 +0200 | [diff] [blame] | 162 | ${mbedtls_target} |
Manuel Pégourié-Gonnard | 389150d | 2021-09-09 10:51:16 +0200 | [diff] [blame] | 163 | BYPRODUCTS |
| 164 | test_suite_${data_name}.datax |
Paul Bakker | 4c14a25 | 2010-06-18 22:54:05 +0000 | [diff] [blame] | 165 | ) |
Paul Bakker | 1934318 | 2013-08-16 13:31:10 +0200 | [diff] [blame] | 166 | |
Yanray Wang | b458b8c | 2022-10-28 11:49:33 +0800 | [diff] [blame] | 167 | add_executable(test_suite_${data_name} test_suite_${data_name}.c |
Ronald Cron | 5096b4c | 2024-12-06 10:09:33 +0100 | [diff] [blame] | 168 | $<TARGET_OBJECTS:mbedtls_test> |
Yanray Wang | b458b8c | 2022-10-28 11:49:33 +0800 | [diff] [blame] | 169 | $<TARGET_OBJECTS:mbedtls_test_helpers>) |
Ronald Cron | b247898 | 2024-10-07 16:17:07 +0200 | [diff] [blame] | 170 | set_base_compile_options(test_suite_${data_name}) |
Ronald Cron | d093edd | 2024-10-10 11:57:10 +0200 | [diff] [blame] | 171 | target_compile_options(test_suite_${data_name} PRIVATE ${TEST_C_FLAGS}) |
Werner Lewis | 383461c | 2022-08-23 11:29:05 +0100 | [diff] [blame] | 172 | add_dependencies(test_suite_${data_name} ${dependency}) |
Paul Bakker | 7304376 | 2011-07-13 15:03:10 +0000 | [diff] [blame] | 173 | target_link_libraries(test_suite_${data_name} ${libs}) |
Gilles Peskine | 76dd3aa | 2020-07-02 15:58:37 +0200 | [diff] [blame] | 174 | # Include test-specific header files from ./include and private header |
| 175 | # files (used by some invasive tests) from ../library. Public header |
| 176 | # files are automatically included because the library targets declare |
| 177 | # them as PUBLIC. |
Ronald Cron | 8552741 | 2020-05-15 17:20:47 +0200 | [diff] [blame] | 178 | target_include_directories(test_suite_${data_name} |
Ronald Cron | 99226e9 | 2025-02-14 15:43:22 +0100 | [diff] [blame] | 179 | PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include |
Ronald Cron | 8552741 | 2020-05-15 17:20:47 +0200 | [diff] [blame] | 180 | PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include |
David Horstmann | 306f410 | 2024-11-04 14:16:30 +0000 | [diff] [blame] | 181 | PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../framework/tests/include |
Ronald Cron | c29afb6 | 2024-07-01 14:50:54 +0200 | [diff] [blame] | 182 | PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../library |
| 183 | PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../tf-psa-crypto/core |
| 184 | PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../tf-psa-crypto/drivers/builtin/src) |
David Horstmann | c2ab398 | 2024-01-17 12:25:19 +0000 | [diff] [blame] | 185 | # Request C11, which is needed for memory poisoning tests |
| 186 | set_target_properties(test_suite_${data_name} PROPERTIES C_STANDARD 11) |
Ronald Cron | 8552741 | 2020-05-15 17:20:47 +0200 | [diff] [blame] | 187 | |
Gilles Peskine | ac372cc | 2018-11-29 10:15:06 +0000 | [diff] [blame] | 188 | if(${data_name} MATCHES ${SKIP_TEST_SUITES_REGEX}) |
| 189 | message(STATUS "The test suite ${data_name} will not be executed.") |
| 190 | else() |
| 191 | add_test(${data_name}-suite test_suite_${data_name} --verbose) |
| 192 | endif() |
Paul Bakker | 367dae4 | 2009-06-28 21:50:27 +0000 | [diff] [blame] | 193 | endfunction(add_test_suite) |
| 194 | |
Manuel Pégourié-Gonnard | 42681f3 | 2021-05-14 10:53:43 +0200 | [diff] [blame] | 195 | # Enable definition of various functions used throughout the testsuite |
| 196 | # (gethostname, strdup, fileno...) even when compiling with -std=c99. Harmless |
| 197 | # on non-POSIX platforms. |
| 198 | add_definitions("-D_POSIX_C_SOURCE=200809L") |
| 199 | |
Gilles Peskine | f29019f | 2021-02-23 13:44:41 +0100 | [diff] [blame] | 200 | if(CMAKE_COMPILER_IS_CLANG) |
Ronald Cron | d093edd | 2024-10-10 11:57:10 +0200 | [diff] [blame] | 201 | set(TEST_C_FLAGS -Wdocumentation -Wno-documentation-deprecated-sync -Wunreachable-code) |
Gilles Peskine | f29019f | 2021-02-23 13:44:41 +0100 | [diff] [blame] | 202 | endif(CMAKE_COMPILER_IS_CLANG) |
| 203 | |
Manuel Pégourié-Gonnard | 3083053 | 2015-07-01 17:06:28 +0200 | [diff] [blame] | 204 | if(MSVC) |
Simon B | 9b3e3c4 | 2016-11-03 01:12:50 +0000 | [diff] [blame] | 205 | # If a warning level has been defined, suppress all warnings for test code |
Ronald Cron | d093edd | 2024-10-10 11:57:10 +0200 | [diff] [blame] | 206 | set(TEST_C_FLAGS /W0 /WX-) |
Manuel Pégourié-Gonnard | 3083053 | 2015-07-01 17:06:28 +0200 | [diff] [blame] | 207 | endif(MSVC) |
| 208 | |
Gilles Peskine | 29080e8 | 2022-01-25 22:30:25 +0100 | [diff] [blame] | 209 | file(GLOB test_suites RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" suites/*.data) |
Gilles Peskine | cca6ce8 | 2022-09-18 23:08:38 +0200 | [diff] [blame] | 210 | list(APPEND test_suites ${all_generated_data_files}) |
Gilles Peskine | 29080e8 | 2022-01-25 22:30:25 +0100 | [diff] [blame] | 211 | # If the generated .data files are present in the source tree, we just added |
Gilles Peskine | cca6ce8 | 2022-09-18 23:08:38 +0200 | [diff] [blame] | 212 | # them twice, both through GLOB and through ${all_generated_data_files}. |
Gilles Peskine | 29080e8 | 2022-01-25 22:30:25 +0100 | [diff] [blame] | 213 | list(REMOVE_DUPLICATES test_suites) |
| 214 | list(SORT test_suites) |
| 215 | foreach(test_suite ${test_suites}) |
Gilles Peskine | cd55fe0 | 2022-01-25 23:13:49 +0100 | [diff] [blame] | 216 | get_filename_component(data_name ${test_suite} NAME) |
Gilles Peskine | a18fb9d | 2022-01-25 23:24:34 +0100 | [diff] [blame] | 217 | string(REGEX REPLACE "\\.data\$" "" data_name "${data_name}") |
Gilles Peskine | cd55fe0 | 2022-01-25 23:13:49 +0100 | [diff] [blame] | 218 | string(REPLACE "test_suite_" "" data_name "${data_name}") |
| 219 | string(REGEX MATCH "[^.]*" function_name "${data_name}") |
Gilles Peskine | 29080e8 | 2022-01-25 22:30:25 +0100 | [diff] [blame] | 220 | add_test_suite(${function_name} ${data_name}) |
| 221 | endforeach(test_suite) |
Paul Bakker | cd6d69a | 2014-02-06 15:43:21 +0100 | [diff] [blame] | 222 | |
Gilles Peskine | 8405257 | 2018-03-21 12:12:47 +0100 | [diff] [blame] | 223 | # Make scripts and data files needed for testing available in an |
| 224 | # out-of-source build. |
Paul Bakker | cd6d69a | 2014-02-06 15:43:21 +0100 | [diff] [blame] | 225 | if (NOT ${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) |
Andrzej Kurek | 4a71cfa | 2019-05-06 05:06:06 -0400 | [diff] [blame] | 226 | if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/seedfile") |
| 227 | link_to_source(seedfile) |
| 228 | endif() |
Gilles Peskine | d7db883 | 2022-11-30 17:52:54 +0100 | [diff] [blame] | 229 | link_to_source(Descriptions.txt) |
Gilles Peskine | 8405257 | 2018-03-21 12:12:47 +0100 | [diff] [blame] | 230 | link_to_source(compat.sh) |
David Brown | c744418 | 2020-10-16 13:19:49 -0600 | [diff] [blame] | 231 | link_to_source(context-info.sh) |
David Horstmann | dcf18dd | 2024-06-11 17:44:00 +0100 | [diff] [blame] | 232 | link_to_source(../framework/data_files) |
Gilles Peskine | 8405257 | 2018-03-21 12:12:47 +0100 | [diff] [blame] | 233 | link_to_source(scripts) |
| 234 | link_to_source(ssl-opt.sh) |
Jerry Yu | 55ee769 | 2021-11-29 13:26:55 +0800 | [diff] [blame] | 235 | link_to_source(opt-testcases) |
Paul Bakker | cd6d69a | 2014-02-06 15:43:21 +0100 | [diff] [blame] | 236 | endif() |