Revert "Remove mbedtls_test"

This reverts commit 939ce9d0d5.

Build mbedtls_test library of objects to link
with TLS and x509 test suites and programs
with mbedtls framework not TF-PSA-Crypto
one (when it will be there).

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron
2024-12-06 10:09:33 +01:00
parent f6eee5ad55
commit 5096b4cb4b
12 changed files with 49 additions and 14 deletions

View File

@@ -412,6 +412,41 @@ add_subdirectory(pkgconfig)
# to define the test executables.
#
if(ENABLE_TESTING OR ENABLE_PROGRAMS)
file(GLOB MBEDTLS_TEST_FILES
${MBEDTLS_FRAMEWORK_DIR}/tests/src/*.c
${MBEDTLS_FRAMEWORK_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
${MBEDTLS_FRAMEWORK_DIR}/tests/src/test_keys.h
COMMAND
"${MBEDTLS_PYTHON_EXECUTABLE}"
"${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_test_keys.py"
"--output"
"${MBEDTLS_FRAMEWORK_DIR}/tests/src/test_keys.h"
DEPENDS
${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_test_keys.py
)
add_custom_target(mbedtls_test_keys_header
DEPENDS ${MBEDTLS_FRAMEWORK_DIR}/tests/src/test_keys.h)
add_dependencies(mbedtls_test mbedtls_test_keys_header)
endif()
target_include_directories(mbedtls_test
PRIVATE ${MBEDTLS_FRAMEWORK_DIR}/tests/include
PRIVATE tests/include
PRIVATE include
PRIVATE tf-psa-crypto/include
PRIVATE tf-psa-crypto/drivers/builtin/include
PRIVATE tf-psa-crypto/drivers/everest/include
PRIVATE library
PRIVATE tf-psa-crypto/core
PRIVATE tf-psa-crypto/drivers/builtin/src)
# Request C11, needed for memory poisoning tests
set_target_properties(mbedtls_test PROPERTIES C_STANDARD 11)
set_config_files_compile_definitions(mbedtls_test)
file(GLOB MBEDTLS_TEST_HELPER_FILES
tests/src/*.c tests/src/test_helpers/*.c)
add_library(mbedtls_test_helpers OBJECT ${MBEDTLS_TEST_HELPER_FILES})