tests: exit with error if we have leftover filesystems
This commit is contained in:
parent
50bf282d2a
commit
c458d99aa9
11
test.bash
11
test.bash
@ -9,10 +9,13 @@ mkdir -p $TESTDIR
|
|||||||
LOCKFILE=$TESTDIR/$MYNAME.lock
|
LOCKFILE=$TESTDIR/$MYNAME.lock
|
||||||
|
|
||||||
function unmount_leftovers {
|
function unmount_leftovers {
|
||||||
|
RET=0
|
||||||
for i in $(mount | grep $TESTDIR | cut -f3 -d" "); do
|
for i in $(mount | grep $TESTDIR | cut -f3 -d" "); do
|
||||||
echo "Warning: unmounting leftover filesystem: $i"
|
echo "Warning: unmounting leftover filesystem: $i"
|
||||||
tests/fuse-unmount.bash $i
|
tests/fuse-unmount.bash $i
|
||||||
|
RET=1
|
||||||
done
|
done
|
||||||
|
return $RET
|
||||||
}
|
}
|
||||||
|
|
||||||
(
|
(
|
||||||
@ -25,8 +28,8 @@ elif ! flock -n 200 ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clean up dangling filesystems
|
# Clean up dangling filesystems and don't exit if we found some
|
||||||
unmount_leftovers
|
unmount_leftovers || true
|
||||||
|
|
||||||
./build-without-openssl.bash
|
./build-without-openssl.bash
|
||||||
# Don't build with openssl if we were passed "-tags without_openssl"
|
# Don't build with openssl if we were passed "-tags without_openssl"
|
||||||
@ -49,13 +52,15 @@ go test -count 1 ./... "$@" 200>&-
|
|||||||
# ^^^^^^^^
|
# ^^^^^^^^
|
||||||
# Disable result caching
|
# 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.
|
# The tests cannot to this themselves as they are run in parallel.
|
||||||
# Don't descend into possibly still mounted example filesystems.
|
# Don't descend into possibly still mounted example filesystems.
|
||||||
if [[ $OSTYPE == *linux* ]] ; then
|
if [[ $OSTYPE == *linux* ]] ; then
|
||||||
rm -Rf --one-file-system $TESTDIR
|
rm -Rf --one-file-system $TESTDIR
|
||||||
else
|
else
|
||||||
# MacOS "rm" does not understand "--one-file-system"
|
# MacOS "rm" does not understand "--one-file-system"
|
||||||
unmount_leftovers
|
|
||||||
rm -Rf $TESTDIR
|
rm -Rf $TESTDIR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user