tests: macos: try to unmount before rm -Rf
macos does not have "rm --one-file-system", so try to unmount all remaining test filesystems to protect the backing stores. https://github.com/rfjakob/gocryptfs/issues/213
This commit is contained in:
parent
98f735ff6e
commit
50bf282d2a
15
test.bash
15
test.bash
@ -5,9 +5,15 @@ set -eu
|
|||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
MYNAME=$(basename "$0")
|
MYNAME=$(basename "$0")
|
||||||
TESTDIR=/tmp/gocryptfs-test-parent
|
TESTDIR=/tmp/gocryptfs-test-parent
|
||||||
|
mkdir -p $TESTDIR
|
||||||
LOCKFILE=$TESTDIR/$MYNAME.lock
|
LOCKFILE=$TESTDIR/$MYNAME.lock
|
||||||
|
|
||||||
mkdir -p $TESTDIR
|
function unmount_leftovers {
|
||||||
|
for i in $(mount | grep $TESTDIR | cut -f3 -d" "); do
|
||||||
|
echo "Warning: unmounting leftover filesystem: $i"
|
||||||
|
tests/fuse-unmount.bash $i
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
(
|
(
|
||||||
# Prevent multiple parallel test.bash instances as this causes
|
# Prevent multiple parallel test.bash instances as this causes
|
||||||
@ -20,11 +26,7 @@ elif ! flock -n 200 ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Clean up dangling filesystems
|
# Clean up dangling filesystems
|
||||||
source tests/fuse-unmount.bash
|
unmount_leftovers
|
||||||
for i in $(mount | grep $TESTDIR | cut -f3 -d" "); do
|
|
||||||
echo "Warning: unmounting leftover filesystem: $i"
|
|
||||||
fuse-unmount $i
|
|
||||||
done
|
|
||||||
|
|
||||||
./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"
|
||||||
@ -53,6 +55,7 @@ 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