2015-10-07 22:08:30 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-11-03 21:11:07 +01:00
|
|
|
set -eu
|
2015-10-07 22:08:30 +02:00
|
|
|
|
2016-01-09 14:20:04 +01:00
|
|
|
cd "$(dirname "$0")"
|
2016-11-26 13:43:50 +01:00
|
|
|
MYNAME=$(basename "$0")
|
|
|
|
TESTDIR=/tmp/gocryptfs-test-parent
|
|
|
|
LOCKFILE=$TESTDIR/$MYNAME.lock
|
2016-01-09 14:20:04 +01:00
|
|
|
|
2016-11-26 13:43:50 +01:00
|
|
|
mkdir -p $TESTDIR
|
|
|
|
|
|
|
|
(
|
|
|
|
# Prevent multiple parallel test.bash instances as this causes
|
|
|
|
# all kinds of mayham
|
|
|
|
if ! flock --nonblock 200 ; then
|
|
|
|
echo "Could not acquire lock on $LOCKFILE - already running?"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Clean up dangling filesystems
|
|
|
|
for i in $(cat /proc/mounts | grep $TESTDIR | cut -f2 -d" "); do
|
2016-10-08 21:59:21 +02:00
|
|
|
echo "Warning: unmounting leftover filesystem: $i"
|
|
|
|
fusermount -u $i
|
|
|
|
done
|
|
|
|
|
2016-12-10 13:14:20 +01:00
|
|
|
source build-without-openssl.bash
|
2015-11-01 15:22:53 +01:00
|
|
|
source build.bash
|
2016-02-06 20:22:45 +01:00
|
|
|
|
2016-10-04 22:42:30 +02:00
|
|
|
if go tool | grep vet > /dev/null ; then
|
|
|
|
go tool vet -all -shadow .
|
|
|
|
else
|
|
|
|
echo "\"go tool vet\" not available - skipping"
|
|
|
|
fi
|
2016-11-26 13:43:50 +01:00
|
|
|
|
2017-01-03 17:40:20 +01:00
|
|
|
# We don't want all the subprocesses holding the lock file open
|
|
|
|
go test ./... $* 200>&-
|
2016-12-10 14:53:04 +01:00
|
|
|
|
|
|
|
# The tests cannot to this themselves as they are run in parallel.
|
|
|
|
# Don't descend into possibly still mounted example filesystems.
|
|
|
|
rm -Rf --one-file-system $TESTDIR
|
|
|
|
|
2016-12-10 11:54:54 +01:00
|
|
|
if grep -R "panic(" internal ; then
|
|
|
|
echo "Please use log.Panic instead of naked panic!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-11-26 13:43:50 +01:00
|
|
|
) 200> $LOCKFILE
|