From 7d1400d872c6e0c640ed6279903df746adec332b Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 31 Mar 2019 21:19:07 +0200 Subject: [PATCH] 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 --- benchmark.bash | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/benchmark.bash b/benchmark.bash index 1501adc..4949831 100755 --- a/benchmark.bash +++ b/benchmark.bash @@ -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