From 73e2b056ca25fa21a91e13a032004b14c497775c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Tue, 1 Oct 2024 12:54:37 +0200 Subject: [PATCH] all.sh: extract repeated code to a function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Manuel Pégourié-Gonnard --- tests/scripts/all.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index 2890064b70..0eedc88c3c 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -376,6 +376,11 @@ cleanup() rm -f programs/test/cmake_package_install/cmake_package_install # Restore files that may have been clobbered by the job + restore_backed_up_files +} + +# Restore files that may have been clobbered +restore_backed_up_files () { for x in $files_to_back_up; do if [[ -e "$x$backup_suffix" ]]; then cp -p "$x$backup_suffix" "$x" @@ -1016,11 +1021,7 @@ helper_psasim_cleanup_before_client() { # Restore files that were backup before building library files. This # includes $CONFIG_H and $CRYPTO_CONFIG_H. - for x in $files_to_back_up; do - if [[ -e "$x$backup_suffix" ]]; then - cp -p "$x$backup_suffix" "$x" - fi - done + restore_backed_up_files } # Helper to build the libraries for client/server in PSASIM. If the server is