benchmark.bash: add support for go-fuse loopback

Make testing the performance of the new nodefs API easier

https://github.com/hanwen/go-fuse/pull/280
This commit is contained in:
Jakob Unterwurzacher 2019-03-31 21:19:07 +02:00
parent 3b18e546fc
commit 7d1400d872
1 changed files with 14 additions and 1 deletions

View File

@ -12,6 +12,7 @@ function usage {
}
OPT_ENCFS=0
OPT_LOOPBACK=0
OPT_OPENSSL=""
OPT_DIR=""
DD_ONLY=""
@ -34,6 +35,9 @@ while [[ $# -gt 0 ]] ; do
-dd)
DD_ONLY=1
;;
-loopback)
OPT_LOOPBACK=1
;;
-*)
echo "Invalid option: $1"
usage
@ -69,6 +73,10 @@ if [[ $OPT_ENCFS -eq 1 ]]; then
echo -n "Testing EncFS at $CRYPT: "
encfs --version
/home/jakob.donotbackup/encfs/build/encfs --extpass="echo test" --standard $CRYPT $MNT > /dev/null
elif [[ $OPT_LOOPBACK -eq 1 ]]; then
echo "Testing go-fuse loopback"
$HOME/go/src/github.com/hanwen/go-fuse/example/loopback/loopback $MNT $CRYPT &
sleep 0.5
else
echo -n "Testing gocryptfs at $CRYPT: "
gocryptfs -version
@ -76,13 +84,18 @@ else
gocryptfs -q -extpass="echo test" $OPT_OPENSSL $CRYPT $MNT
fi
# Make sure we have actually mounted something
if ! mountpoint $MNT ; then
exit 1
fi
# Cleanup trap
trap "cd /; fuse-unmount -z $MNT; rm -rf $CRYPT $MNT" EXIT
# Benchmarks
if [[ $DD_ONLY -eq 1 ]]; then
echo -n "WRITE: "
dd if=/dev/zero of=$MNT/zero bs=131072 count=2000 2>&1 | tail -n 1
dd if=/dev/zero of=$MNT/zero bs=131072 count=20000 2>&1 | tail -n 1
rm $MNT/zero
else
./tests/canonical-benchmarks.bash $MNT