From 423dd13357b38a8cd2947fd52cf3918cc550f951 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Tue, 30 Aug 2022 21:02:00 +0200 Subject: [PATCH 1/2] Don't try restoring a file if no backup is available This caused `all.sh --force` to fail on a clean build tree. Signed-off-by: Gilles Peskine --- tests/scripts/all.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index 4705fe88a375..f38657d6ce43 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -303,7 +303,9 @@ cleanup() # Restore files that may have been clobbered by the job for x in $files_to_back_up; do - cp -p "$x$backup_suffix" "$x" + if [[ -e "$x$backup_suffix" ]]; then + cp -p "$x$backup_suffix" "$x" + fi done } From 7959858f4c9ae1700684c5a7eb99c0bc55aea62e Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Tue, 30 Aug 2022 21:02:44 +0200 Subject: [PATCH 2/2] Don't remove programs/fuzz/Makefile Other programs/*/Makefile are only created by CMake, but programs/fuzz has its own Makefile in the repository. Fixes #6247. Signed-off-by: Gilles Peskine --- tests/scripts/all.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index f38657d6ce43..c0e0d30203b0 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -120,6 +120,9 @@ # Treat uninitialised variables as errors. set -e -o pipefail -u +# Enable ksh/bash extended file matching patterns +shopt -s extglob + pre_check_environment () { if [ -d library -a -d include -a -d tests ]; then :; else echo "Must be run from mbed TLS root" >&2 @@ -294,7 +297,7 @@ cleanup() -iname CTestTestfile.cmake -o \ -iname CMakeCache.txt \) -exec rm {} \+ # Recover files overwritten by in-tree CMake builds - rm -f include/Makefile include/mbedtls/Makefile programs/*/Makefile + rm -f include/Makefile include/mbedtls/Makefile programs/!(fuzz)/Makefile # Remove any artifacts from the component_test_cmake_as_subdirectory test. rm -rf programs/test/cmake_subproject/build