Add cleanup function to cryptest-cmake.sh
parent
598e371b8a
commit
9a75d09ca4
|
|
@ -1,5 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
PWD_DIR=$(pwd)
|
||||||
|
function cleanup {
|
||||||
|
cd "$PWD_DIR"
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
# Feth the three required files
|
# Feth the three required files
|
||||||
if ! wget --no-check-certificate https://raw.githubusercontent.com/noloader/cryptopp-cmake/master/CMakeLists.txt -O CMakeLists.txt; then
|
if ! wget --no-check-certificate https://raw.githubusercontent.com/noloader/cryptopp-cmake/master/CMakeLists.txt -O CMakeLists.txt; then
|
||||||
echo "CMakeLists.txt download failed"
|
echo "CMakeLists.txt download failed"
|
||||||
|
|
@ -22,30 +28,24 @@ cd "$PWD_DIR/build"
|
||||||
|
|
||||||
if ! cmake ../; then
|
if ! cmake ../; then
|
||||||
echo "autoreconf failed"
|
echo "autoreconf failed"
|
||||||
cd "$PWD_DIR"
|
|
||||||
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
|
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! make -j2 -f Makefile VERBOSE=1; then
|
if ! make -j2 -f Makefile VERBOSE=1; then
|
||||||
echo "make failed"
|
echo "make failed"
|
||||||
cd "$PWD_DIR"
|
|
||||||
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
|
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! ./cryptest.exe v; then
|
if ! ./cryptest.exe v; then
|
||||||
echo "cryptest.exe v failed"
|
echo "cryptest.exe v failed"
|
||||||
cd "$PWD_DIR"
|
|
||||||
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
|
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! ./cryptest.exe tv all; then
|
if ! ./cryptest.exe tv all; then
|
||||||
echo "cryptest.exe v failed"
|
echo "cryptest.exe v failed"
|
||||||
cd "$PWD_DIR"
|
|
||||||
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
|
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$PWD_DIR"
|
|
||||||
|
|
||||||
# Return success
|
# Return success
|
||||||
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0
|
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue