Skip to content

Commit 1e09da0

Browse files
committed
Enable independent check-generated-files.sh for tf-psa-crypto
This commit enables independent testing for tf-psa-crypto in check-generated-files.sh. Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
1 parent 2ce86b0 commit 1e09da0

File tree

1 file changed

+31
-26
lines changed

1 file changed

+31
-26
lines changed

tests/scripts/check-generated-files.sh

+31-26
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ if in_mbedtls_repo; then
3232
crypto_core_dir='library'
3333
builtin_drivers_dir='library'
3434
fi
35+
MBEDTLS_FRAMEWORK_DIR="$PWD/framework"
3536
elif in_tf_psa_crypto_repo; then
3637
crypto_core_dir='core'
3738
builtin_drivers_dir='drivers/builtin/src/'
39+
MBEDTLS_FRAMEWORK_DIR="$PWD/../framework"
3840
else
3941
echo "Must be run from Mbed TLS root or TF-PSA-Crypto root" >&2
4042
exit 1
@@ -138,34 +140,36 @@ check()
138140

139141
# The first case is temporary for the hybrid situation with a tf-psa-crypto
140142
# directory in Mbed TLS that is not just a TF-PSA-Crypto submodule.
141-
if [ -d tf-psa-crypto ]; then
142-
cd tf-psa-crypto
143+
check_tf_psa_crypto()
144+
{
143145
check scripts/generate_psa_constants.py ./programs/psa/psa_constant_names_generated.c
144-
check ../framework/scripts/generate_bignum_tests.py $(../framework/scripts/generate_bignum_tests.py --list)
145-
check ../framework/scripts/generate_config_tests.py tests/suites/test_suite_config.psa_boolean.data
146-
check ../framework/scripts/generate_ecp_tests.py $(../framework/scripts/generate_ecp_tests.py --list)
147-
check ../framework/scripts/generate_psa_tests.py $(../framework/scripts/generate_psa_tests.py --list)
148-
cd ..
149-
check tf-psa-crypto/scripts/generate_driver_wrappers.py ${crypto_core_dir}/psa_crypto_driver_wrappers.h \
150-
${crypto_core_dir}/psa_crypto_driver_wrappers_no_static.c
151-
check framework/scripts/generate_config_tests.py tests/suites/test_suite_config.mbedtls_boolean.data
152-
else
146+
check ${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_bignum_tests.py $(${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_bignum_tests.py --list)
147+
check ${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_config_tests.py tests/suites/test_suite_config.psa_boolean.data
148+
check ${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_ecp_tests.py $(${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_ecp_tests.py --list)
149+
check ${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_psa_tests.py $(${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_psa_tests.py --list)
150+
check scripts/generate_driver_wrappers.py ${crypto_core_dir}/psa_crypto_driver_wrappers.h \
151+
${crypto_core_dir}/psa_crypto_driver_wrappers_no_static.c
152+
check ${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_config_tests.py tests/suites/test_suite_config.mbedtls_boolean.data
153+
# Generated files that are present in the repository even in the development
154+
# branch. (This is intended to be temporary, until the generator scripts are
155+
# fully reviewed and the build scripts support a generated header file.)
156+
check ${MBEDTLS_FRAMEWORK_DIR}/scripts/generate_psa_wrappers.py tests/include/test/psa_test_wrappers.h tests/src/psa_test_wrappers.c
157+
}
158+
159+
check_mbedtls()
160+
{
161+
# TF-PSA-Crypto does not exist run additional checks.
162+
if [ ! -d tf-psa-crypto ]; then
153163
check framework/scripts/generate_bignum_tests.py $(framework/scripts/generate_bignum_tests.py --list)
154-
if in_tf_psa_crypto_repo; then
155-
check framework/scripts/generate_config_tests.py tests/suites/test_suite_config.psa_boolean.data
156-
else
157-
check framework/scripts/generate_config_tests.py tests/suites/test_suite_config.mbedtls_boolean.data
158-
fi
164+
check framework/scripts/generate_config_tests.py tests/suites/test_suite_config.mbedtls_boolean.data
159165
check framework/scripts/generate_ecp_tests.py $(framework/scripts/generate_ecp_tests.py --list)
160166
check framework/scripts/generate_psa_tests.py $(framework/scripts/generate_psa_tests.py --list)
161167
check scripts/generate_driver_wrappers.py ${crypto_core_dir}/psa_crypto_driver_wrappers.h \
162168
${crypto_core_dir}/psa_crypto_driver_wrappers_no_static.c
163-
fi
164-
165-
check framework/scripts/generate_test_keys.py framework/tests/src/test_keys.h
169+
fi
166170

167-
# Additional checks for Mbed TLS only
168-
if in_mbedtls_repo; then
171+
check framework/scripts/generate_test_keys.py framework/tests/src/test_keys.h
172+
# Additional checks for Mbed TLS only
169173
check scripts/generate_errors.pl library/error.c
170174
check scripts/generate_query_config.pl programs/test/query_config.c
171175
check scripts/generate_features.pl library/version_features.c
@@ -176,9 +180,10 @@ if in_mbedtls_repo; then
176180
# care about their content, but the files must exist. So it must run after
177181
# the step that creates or updates these files.
178182
check scripts/generate_visualc_files.pl visualc/VS2017
179-
fi
183+
}
180184

181-
# Generated files that are present in the repository even in the development
182-
# branch. (This is intended to be temporary, until the generator scripts are
183-
# fully reviewed and the build scripts support a generated header file.)
184-
check framework/scripts/generate_psa_wrappers.py tf-psa-crypto/tests/include/test/psa_test_wrappers.h tf-psa-crypto/tests/src/psa_test_wrappers.c
185+
if in_mbedtls_repo; then;
186+
check_mbedtls
187+
else
188+
check_tf_psa_crypto
189+
fi

0 commit comments

Comments
 (0)