summaryrefslogtreecommitdiff
path: root/test.bash
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-03-06 21:45:49 +0100
committerJakob Unterwurzacher2018-03-06 21:45:49 +0100
commitc458d99aa9ffee9987468c182fbcc407bbbc7a3d (patch)
treed0862f9e8c52fe32ba268788f7e2c21d60945e63 /test.bash
parent50bf282d2ac7f832490ce9efab039c35c9ad63f8 (diff)
tests: exit with error if we have leftover filesystems
Diffstat (limited to 'test.bash')
-rwxr-xr-xtest.bash11
1 files changed, 8 insertions, 3 deletions
diff --git a/test.bash b/test.bash
index 96ff544..5f0c7e4 100755
--- a/test.bash
+++ b/test.bash
@@ -9,10 +9,13 @@ mkdir -p $TESTDIR
LOCKFILE=$TESTDIR/$MYNAME.lock
function unmount_leftovers {
+ RET=0
for i in $(mount | grep $TESTDIR | cut -f3 -d" "); do
echo "Warning: unmounting leftover filesystem: $i"
tests/fuse-unmount.bash $i
+ RET=1
done
+ return $RET
}
(
@@ -25,8 +28,8 @@ elif ! flock -n 200 ; then
exit 1
fi
-# Clean up dangling filesystems
-unmount_leftovers
+# Clean up dangling filesystems and don't exit if we found some
+unmount_leftovers || true
./build-without-openssl.bash
# Don't build with openssl if we were passed "-tags without_openssl"
@@ -49,13 +52,15 @@ go test -count 1 ./... "$@" 200>&-
# ^^^^^^^^
# Disable result caching
+# Clean up dangling filesystems but do exit with an error if we found one
+unmount_leftovers || { echo "Error: the tests left mounted filesystems behind" ; exit 1 ; }
+
# The tests cannot to this themselves as they are run in parallel.
# Don't descend into possibly still mounted example filesystems.
if [[ $OSTYPE == *linux* ]] ; then
rm -Rf --one-file-system $TESTDIR
else
# MacOS "rm" does not understand "--one-file-system"
- unmount_leftovers
rm -Rf $TESTDIR
fi