2016-07-16 18:08:01 +02:00
|
|
|
#!/bin/bash -eu
|
2016-01-23 19:33:03 +01:00
|
|
|
|
2016-01-23 20:17:34 +01:00
|
|
|
# Run the set of "canonical" benchmarks that are shown on
|
|
|
|
# https://nuetzlich.net/gocryptfs/comparison/
|
|
|
|
|
2016-07-16 18:08:01 +02:00
|
|
|
cd "$(dirname "$0")"
|
2016-11-23 21:54:55 +01:00
|
|
|
MYNAME=$(basename "$0")
|
2017-02-15 23:02:01 +01:00
|
|
|
source tests/fuse-unmount.bash
|
2016-01-23 19:33:03 +01:00
|
|
|
|
2016-11-23 21:54:55 +01:00
|
|
|
function usage {
|
2016-12-13 22:13:54 +01:00
|
|
|
echo "Usage: $MYNAME [-encfs] [-openssl=true] [-openssl=false] [DIR]"
|
2016-11-23 21:54:55 +01:00
|
|
|
}
|
|
|
|
|
2016-12-13 22:13:54 +01:00
|
|
|
OPT_ENCFS=0
|
|
|
|
OPT_OPENSSL=""
|
|
|
|
OPT_DIR=""
|
|
|
|
|
|
|
|
while [[ $# -gt 0 ]] ; do
|
|
|
|
case $1 in
|
|
|
|
-h)
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
-encfs)
|
|
|
|
OPT_ENCFS=1
|
|
|
|
;;
|
|
|
|
-openssl=true)
|
|
|
|
OPT_OPENSSL="-openssl=true"
|
|
|
|
;;
|
|
|
|
-openssl=false)
|
|
|
|
OPT_OPENSSL="-openssl=false"
|
|
|
|
;;
|
|
|
|
-*)
|
|
|
|
echo "Invalid option: $1"
|
|
|
|
usage
|
|
|
|
exit 2
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
if [[ ! -z $OPT_DIR ]] ; then
|
|
|
|
echo "Duplicate DIR argument: $1"
|
|
|
|
usage
|
|
|
|
exit 3
|
|
|
|
fi
|
|
|
|
OPT_DIR=$1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
2016-11-23 21:54:55 +01:00
|
|
|
|
2016-12-13 22:13:54 +01:00
|
|
|
if [[ -z $OPT_DIR ]] ; then
|
|
|
|
OPT_DIR=/tmp
|
2016-11-23 21:54:55 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Create directories
|
2016-12-13 22:13:54 +01:00
|
|
|
CRYPT=$(mktemp -d "$OPT_DIR/$MYNAME.XXX")
|
2016-07-16 18:08:01 +02:00
|
|
|
MNT=$CRYPT.mnt
|
|
|
|
mkdir $MNT
|
2016-07-11 22:10:41 +02:00
|
|
|
|
2016-07-16 18:08:01 +02:00
|
|
|
# Mount
|
2016-12-13 22:13:54 +01:00
|
|
|
if [[ $OPT_ENCFS -eq 1 ]]; then
|
2016-12-13 22:16:21 +01:00
|
|
|
if [[ ! -z $OPT_OPENSSL ]] ; then
|
|
|
|
echo "The option $OPT_OPENSSL only works with gocryptfs"
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-11-23 21:54:55 +01:00
|
|
|
echo "Testing EncFS at $CRYPT"
|
2016-07-16 18:08:01 +02:00
|
|
|
encfs --extpass="echo test" --standard $CRYPT $MNT > /dev/null
|
2016-07-11 22:10:41 +02:00
|
|
|
else
|
2016-11-23 21:54:55 +01:00
|
|
|
echo "Testing gocryptfs at $CRYPT"
|
2016-07-16 18:08:01 +02:00
|
|
|
gocryptfs -q -init -extpass="echo test" -scryptn=10 $CRYPT
|
2016-12-13 22:13:54 +01:00
|
|
|
gocryptfs -q -extpass="echo test" $OPT_OPENSSL $CRYPT $MNT
|
2016-07-11 22:10:41 +02:00
|
|
|
fi
|
2016-07-16 18:08:01 +02:00
|
|
|
|
|
|
|
# Cleanup trap
|
2017-02-15 23:02:01 +01:00
|
|
|
trap "cd /; fuse-unmount -z $MNT; rm -rf $CRYPT $MNT" EXIT
|
2016-01-23 19:33:03 +01:00
|
|
|
|
|
|
|
# Benchmarks
|
2016-07-16 18:08:01 +02:00
|
|
|
./tests/canonical-benchmarks.bash $MNT
|
2016-01-23 19:33:03 +01:00
|
|
|
|