2016-05-05 12:58:44 +02:00
|
|
|
|
#!/bin/bash
|
2016-05-24 21:08:13 +02:00
|
|
|
|
#
|
|
|
|
|
# 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.
|
|
|
|
|
|
2016-05-05 12:58:44 +02:00
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
|
|
# Backing directory
|
2016-05-25 00:18:51 +02:00
|
|
|
|
DIR=$(mktemp -d /tmp/fsstress.XXX)
|
2016-05-05 12:58:44 +02:00
|
|
|
|
# Mountpoint
|
2016-05-25 00:18:51 +02:00
|
|
|
|
MNT="$DIR.mnt"
|
2016-05-05 12:58:44 +02:00
|
|
|
|
# fsstress binary
|
|
|
|
|
FSSTRESS=~/src/xfstests/ltp/fsstress
|
|
|
|
|
|
|
|
|
|
if [ ! -x $FSSTRESS ]
|
|
|
|
|
then
|
|
|
|
|
echo "fsstress binary not found, adjust FSSTRESS=$FSSTRESS"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2016-05-25 00:18:51 +02:00
|
|
|
|
# Setup
|
2016-05-05 12:58:44 +02:00
|
|
|
|
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 &
|
2016-05-29 13:57:22 +02:00
|
|
|
|
disown
|
2016-05-05 12:58:44 +02:00
|
|
|
|
elif [ $MYNAME = fsstress-gocryptfs.bash ]; then
|
|
|
|
|
echo "Recompile gocryptfs"
|
|
|
|
|
cd $GOPATH/src/github.com/rfjakob/gocryptfs
|
2016-05-29 13:57:22 +02:00
|
|
|
|
./build.bash
|
2016-05-05 12:58:44 +02:00
|
|
|
|
$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: "
|
2016-05-08 22:23:59 +02:00
|
|
|
|
sleep 0.5
|
2016-05-05 12:58:44 +02:00
|
|
|
|
while ! grep "$MNT fuse" /proc/self/mounts > /dev/null
|
|
|
|
|
do
|
|
|
|
|
sleep 1
|
|
|
|
|
echo -n x
|
|
|
|
|
done
|
2016-05-08 22:23:59 +02:00
|
|
|
|
echo
|
2016-05-05 12:58:44 +02:00
|
|
|
|
|
2016-05-25 00:18:51 +02:00
|
|
|
|
# Cleanup trap
|
2016-05-29 13:57:22 +02:00
|
|
|
|
trap "kill %1 ; cd /; fusermount -u -z $MNT; rm -rf $DIR $MNT" EXIT
|
2016-05-25 00:18:51 +02:00
|
|
|
|
|
2016-05-05 12:58:44 +02:00
|
|
|
|
echo "Starting fsstress loop"
|
|
|
|
|
N=1
|
|
|
|
|
while true
|
|
|
|
|
do
|
|
|
|
|
echo $N
|
|
|
|
|
mkdir $MNT/fsstress.1
|
|
|
|
|
echo -n " fsstress.1 "
|
2016-05-29 13:57:22 +02:00
|
|
|
|
$FSSTRESS -r -m 8 -n 1000 -d $MNT/fsstress.1 &
|
|
|
|
|
wait
|
2016-05-05 12:58:44 +02:00
|
|
|
|
|
|
|
|
|
mkdir $MNT/fsstress.2
|
|
|
|
|
echo -n " fsstress.2 "
|
2016-05-29 13:57:22 +02:00
|
|
|
|
$FSSTRESS -p 20 -r -m 8 -n 1000 -d $MNT/fsstress.2 &
|
|
|
|
|
wait
|
2016-05-05 12:58:44 +02:00
|
|
|
|
|
|
|
|
|
mkdir $MNT/fsstress.3
|
|
|
|
|
echo -n " fsstress.3 "
|
2016-05-29 13:57:22 +02:00
|
|
|
|
$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
|
2016-05-05 12:58:44 +02:00
|
|
|
|
|
|
|
|
|
echo " rm"
|
|
|
|
|
rm -R $MNT/*
|
|
|
|
|
|
|
|
|
|
let N=$N+1
|
|
|
|
|
done
|
|
|
|
|
|