Allow CMake to run generate_psa_tests
Note: the test suites are actually generated in the source tree, due to
the use of
link_to_source(suites)
This will be fixed in the next commit.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 574b346..cddedb4 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -13,6 +13,24 @@
message(FATAL_ERROR "Cannot build test suites without Python 3")
endif()
+add_custom_command(
+ OUTPUT
+ ${CMAKE_CURRENT_BINARY_DIR}/suites/test_suite_psa_crypto_not_supported.generated.data
+ ${CMAKE_CURRENT_BINARY_DIR}/suites/test_suite_psa_crypto_storage_format.current.data
+ ${CMAKE_CURRENT_BINARY_DIR}/suites/test_suite_psa_crypto_storage_format.v0.data
+ WORKING_DIRECTORY
+ ${CMAKE_CURRENT_SOURCE_DIR}/..
+ COMMAND
+ ${MBEDTLS_PYTHON_EXECUTABLE}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../tests/scripts/generate_psa_tests.py
+ --directory ${CMAKE_CURRENT_BINARY_DIR}/suites
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/../tests/scripts/generate_psa_tests.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/../include/psa/crypto_config.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../include/psa/crypto_values.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../include/psa/crypto_extra.h
+)
+
# Test suites caught by SKIP_TEST_SUITES are built but not executed.
# "foo" as a skip pattern skips "test_suite_foo" and "test_suite_foo.bar"
# but not "test_suite_foobar".
@@ -27,6 +45,16 @@
set(data_name ${suite_name})
endif()
+ if(data_name STREQUAL "psa_crypto_not_supported.generated" OR
+ data_name STREQUAL "psa_crypto_storage_format.current" OR
+ data_name STREQUAL "psa_crypto_storage_format.v0")
+ set(data_file
+ ${CMAKE_CURRENT_BINARY_DIR}/suites/test_suite_${data_name}.data)
+ else()
+ set(data_file
+ ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${data_name}.data)
+ endif()
+
add_custom_command(
OUTPUT
test_suite_${data_name}.c
@@ -34,7 +62,7 @@
${MBEDTLS_PYTHON_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_test_code.py
-f ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${suite_name}.function
- -d ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${data_name}.data
+ -d ${data_file}
-t ${CMAKE_CURRENT_SOURCE_DIR}/suites/main_test.function
-p ${CMAKE_CURRENT_SOURCE_DIR}/suites/host_test.function
-s ${CMAKE_CURRENT_SOURCE_DIR}/suites
@@ -43,7 +71,7 @@
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_test_code.py
${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${suite_name}.function
- ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${data_name}.data
+ ${data_file}
${CMAKE_CURRENT_SOURCE_DIR}/suites/main_test.function
${CMAKE_CURRENT_SOURCE_DIR}/suites/host_test.function
${CMAKE_CURRENT_SOURCE_DIR}/suites/helpers.function