aboutsummaryrefslogtreecommitdiff
path: root/stress_tests
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-05-05 12:58:44 +0200
committerJakob Unterwurzacher2016-05-05 12:58:44 +0200
commite97962bd3f9ef8cb9fbd57bd2a2424b1cc28ec75 (patch)
tree150957e33806f92bac85b490cd214be55c364712 /stress_tests
parentcf29ce37627fd6ba4416dd9eb5e56bed44128131 (diff)
stress_tests: add stress test scripts
These were hosted at https://github.com/rfjakob/fsstress . To make them easier to use for gocryptfs users and developers, add them to the main repo.
Diffstat (limited to 'stress_tests')
-rwxr-xr-xstress_tests/extractloop.bash32
l---------stress_tests/fsstress-gocryptfs.bash1
-rwxr-xr-xstress_tests/fsstress-loopback.bash75
3 files changed, 108 insertions, 0 deletions
diff --git a/stress_tests/extractloop.bash b/stress_tests/extractloop.bash
new file mode 100755
index 0000000..3d43763
--- /dev/null
+++ b/stress_tests/extractloop.bash
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+set -eu
+
+# Setup
+cd /tmp
+wget -nv --show-progress -c https://www.kernel.org/pub/linux/kernel/v3.0/linux-3.0.tar.gz
+DIR1=$(mktemp -d)
+DIR2=$(mktemp -d)
+gocryptfs -q -init -extpass="echo test" $DIR1
+gocryptfs -q -extpass="echo test" -nosyslog $DIR1 $DIR2
+cd $DIR2
+
+# Cleanup trap
+# Note: gocryptfs may have already umounted itself because bash relays SIGINT
+# Just ignore fusermount errors.
+trap "cd /; fusermount -u -z $DIR2; rm -rf $DIR1 $DIR2" EXIT
+
+# Loop
+N=1
+while true
+do
+ echo -n "$N "
+ echo -n "extract "
+ tar xf /tmp/linux-3.0.tar.gz
+ echo -n "diff "
+ diff -ur linux-3.0 /tmp/linux-3.0
+ echo -n "rm "
+ rm -Rf linux-3.0
+ date
+ let N=$N+1
+done
diff --git a/stress_tests/fsstress-gocryptfs.bash b/stress_tests/fsstress-gocryptfs.bash
new file mode 120000
index 0000000..44ba569
--- /dev/null
+++ b/stress_tests/fsstress-gocryptfs.bash
@@ -0,0 +1 @@
+fsstress-loopback.bash \ No newline at end of file
diff --git a/stress_tests/fsstress-loopback.bash b/stress_tests/fsstress-loopback.bash
new file mode 100755
index 0000000..df60cd0
--- /dev/null
+++ b/stress_tests/fsstress-loopback.bash
@@ -0,0 +1,75 @@
+#!/bin/bash
+set -eu
+
+# Backing directory
+DIR=/tmp/a
+# Mountpoint
+MNT=/tmp/b
+# Debug log
+LOG=/tmp/log.txt
+# fsstress binary
+FSSTRESS=~/src/xfstests/ltp/fsstress
+
+if [ ! -x $FSSTRESS ]
+then
+ echo "fsstress binary not found, adjust FSSTRESS=$FSSTRESS"
+ exit 1
+fi
+
+# Cleanup + Setup
+fusermount -u -z $MNT &> /dev/null || true
+mkdir -p $DIR $MNT
+rm -Rf $DIR/*
+rm -Rf $MNT/*
+
+# FS-specific compile and mount
+MYNAME=$(basename $0)
+if [ $MYNAME = fsstress-loopback.bash ]; then
+ echo "Recompile go-fuse loopback"
+ cd $GOPATH/src/github.com/hanwen/go-fuse/example/loopback
+ go build && go install
+ $GOPATH/bin/loopback -l $MNT $DIR &
+elif [ $MYNAME = fsstress-gocryptfs.bash ]; then
+ echo "Recompile gocryptfs"
+ cd $GOPATH/src/github.com/rfjakob/gocryptfs
+ go build && go install
+ $GOPATH/bin/gocryptfs -q -init -extpass "echo test" -scryptn=10 $DIR
+ $GOPATH/bin/gocryptfs -q -extpass "echo test" -nosyslog $DIR $MNT
+else
+ echo Unknown mode: $MYNAME
+ exit 1
+fi
+
+echo -n "Waiting for mount: "
+while ! grep "$MNT fuse" /proc/self/mounts > /dev/null
+do
+ sleep 1
+ echo -n x
+done
+echo " done, debug log goes to $LOG"
+
+echo "Starting fsstress loop"
+N=1
+while true
+do
+ > $LOG
+
+ echo $N
+ mkdir $MNT/fsstress.1
+ echo -n " fsstress.1 "
+ $FSSTRESS -r -m 8 -n 1000 -d $MNT/fsstress.1
+
+ mkdir $MNT/fsstress.2
+ echo -n " fsstress.2 "
+ $FSSTRESS -p 20 -r -m 8 -n 1000 -d $MNT/fsstress.2
+
+ mkdir $MNT/fsstress.3
+ echo -n " fsstress.3 "
+ $FSSTRESS -p 4 -z -f rmdir=10 -f link=10 -f creat=10 -f mkdir=10 -f rename=30 -f stat=30 -f unlink=30 -f truncate=20 -m 8 -n 1000 -d $MNT/fsstress.3
+
+ echo " rm"
+ rm -R $MNT/*
+
+ let N=$N+1
+done
+