aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-10-03 14:21:21 +0200
committerJakob Unterwurzacher2020-10-04 00:12:25 +0200
commit66449bf56b22d2f6b6309649b4c4819217c1cee5 (patch)
tree63c2c2d507a584daf2a8529003d1209ff34f996d /tests
parent3c5a80c27ba096b6938caf9549227620fa522af4 (diff)
tests: fsstress-gocryptfs.bash: add DEBUG option
Also add a wrapper script, fsstress.collect-crashes.sh, to collect the debug output. https://github.com/hanwen/go-fuse/issues/372
Diffstat (limited to 'tests')
-rwxr-xr-xtests/stress_tests/fsstress-gocryptfs.bash28
-rwxr-xr-xtests/stress_tests/fsstress.collect-crashes.sh21
2 files changed, 36 insertions, 13 deletions
diff --git a/tests/stress_tests/fsstress-gocryptfs.bash b/tests/stress_tests/fsstress-gocryptfs.bash
index 5f8c6dc..91952a1 100755
--- a/tests/stress_tests/fsstress-gocryptfs.bash
+++ b/tests/stress_tests/fsstress-gocryptfs.bash
@@ -12,20 +12,19 @@
#
# Nowadays it should pass an indefinite number of iterations.
-if [[ -z $TMPDIR ]]; then
- TMPDIR=/var/tmp
- export TMPDIR
-fi
-
set -eu
+# Init variables to default values if unset or empty
+export TMPDIR=${TMPDIR:-/var/tmp}
+DEBUG=${DEBUG:-0}
+
cd "$(dirname "$0")"
MYNAME=$(basename $0)
source ../fuse-unmount.bash
# fsstress binary
FSSTRESS=$HOME/fuse-xfstests/ltp/fsstress
-if [ ! -x $FSSTRESS ]
+if [[ ! -x $FSSTRESS ]]
then
echo "$MYNAME: fsstress binary not found at $FSSTRESS"
echo "Please clone and compile https://github.com/rfjakob/fuse-xfstests"
@@ -47,22 +46,25 @@ for i in $(mount | cut -d" " -f3 | grep $TMPDIR/$MYNAME) ; do
done
# FS-specific compile and mount
-if [ $MYNAME = fsstress-loopback.bash ]; then
+if [[ $MYNAME = fsstress-loopback.bash ]]; then
echo -n "Recompile go-fuse loopback: "
cd $GOPATH/src/github.com/hanwen/go-fuse/example/loopback
git describe
go build && go install
- $GOPATH/bin/loopback -q $MNT $DIR &
+ OPTS="-q"
+ if [[ $DEBUG -eq 1 ]]; then
+ OPTS="-debug"
+ fi
+ $GOPATH/bin/loopback $OPTS "$MNT" "$DIR" &
disown
-elif [ $MYNAME = fsstress-gocryptfs.bash ]; then
+elif [[ $MYNAME = fsstress-gocryptfs.bash ]]; then
echo "Recompile gocryptfs"
cd $GOPATH/src/github.com/rfjakob/gocryptfs
./build.bash # also prints the version
$GOPATH/bin/gocryptfs -q -init -extpass "echo test" -scryptn=10 $DIR
- $GOPATH/bin/gocryptfs -q -extpass "echo test" -nosyslog $DIR $MNT
-elif [ $MYNAME = fsstress-encfs.bash ]; then
- # You probably want do adjust this path to your system
- /home/jakob.donotbackup/encfs/build/encfs --extpass "echo test" --standard $DIR $MNT
+ $GOPATH/bin/gocryptfs -q -extpass "echo test" -nosyslog -fusedebug=$DEBUG $DIR $MNT
+elif [[ $MYNAME = fsstress-encfs.bash ]]; then
+ encfs --extpass "echo test" --standard $DIR $MNT
else
echo Unknown mode: $MYNAME
exit 1
diff --git a/tests/stress_tests/fsstress.collect-crashes.sh b/tests/stress_tests/fsstress.collect-crashes.sh
new file mode 100755
index 0000000..f315e2e
--- /dev/null
+++ b/tests/stress_tests/fsstress.collect-crashes.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+cd ~/go/src/github.com/rfjakob/gocryptfs/tests/stress_tests || exit 1
+export TMPDIR=/mnt/ext4-ramdisk
+# Check that TMPDIR is writeable
+touch "$TMPDIR/$$" || exit 1
+rm "$TMPDIR/$$"
+LOGDIR=/tmp/$$
+mkdir "$LOGDIR" || exit 1
+echo "Logging to LOGDIR=$LOGDIR, TMPDIR=$TMPDIR"
+for i in $(seq 1 1000) ; do
+ set -x
+ LOG="$LOGDIR/fsstress.log.$(date --iso).$i"
+ if [[ -e $LOG ]]; then
+ continue
+ fi
+ rm -Rf "$TMPDIR"/fsstress*
+ # 100000 lines ...... ~7 MB
+ # 1000000 lines ..... ~70 MB
+ # 10000000 lines .... ~700 MB
+ DEBUG=1 ./fsstress-loopback.bash 2>&1 | tail -1000000 > "$LOG"
+done