From a56e7cc5ac3ede528aaa05f912c865b09e942de4 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sat, 6 Jun 2020 12:12:14 +0200 Subject: sshfs-benchmark.bash: fix locale trouble and move to tests Locale trouble was sshfs-benchmark.bash: line 31: printf: 4.71: invalid number because printf expected "4,71" in the German locale. Force the C locale. --- contrib/sshfs-benchmark.bash | 91 -------------------------------------------- tests/sshfs-benchmark.bash | 91 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 91 deletions(-) delete mode 100755 contrib/sshfs-benchmark.bash create mode 100755 tests/sshfs-benchmark.bash diff --git a/contrib/sshfs-benchmark.bash b/contrib/sshfs-benchmark.bash deleted file mode 100755 index 646262a..0000000 --- a/contrib/sshfs-benchmark.bash +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash - -set -eu - -function cleanup { - cd "$LOCAL_TMP" - fusermount -u gocryptfs.mnt - rm -Rf "$SSHFS_TMP" - fusermount -u sshfs.mnt - cd / - rm -Rf "$LOCAL_TMP" -} - -function prepare_mounts { - LOCAL_TMP=$(mktemp -d -t "$MYNAME.XXX") - cd $LOCAL_TMP - echo "working directory: $PWD" - mkdir sshfs.mnt gocryptfs.mnt - sshfs $HOST:/tmp sshfs.mnt - echo "sshfs mounted: $HOST:/tmp -> sshfs.mnt" - trap cleanup EXIT - SSHFS_TMP=$(mktemp -d "sshfs.mnt/$MYNAME.XXX") - mkdir $SSHFS_TMP/gocryptfs.crypt - gocryptfs -q -init -extpass "echo test" -scryptn=10 $SSHFS_TMP/gocryptfs.crypt - gocryptfs -q -extpass "echo test" $SSHFS_TMP/gocryptfs.crypt gocryptfs.mnt - echo "gocryptfs mounted: $SSHFS_TMP/gocryptfs.crypt -> gocryptfs.mnt" -} - -function etime { - T=$(/usr/bin/time -f %e -o /dev/stdout "$@") - printf %20.2f "$T" -} - -MYNAME=$(basename "$0") -HOST=$1 - -prepare_mounts - -echo -echo "$MYNAME: sshfs gocryptfs-on-sshfs" -echo -n "git init " -etime git init -q "$SSHFS_TMP/git1" -etime git init -q gocryptfs.mnt/git1 -echo - -git init -q git2 -echo -n "rsync " -etime rsync -a --no-group git2 "$SSHFS_TMP" -etime rsync -a --no-group git2 gocryptfs.mnt -echo - -echo -n "rm -R " -etime rm -R "$SSHFS_TMP/git1" "$SSHFS_TMP/git2" -etime rm -R gocryptfs.mnt/git1 gocryptfs.mnt/git2 -echo - -echo -n "mkdir " -pushd "$SSHFS_TMP" > /dev/null -etime mkdir $(seq 1 20) -popd > /dev/null -cd gocryptfs.mnt -etime mkdir $(seq 1 20) -cd .. -echo - -echo -n "rmdir " -pushd "$SSHFS_TMP" > /dev/null -etime rmdir $(seq 1 20) -popd > /dev/null -cd gocryptfs.mnt -etime rmdir $(seq 1 20) -cd .. -echo - -echo -n "touch " -pushd "$SSHFS_TMP" > /dev/null -etime touch $(seq 101 120) -popd > /dev/null -cd gocryptfs.mnt -etime touch $(seq 101 120) -cd .. -echo - -echo -n "rm " -pushd "$SSHFS_TMP" > /dev/null -etime rm $(seq 101 120) -popd > /dev/null -cd gocryptfs.mnt -etime rm $(seq 101 120) -cd .. -echo diff --git a/tests/sshfs-benchmark.bash b/tests/sshfs-benchmark.bash new file mode 100755 index 0000000..13c7a0f --- /dev/null +++ b/tests/sshfs-benchmark.bash @@ -0,0 +1,91 @@ +#!/bin/bash + +set -eu + +function cleanup { + cd "$LOCAL_TMP" + fusermount -u gocryptfs.mnt + rm -Rf "$SSHFS_TMP" + fusermount -u sshfs.mnt + cd / + rm -Rf "$LOCAL_TMP" +} + +function prepare_mounts { + LOCAL_TMP=$(mktemp -d -t "$MYNAME.XXX") + cd $LOCAL_TMP + echo "working directory: $PWD" + mkdir sshfs.mnt gocryptfs.mnt + sshfs $HOST:/tmp sshfs.mnt + echo "sshfs mounted: $HOST:/tmp -> sshfs.mnt" + trap cleanup EXIT + SSHFS_TMP=$(mktemp -d "sshfs.mnt/$MYNAME.XXX") + mkdir $SSHFS_TMP/gocryptfs.crypt + gocryptfs -q -init -extpass "echo test" -scryptn=10 $SSHFS_TMP/gocryptfs.crypt + gocryptfs -q -extpass "echo test" $SSHFS_TMP/gocryptfs.crypt gocryptfs.mnt + echo "gocryptfs mounted: $SSHFS_TMP/gocryptfs.crypt -> gocryptfs.mnt" +} + +function etime { + T=$(/usr/bin/time -f %e -o /dev/stdout "$@") + LC_ALL=C printf %20.2f "$T" +} + +MYNAME=$(basename "$0") +HOST=$1 + +prepare_mounts + +echo +echo "$MYNAME: sshfs gocryptfs-on-sshfs" +echo -n "git init " +etime git init -q "$SSHFS_TMP/git1" +etime git init -q gocryptfs.mnt/git1 +echo + +git init -q git2 +echo -n "rsync " +etime rsync -a --no-group git2 "$SSHFS_TMP" +etime rsync -a --no-group git2 gocryptfs.mnt +echo + +echo -n "rm -R " +etime rm -R "$SSHFS_TMP/git1" "$SSHFS_TMP/git2" +etime rm -R gocryptfs.mnt/git1 gocryptfs.mnt/git2 +echo + +echo -n "mkdir " +pushd "$SSHFS_TMP" > /dev/null +etime mkdir $(seq 1 20) +popd > /dev/null +cd gocryptfs.mnt +etime mkdir $(seq 1 20) +cd .. +echo + +echo -n "rmdir " +pushd "$SSHFS_TMP" > /dev/null +etime rmdir $(seq 1 20) +popd > /dev/null +cd gocryptfs.mnt +etime rmdir $(seq 1 20) +cd .. +echo + +echo -n "touch " +pushd "$SSHFS_TMP" > /dev/null +etime touch $(seq 101 120) +popd > /dev/null +cd gocryptfs.mnt +etime touch $(seq 101 120) +cd .. +echo + +echo -n "rm " +pushd "$SSHFS_TMP" > /dev/null +etime rm $(seq 101 120) +popd > /dev/null +cd gocryptfs.mnt +etime rm $(seq 101 120) +cd .. +echo -- cgit v1.2.3