summaryrefslogtreecommitdiff
path: root/benchmark.bash
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-04-13 13:09:27 +0200
committerJakob Unterwurzacher2020-04-13 14:54:04 +0200
commit9a7ceef09ea1fc8cbe17b324a9d1a2e71e50cb0a (patch)
treee0806ffcfe2095525d655b15cd7034ef92ee590d /benchmark.bash
parenta2ad14b9ac92384f7cc0e8a0d8f385a9cd9a299a (diff)
shellcheck: make top-level bash scripts warning-free
And run shellcheck in test.bash.
Diffstat (limited to 'benchmark.bash')
-rwxr-xr-xbenchmark.bash24
1 files changed, 12 insertions, 12 deletions
diff --git a/benchmark.bash b/benchmark.bash
index b9c9077..578979d 100755
--- a/benchmark.bash
+++ b/benchmark.bash
@@ -44,7 +44,7 @@ while [[ $# -gt 0 ]] ; do
exit 2
;;
*)
- if [[ ! -z $OPT_DIR ]] ; then
+ if [[ -n $OPT_DIR ]] ; then
echo "Duplicate DIR argument: $1"
usage
exit 3
@@ -62,42 +62,42 @@ fi
# Create directories
CRYPT=$(mktemp -d "$OPT_DIR/$MYNAME.XXX")
MNT=$CRYPT.mnt
-mkdir $MNT
+mkdir "$MNT"
# Mount
if [[ $OPT_ENCFS -eq 1 ]]; then
- if [[ ! -z $OPT_OPENSSL ]] ; then
+ if [[ -n $OPT_OPENSSL ]] ; then
echo "The option $OPT_OPENSSL only works with gocryptfs"
exit 1
fi
echo -n "Testing EncFS at $CRYPT: "
encfs --version
- encfs --extpass="echo test" --standard $CRYPT $MNT > /dev/null
+ 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 &
+ "$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
- gocryptfs -q -init -extpass="echo test" -scryptn=10 $CRYPT
- gocryptfs -q -extpass="echo test" $OPT_OPENSSL $CRYPT $MNT
+ gocryptfs -q -init -extpass="echo test" -scryptn=10 "$CRYPT"
+ gocryptfs -q -extpass="echo test" $OPT_OPENSSL "$CRYPT" "$MNT"
fi
# Make sure we have actually mounted something
-if ! mountpoint $MNT ; then
+if ! mountpoint "$MNT" ; then
exit 1
fi
# Cleanup trap
-trap "cd /; fuse-unmount -z $MNT; rm -rf $CRYPT $MNT" EXIT
+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=20000 2>&1 | tail -n 1
- rm $MNT/zero
+ 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
+ ./tests/canonical-benchmarks.bash "$MNT"
fi