From 4c9361bb31106b5665b6978963efa4c9a8c2fbb4 Mon Sep 17 00:00:00 2001 From: Harry Ramsey Date: Wed, 4 Dec 2024 13:30:02 +0000 Subject: [PATCH] Fix out of source directory checks This commit fixes out of source directory builds, where in_tf_psa_crypto_repo would fail due to project_name.txt not existing. Signed-off-by: Harry Ramsey --- scripts/all-core.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/scripts/all-core.sh b/scripts/all-core.sh index ab85fb813..f474ad103 100644 --- a/scripts/all-core.sh +++ b/scripts/all-core.sh @@ -404,6 +404,11 @@ cleanup() rm -f programs/test/cmake_package_install/Makefile rm -f programs/test/cmake_package_install/cmake_package_install + # Remove out of source directory + if in_tf_psa_crypto_repo; then + rm -rf "$OUT_OF_SOURCE_DIR" + fi + # Restore files that may have been clobbered by the job restore_backed_up_files } @@ -941,7 +946,11 @@ run_component () { "${dd_cmd[@]}" fi + # Since building TF-PSA-Crypto is out of source, we cannot identify if we + # are in TF-PSA-Crypto repository. We set running_tf_psa_crypto_test. + running_tf_psa_crypto_test=0 if in_tf_psa_crypto_repo; then + running_tf_psa_crypto_test=1 pre_create_tf_psa_crypto_out_of_source_directory fi @@ -978,11 +987,12 @@ run_component () { fi fi - # Restore the build tree to a clean state. - if in_tf_psa_crypto_repo; then - cleanup_tf_psa_crypto_out_of_source_directory + # Reset working directory to TF_PSA_Crypto as it is build out of source.. + if [ $running_tf_psa_crypto_test -eq 1 ]; then + cd "$TF_PSA_CRYPTO_ROOT_DIR" fi + # Restore the build tree to a clean state. cleanup unset current_component } @@ -992,10 +1002,6 @@ pre_create_tf_psa_crypto_out_of_source_directory () { mkdir "$OUT_OF_SOURCE_DIR" cd "$OUT_OF_SOURCE_DIR" } -cleanup_tf_psa_crypto_out_of_source_directory () { - cd "$TF_PSA_CRYPTO_ROOT_DIR" - rm -rf "$OUT_OF_SOURCE_DIR" -} ################################################################ #### Main