diff options
author | Jakob Unterwurzacher | 2018-03-13 22:16:15 +0100 |
---|---|---|
committer | Jakob Unterwurzacher | 2018-03-13 22:16:15 +0100 |
commit | e46f6b940f3159e63f9cc4b4866d4b20085f34cc (patch) | |
tree | 2a7d37ecef06556d7c67708b638ea1e536b32b76 /tests/stress_tests | |
parent | 8373410678eaadbfe7079065f80fc9ea16e4a4b3 (diff) |
tests: extractloop.sh: don't abort if md5sum is missing
MacOS does not have it installed by default.
Diffstat (limited to 'tests/stress_tests')
-rwxr-xr-x | tests/stress_tests/extractloop.bash | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/stress_tests/extractloop.bash b/tests/stress_tests/extractloop.bash index 970eafd..d92b347 100755 --- a/tests/stress_tests/extractloop.bash +++ b/tests/stress_tests/extractloop.bash @@ -26,6 +26,16 @@ CSV=$CRYPT.csv MNT=$CRYPT.mnt mkdir $MNT +function check_md5sums { + if command -v md5sum > /dev/null ; then + md5sum --status -c $1 + else + # MacOS / darwin which do not have the md5sum utility + # installed by default + echo "Skipping md5sum (not installed). Hint: brew install md5sha1sum" + fi +} + # Mount FSPID=0 if [ $# -eq 1 ] && [ "$1" == "-encfs" ]; then @@ -36,11 +46,13 @@ elif [ $# -eq 1 ] && [ "$1" == "-loopback" ]; then rm -f /tmp/loopback*.memprof loopback -l -memprofile=/tmp/loopback $MNT $CRYPT & FSPID=$(jobs -p) + disown else echo "Testing gocryptfs" gocryptfs -q -init -extpass="echo test" -scryptn=10 $CRYPT gocryptfs -q -extpass="echo test" -nosyslog -fg $CRYPT $MNT & FSPID=$(jobs -p) + disown #gocryptfs -q -extpass="echo test" -nosyslog -memprofile /tmp/extractloop-mem $CRYPT $MNT fi echo "Test dir: $CRYPT" @@ -53,7 +65,7 @@ ln -v -sTf $CSV /tmp/extractloop.csv 2> /dev/null || true # fails on MacOS, igno # Cleanup trap # Note: gocryptfs may have already umounted itself because bash relays SIGINT # Just ignore unmount errors. -trap "cd /; fuse-unmount -z $MNT; rm -rf $CRYPT $MNT" EXIT +trap "cd / ; fuse-unmount -z $MNT ; rm -rf $CRYPT; rmdir $MNT" EXIT function loop { ID=$1 @@ -70,7 +82,7 @@ function loop { tar xf /tmp/linux-3.0.tar.gz --exclude linux-3.0/arch/microblaze/boot/dts/system.dts # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # Exclude the one symlink in the tarball - causes problems on MacOS: "Can't set permissions to 0755" - md5sum --status -c $MD5 + check_md5sums $MD5 rm -Rf linux-3.0 t2=$SECONDS delta=$((t2-t1)) |