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
|
2017-02-17 19:41:29 +01:00
|
|
|
if ! flock -n 200 ; then
|
2016-11-26 13:43:50 +01:00
|
|
|
echo "Could not acquire lock on $LOCKFILE - already running?"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Clean up dangling filesystems
|
2017-02-15 23:02:01 +01:00
|
|
|
source tests/fuse-unmount.bash
|
2017-02-16 19:13:03 +01:00
|
|
|
for i in $(mount | grep $TESTDIR | cut -f3 -d" "); do
|
2016-10-08 21:59:21 +02:00
|
|
|
echo "Warning: unmounting leftover filesystem: $i"
|
2017-02-15 23:02:01 +01:00
|
|
|
fuse-unmount $i
|
2016-10-08 21:59:21 +02:00
|
|
|
done
|
|
|
|
|
2017-03-05 13:32:28 +01:00
|
|
|
./build-without-openssl.bash
|
2017-02-17 19:41:29 +01:00
|
|
|
# Building with openssl is difficult on OSX, so only do it on Linux.
|
|
|
|
if [[ $OSTYPE == linux* ]] ; then
|
2017-03-05 13:32:28 +01:00
|
|
|
./build.bash
|
2017-02-17 19:41:29 +01:00
|
|
|
fi
|
2016-02-06 20:22:45 +01:00
|
|
|
|
2017-11-12 13:04:31 +01:00
|
|
|
if ! go tool | grep vet > /dev/null ; then
|
2017-10-22 15:00:19 +02:00
|
|
|
echo "'go tool vet' not available - skipping"
|
2017-11-12 13:04:31 +01:00
|
|
|
elif [[ -d vendor ]] ; then
|
|
|
|
echo "vendor directory exists, skipping 'go tool vet'"
|
|
|
|
else
|
|
|
|
go tool vet -all -shadow .
|
2016-10-04 22:42:30 +02:00
|
|
|
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
|