From 41af353dcb1b6ef12b62616f5f3d424d5fa15212 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Thu, 17 Nov 2016 22:46:21 +0100 Subject: [PATCH] tests: rename fsstress-loopback.bash to fsstress-gocryptfs.bash The primary use is testing gocryptfs, after all. --- tests/stress_tests/fsstress-gocryptfs.bash | 95 +++++++++++++++++++++- tests/stress_tests/fsstress-loopback.bash | 95 +--------------------- 2 files changed, 95 insertions(+), 95 deletions(-) mode change 120000 => 100755 tests/stress_tests/fsstress-gocryptfs.bash mode change 100755 => 120000 tests/stress_tests/fsstress-loopback.bash diff --git a/tests/stress_tests/fsstress-gocryptfs.bash b/tests/stress_tests/fsstress-gocryptfs.bash deleted file mode 120000 index 44ba569..0000000 --- a/tests/stress_tests/fsstress-gocryptfs.bash +++ /dev/null @@ -1 +0,0 @@ -fsstress-loopback.bash \ No newline at end of file diff --git a/tests/stress_tests/fsstress-gocryptfs.bash b/tests/stress_tests/fsstress-gocryptfs.bash new file mode 100755 index 0000000..51c68db --- /dev/null +++ b/tests/stress_tests/fsstress-gocryptfs.bash @@ -0,0 +1,94 @@ +#!/bin/bash +# +# Mount a go-fuse loopback filesystem in /tmp and run fsstress against it +# in an infinite loop, only exiting on errors. +# +# When called as "fsstress-gocryptfs.bash", a gocryptfs filesystem is tested +# instead. +# +# This test used to fail on older go-fuse versions after a few iterations with +# errors like this: +# "rm: cannot remove ‘/tmp/b/fsstress.2/pd/d1XXX/f4a’: No such file or directory" +# +# Nowadays it should pass an indefinite number of iterations. + +set -eu + +# Backing directory +DIR=$(mktemp -d /tmp/fsstress.XXX) +# Mountpoint +MNT="$DIR.mnt" +# fsstress binary +FSSTRESS=~/src/xfstests/ltp/fsstress + +if [ ! -x $FSSTRESS ] +then + echo "fsstress binary not found, adjust FSSTRESS=$FSSTRESS" + exit 1 +fi + +# 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 & + disown +elif [ $MYNAME = fsstress-gocryptfs.bash ]; then + echo "Recompile gocryptfs" + cd $GOPATH/src/github.com/rfjakob/gocryptfs + ./build.bash + $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: " +sleep 0.5 +while ! grep "$MNT fuse" /proc/self/mounts > /dev/null +do + sleep 1 + echo -n x +done +echo + +# Cleanup trap +trap "kill %1 ; cd /; fusermount -u -z $MNT; rm -rf $DIR $MNT" EXIT + +echo "Starting fsstress loop" +N=1 +while true +do + echo $N + mkdir $MNT/fsstress.1 + echo -n " fsstress.1 " + $FSSTRESS -r -m 8 -n 1000 -d $MNT/fsstress.1 & + wait + + mkdir $MNT/fsstress.2 + echo -n " fsstress.2 " + $FSSTRESS -p 20 -r -m 8 -n 1000 -d $MNT/fsstress.2 & + wait + + 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 & + wait + + echo " rm" + rm -R $MNT/* + + let N=$N+1 +done + diff --git a/tests/stress_tests/fsstress-loopback.bash b/tests/stress_tests/fsstress-loopback.bash deleted file mode 100755 index 51c68db..0000000 --- a/tests/stress_tests/fsstress-loopback.bash +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash -# -# Mount a go-fuse loopback filesystem in /tmp and run fsstress against it -# in an infinite loop, only exiting on errors. -# -# When called as "fsstress-gocryptfs.bash", a gocryptfs filesystem is tested -# instead. -# -# This test used to fail on older go-fuse versions after a few iterations with -# errors like this: -# "rm: cannot remove ‘/tmp/b/fsstress.2/pd/d1XXX/f4a’: No such file or directory" -# -# Nowadays it should pass an indefinite number of iterations. - -set -eu - -# Backing directory -DIR=$(mktemp -d /tmp/fsstress.XXX) -# Mountpoint -MNT="$DIR.mnt" -# fsstress binary -FSSTRESS=~/src/xfstests/ltp/fsstress - -if [ ! -x $FSSTRESS ] -then - echo "fsstress binary not found, adjust FSSTRESS=$FSSTRESS" - exit 1 -fi - -# 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 & - disown -elif [ $MYNAME = fsstress-gocryptfs.bash ]; then - echo "Recompile gocryptfs" - cd $GOPATH/src/github.com/rfjakob/gocryptfs - ./build.bash - $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: " -sleep 0.5 -while ! grep "$MNT fuse" /proc/self/mounts > /dev/null -do - sleep 1 - echo -n x -done -echo - -# Cleanup trap -trap "kill %1 ; cd /; fusermount -u -z $MNT; rm -rf $DIR $MNT" EXIT - -echo "Starting fsstress loop" -N=1 -while true -do - echo $N - mkdir $MNT/fsstress.1 - echo -n " fsstress.1 " - $FSSTRESS -r -m 8 -n 1000 -d $MNT/fsstress.1 & - wait - - mkdir $MNT/fsstress.2 - echo -n " fsstress.2 " - $FSSTRESS -p 20 -r -m 8 -n 1000 -d $MNT/fsstress.2 & - wait - - 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 & - wait - - echo " rm" - rm -R $MNT/* - - let N=$N+1 -done - diff --git a/tests/stress_tests/fsstress-loopback.bash b/tests/stress_tests/fsstress-loopback.bash new file mode 120000 index 0000000..139d4ec --- /dev/null +++ b/tests/stress_tests/fsstress-loopback.bash @@ -0,0 +1 @@ +fsstress-gocryptfs.bash \ No newline at end of file