Introduce "Dev mode" option
When the option is On, CMake will have rules to generate the generated
files using scripts etc. When the option is Off, CMake will assume the
files are available from the source tree; in that mode, it won't require
any extra tools (Perl for example) compared to when we committed the
files to git.
The intention is that users will never need to adjust this option:
- in the development branch (and features branches etc.) the option is
always On (development mode);
- in released tarballs, which include the generated files, we'll switch
the option to Off (release mode) in the same commit that re-adds the
generated files.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 48716ae..454fe5a 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -16,23 +16,29 @@
# generated .data files will go there
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/suites)
-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
-)
+if(DEV_MODE)
+ 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
+ )
+else()
+ link_to_source(suites/test_suite_psa_crypto_not_supported.generated.data)
+ link_to_source(suites/test_suite_psa_crypto_storage_format.current.data)
+ link_to_source(suites/test_suite_psa_crypto_storage_format.v0.data)
+endif()
# 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"