From c9f8386a7c09ef302bddecf5f3f95b313c1bb725 Mon Sep 17 00:00:00 2001 From: Thomas Daubney Date: Mon, 13 Nov 2023 10:03:56 +0000 Subject: [PATCH] Modify check-generated-files.sh to work in both repos Make the script work in both Mbed TLS and TF PSA Crypto. Signed-off-by: Thomas Daubney --- tests/scripts/check-generated-files.sh | 31 +++++++++++++++++--------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/tests/scripts/check-generated-files.sh b/tests/scripts/check-generated-files.sh index 67dedeb265..0689147f0e 100755 --- a/tests/scripts/check-generated-files.sh +++ b/tests/scripts/check-generated-files.sh @@ -22,8 +22,12 @@ EOF exit fi -if [ -d library -a -d include -a -d tests ]; then :; else - echo "Must be run from Mbed TLS root" >&2 +IN_MBEDTLS=0 +if [ -d library -a -d include -a -d tests ]; then + IN_MBEDTLS=1 +elif [ -d core -a -d include -a -d tests ]; then :; +else + echo "Must be run from Mbed TLS root or TF-PSA-Crypto root" >&2 exit 1 fi @@ -114,16 +118,21 @@ check() # - **/CMakeLists.txt (to (re)build them with cmake) # - scripts/make_generated_files.bat (to generate them under Windows) -check scripts/generate_errors.pl library/error.c -check scripts/generate_query_config.pl programs/test/query_config.c -check scripts/generate_driver_wrappers.py library/psa_crypto_driver_wrappers.h library/psa_crypto_driver_wrappers_no_static.c -check scripts/generate_features.pl library/version_features.c -check scripts/generate_ssl_debug_helpers.py library/ssl_debug_helpers_generated.c -# generate_visualc_files enumerates source files (library/*.c). It doesn't -# care about their content, but the files must exist. So it must run after -# the step that creates or updates these files. -check scripts/generate_visualc_files.pl visualc/VS2013 +# These checks are common to Mbed TLS and TF PSA Crypto check scripts/generate_psa_constants.py programs/psa/psa_constant_names_generated.c check tests/scripts/generate_bignum_tests.py $(tests/scripts/generate_bignum_tests.py --list) check tests/scripts/generate_ecp_tests.py $(tests/scripts/generate_ecp_tests.py --list) check tests/scripts/generate_psa_tests.py $(tests/scripts/generate_psa_tests.py --list) + +# Additional checks for Mbed TLS only +if [ $IN_MBEDTLS -eq 1 ]; then + check scripts/generate_errors.pl library/error.c + check scripts/generate_query_config.pl programs/test/query_config.c + check scripts/generate_driver_wrappers.py library/psa_crypto_driver_wrappers.h library/psa_crypto_driver_wrappers_no_static.c + check scripts/generate_features.pl library/version_features.c + check scripts/generate_ssl_debug_helpers.py library/ssl_debug_helpers_generated.c + # generate_visualc_files enumerates source files (library/*.c). It doesn't + # care about their content, but the files must exist. So it must run after + # the step that creates or updates these files. + check scripts/generate_visualc_files.pl visualc/VS2013 +fi