From e58128e2ba4597747e9d7811bc8b516fb8d271f7 Mon Sep 17 00:00:00 2001 From: Thomas Daubney Date: Tue, 14 Nov 2023 15:25:52 +0000 Subject: [PATCH] Refactor repository detection Signed-off-by: Thomas Daubney --- tests/scripts/check-generated-files.sh | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/tests/scripts/check-generated-files.sh b/tests/scripts/check-generated-files.sh index 6f92ecd311..92531a8d03 100755 --- a/tests/scripts/check-generated-files.sh +++ b/tests/scripts/check-generated-files.sh @@ -22,25 +22,22 @@ EOF exit fi -# Detect whether we are in one of Mbed TLS or TF-PSA-Crypto and exit if not -if [ -d library -a -d include -a -d tests ]; then :; -elif [ -d core -a -d include -a -d tests ]; then :; +in_mbedtls_repo () { + test -d include -a -d library -a -d programs -a -d tests +} + +in_tf_psa_crypto_repo () { + test -d include -a -d core -a -d drivers -a -d programs -a -d tests +} +if in_mbedtls_repo; then + library_dir='library' +elif in_tf_psa_crypto_repo; then + library_dir='core' else echo "Must be run from Mbed TLS root or TF-PSA-Crypto root" >&2 exit 1 fi -# Now we know we are in one of Mbed TLS or TF-PSA-Crypto, determine which one -in_mbedtls_build_dir () { - test -d library -} - -if in_mbedtls_build_dir; then - library_dir='library' -else - library_dir='core' -fi - UPDATE= LIST= while getopts lu OPTLET; do