From 939ce9d0d543530b84eef05405ee21ee89eb8246 Mon Sep 17 00:00:00 2001 From: Ronald Cron Date: Thu, 14 Nov 2024 11:15:40 +0100 Subject: [PATCH] Remove mbedtls_test Use tf_psa_crypto_test instead. Signed-off-by: Ronald Cron --- CMakeLists.txt | 49 ---------------------------------- programs/aes/CMakeLists.txt | 2 +- programs/cipher/CMakeLists.txt | 2 +- programs/fuzz/CMakeLists.txt | 2 +- programs/hash/CMakeLists.txt | 2 +- programs/pkey/CMakeLists.txt | 4 +-- programs/psa/CMakeLists.txt | 2 +- programs/random/CMakeLists.txt | 2 +- programs/ssl/CMakeLists.txt | 4 +-- programs/test/CMakeLists.txt | 2 +- programs/util/CMakeLists.txt | 2 +- programs/x509/CMakeLists.txt | 2 +- tests/CMakeLists.txt | 2 +- 13 files changed, 14 insertions(+), 63 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 15370c53c6..13f687e4e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -412,54 +412,6 @@ add_subdirectory(pkgconfig) # to define the test executables. # if(ENABLE_TESTING OR ENABLE_PROGRAMS) - file(GLOB MBEDTLS_TEST_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/tests/src/*.c - ${CMAKE_CURRENT_SOURCE_DIR}/tests/src/drivers/*.c) - add_library(mbedtls_test OBJECT ${MBEDTLS_TEST_FILES}) - set_base_compile_options(mbedtls_test) - if(GEN_FILES) - add_custom_command( - OUTPUT - ${CMAKE_CURRENT_SOURCE_DIR}/tests/src/test_keys.h - WORKING_DIRECTORY - ${CMAKE_CURRENT_SOURCE_DIR}/tests - COMMAND - "${MBEDTLS_PYTHON_EXECUTABLE}" - "${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_test_keys.py" - "--output" - "${CMAKE_CURRENT_SOURCE_DIR}/tests/src/test_keys.h" - DEPENDS - ${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_test_keys.py - ) - add_custom_target(test_keys_header DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tests/src/test_keys.h) - add_custom_command( - OUTPUT - ${CMAKE_CURRENT_SOURCE_DIR}/tests/src/test_certs.h - WORKING_DIRECTORY - ${CMAKE_CURRENT_SOURCE_DIR}/tests - COMMAND - "${MBEDTLS_PYTHON_EXECUTABLE}" - "${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_test_cert_macros.py" - "--output" - "${CMAKE_CURRENT_SOURCE_DIR}/tests/src/test_certs.h" - DEPENDS - ${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_test_cert_macros.py - ) - add_custom_target(test_certs_header DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tests/src/test_certs.h) - add_dependencies(mbedtls_test test_keys_header test_certs_header) - endif() - target_include_directories(mbedtls_test - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tests/include - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tf-psa-crypto/include - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tf-psa-crypto/drivers/builtin/include - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tf-psa-crypto/drivers/everest/include - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/library - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tf-psa-crypto/core - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tf-psa-crypto/drivers/builtin/src) - # Request C11, needed for memory poisoning tests - set_target_properties(mbedtls_test PROPERTIES C_STANDARD 11) - file(GLOB MBEDTLS_TEST_HELPER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tests/src/test_helpers/*.c) add_library(mbedtls_test_helpers OBJECT ${MBEDTLS_TEST_HELPER_FILES}) @@ -474,7 +426,6 @@ if(ENABLE_TESTING OR ENABLE_PROGRAMS) PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tf-psa-crypto/drivers/builtin/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tf-psa-crypto/drivers/everest/include) - set_config_files_compile_definitions(mbedtls_test) set_config_files_compile_definitions(mbedtls_test_helpers) endif() diff --git a/programs/aes/CMakeLists.txt b/programs/aes/CMakeLists.txt index 728b4d0b6a..ca1b30f940 100644 --- a/programs/aes/CMakeLists.txt +++ b/programs/aes/CMakeLists.txt @@ -4,7 +4,7 @@ set(executables add_dependencies(${programs_target} ${executables}) foreach(exe IN LISTS executables) - add_executable(${exe} ${exe}.c $) + add_executable(${exe} ${exe}.c $) set_base_compile_options(${exe}) target_link_libraries(${exe} ${tfpsacrypto_target} ${CMAKE_THREAD_LIBS_INIT}) target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) diff --git a/programs/cipher/CMakeLists.txt b/programs/cipher/CMakeLists.txt index ff8c76dda8..bd659b470b 100644 --- a/programs/cipher/CMakeLists.txt +++ b/programs/cipher/CMakeLists.txt @@ -4,7 +4,7 @@ set(executables add_dependencies(${programs_target} ${executables}) foreach(exe IN LISTS executables) - add_executable(${exe} ${exe}.c $) + add_executable(${exe} ${exe}.c $) set_base_compile_options(${exe}) target_link_libraries(${exe} ${tfpsacrypto_target} ${CMAKE_THREAD_LIBS_INIT}) target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) diff --git a/programs/fuzz/CMakeLists.txt b/programs/fuzz/CMakeLists.txt index 44fff9a348..722698a6c4 100644 --- a/programs/fuzz/CMakeLists.txt +++ b/programs/fuzz/CMakeLists.txt @@ -28,7 +28,7 @@ add_dependencies(${programs_target} ${executables_with_common_c}) foreach(exe IN LISTS executables_no_common_c executables_with_common_c) - set(exe_sources ${exe}.c $) + set(exe_sources ${exe}.c $) if(NOT FUZZINGENGINE_LIB) list(APPEND exe_sources onefile.c) endif() diff --git a/programs/hash/CMakeLists.txt b/programs/hash/CMakeLists.txt index 498efc9585..419d484fd3 100644 --- a/programs/hash/CMakeLists.txt +++ b/programs/hash/CMakeLists.txt @@ -6,7 +6,7 @@ set(executables add_dependencies(${programs_target} ${executables}) foreach(exe IN LISTS executables) - add_executable(${exe} ${exe}.c $) + add_executable(${exe} ${exe}.c $) set_base_compile_options(${exe}) target_link_libraries(${exe} ${tfpsacrypto_target} ${CMAKE_THREAD_LIBS_INIT}) target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) diff --git a/programs/pkey/CMakeLists.txt b/programs/pkey/CMakeLists.txt index 63d2c5d69c..136baa34c1 100644 --- a/programs/pkey/CMakeLists.txt +++ b/programs/pkey/CMakeLists.txt @@ -5,7 +5,7 @@ set(executables_mbedtls add_dependencies(${programs_target} ${executables_mbedtls}) foreach(exe IN LISTS executables_mbedtls) - add_executable(${exe} ${exe}.c $) + add_executable(${exe} ${exe}.c $) set_base_compile_options(${exe}) target_link_libraries(${exe} ${mbedtls_target} ${CMAKE_THREAD_LIBS_INIT}) target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) @@ -34,7 +34,7 @@ set(executables_mbedcrypto add_dependencies(${programs_target} ${executables_mbedcrypto}) foreach(exe IN LISTS executables_mbedcrypto) - add_executable(${exe} ${exe}.c $) + add_executable(${exe} ${exe}.c $) set_base_compile_options(${exe}) target_link_libraries(${exe} ${tfpsacrypto_target} ${CMAKE_THREAD_LIBS_INIT}) target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) diff --git a/programs/psa/CMakeLists.txt b/programs/psa/CMakeLists.txt index b6e2b0d010..6cff1cfbf8 100644 --- a/programs/psa/CMakeLists.txt +++ b/programs/psa/CMakeLists.txt @@ -28,7 +28,7 @@ else() endif() foreach(exe IN LISTS executables) - add_executable(${exe} ${exe}.c $) + add_executable(${exe} ${exe}.c $) set_base_compile_options(${exe}) target_link_libraries(${exe} ${tfpsacrypto_target} ${CMAKE_THREAD_LIBS_INIT}) target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) diff --git a/programs/random/CMakeLists.txt b/programs/random/CMakeLists.txt index 2c3e4d5b83..37e404e215 100644 --- a/programs/random/CMakeLists.txt +++ b/programs/random/CMakeLists.txt @@ -5,7 +5,7 @@ set(executables add_dependencies(${programs_target} ${executables}) foreach(exe IN LISTS executables) - add_executable(${exe} ${exe}.c $) + add_executable(${exe} ${exe}.c $) set_base_compile_options(${exe}) target_link_libraries(${exe} ${tfpsacrypto_target} ${CMAKE_THREAD_LIBS_INIT}) target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) diff --git a/programs/ssl/CMakeLists.txt b/programs/ssl/CMakeLists.txt index 6919a8e04e..ed26c6a081 100644 --- a/programs/ssl/CMakeLists.txt +++ b/programs/ssl/CMakeLists.txt @@ -38,7 +38,7 @@ foreach(exe IN LISTS executables) ${CMAKE_CURRENT_SOURCE_DIR}/../test/query_config.h ${CMAKE_CURRENT_BINARY_DIR}/../test/query_config.c) endif() - add_executable(${exe} ${exe}.c $ + add_executable(${exe} ${exe}.c $ ${extra_sources}) set_base_compile_options(${exe}) target_link_libraries(${exe} ${libs} ${CMAKE_THREAD_LIBS_INIT}) @@ -53,7 +53,7 @@ foreach(exe IN LISTS executables) endforeach() if(THREADS_FOUND) - add_executable(ssl_pthread_server ssl_pthread_server.c $) + add_executable(ssl_pthread_server ssl_pthread_server.c $) set_base_compile_options(ssl_pthread_server) target_include_directories(ssl_pthread_server PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) target_link_libraries(ssl_pthread_server ${libs} ${CMAKE_THREAD_LIBS_INIT}) diff --git a/programs/test/CMakeLists.txt b/programs/test/CMakeLists.txt index 5719147951..6a90c48346 100644 --- a/programs/test/CMakeLists.txt +++ b/programs/test/CMakeLists.txt @@ -82,7 +82,7 @@ foreach(exe IN LISTS executables_libs executables_mbedcrypto) ${CMAKE_CURRENT_SOURCE_DIR}/query_config.h ${CMAKE_CURRENT_BINARY_DIR}/query_config.c) endif() - add_executable(${exe} ${exe}.c $ + add_executable(${exe} ${exe}.c $ ${extra_sources}) set_base_compile_options(${exe}) target_include_directories(${exe} diff --git a/programs/util/CMakeLists.txt b/programs/util/CMakeLists.txt index a53540283f..befc1339f9 100644 --- a/programs/util/CMakeLists.txt +++ b/programs/util/CMakeLists.txt @@ -10,7 +10,7 @@ set(executables add_dependencies(${programs_target} ${executables}) foreach(exe IN LISTS executables) - add_executable(${exe} ${exe}.c $) + add_executable(${exe} ${exe}.c $) set_base_compile_options(${exe}) target_link_libraries(${exe} ${libs} ${CMAKE_THREAD_LIBS_INIT}) target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) diff --git a/programs/x509/CMakeLists.txt b/programs/x509/CMakeLists.txt index a31bada7fd..837d97a094 100644 --- a/programs/x509/CMakeLists.txt +++ b/programs/x509/CMakeLists.txt @@ -13,7 +13,7 @@ set(executables add_dependencies(${programs_target} ${executables}) foreach(exe IN LISTS executables) - add_executable(${exe} ${exe}.c $) + add_executable(${exe} ${exe}.c $) set_base_compile_options(${exe}) target_link_libraries(${exe} ${libs} ${CMAKE_THREAD_LIBS_INIT}) target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8318e8bf3b..2deae8f531 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -154,7 +154,7 @@ function(add_test_suite suite_name) ) add_executable(test_suite_${data_name} test_suite_${data_name}.c - $ + $ $) set_base_compile_options(test_suite_${data_name}) target_compile_options(test_suite_${data_name} PRIVATE ${TEST_C_FLAGS})