From 9a75d09ca48becc2e0dc675b34b0c16bfb5da7c1 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 29 Jun 2018 19:43:31 -0400 Subject: [PATCH] Add cleanup function to cryptest-cmake.sh --- TestScripts/cryptest-cmake.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/TestScripts/cryptest-cmake.sh b/TestScripts/cryptest-cmake.sh index f9f7d503..99f20767 100755 --- a/TestScripts/cryptest-cmake.sh +++ b/TestScripts/cryptest-cmake.sh @@ -1,5 +1,11 @@ #!/usr/bin/env bash +PWD_DIR=$(pwd) +function cleanup { + cd "$PWD_DIR" +} +trap cleanup EXIT + # Feth the three required files if ! wget --no-check-certificate https://raw.githubusercontent.com/noloader/cryptopp-cmake/master/CMakeLists.txt -O CMakeLists.txt; then echo "CMakeLists.txt download failed" @@ -22,30 +28,24 @@ cd "$PWD_DIR/build" if ! cmake ../; then echo "autoreconf failed" - cd "$PWD_DIR" [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 fi if ! make -j2 -f Makefile VERBOSE=1; then echo "make failed" - cd "$PWD_DIR" [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 fi if ! ./cryptest.exe v; then echo "cryptest.exe v failed" - cd "$PWD_DIR" [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 fi if ! ./cryptest.exe tv all; then echo "cryptest.exe v failed" - cd "$PWD_DIR" [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 fi -cd "$PWD_DIR" - # Return success [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0