fsstress-loopback: use random directory names

This allows to run more than one instance of
the script in parallel.

Also, properly clean up on exit.
This commit is contained in:
Jakob Unterwurzacher 2016-05-25 00:18:51 +02:00
parent 432c94da01
commit 30f0ae3720

View File

@ -15,9 +15,9 @@
set -eu set -eu
# Backing directory # Backing directory
DIR=/tmp/a DIR=$(mktemp -d /tmp/fsstress.XXX)
# Mountpoint # Mountpoint
MNT=/tmp/b MNT="$DIR.mnt"
# fsstress binary # fsstress binary
FSSTRESS=~/src/xfstests/ltp/fsstress FSSTRESS=~/src/xfstests/ltp/fsstress
@ -27,7 +27,7 @@ then
exit 1 exit 1
fi fi
# Cleanup + Setup # Setup
fusermount -u -z $MNT &> /dev/null || true fusermount -u -z $MNT &> /dev/null || true
mkdir -p $DIR $MNT mkdir -p $DIR $MNT
rm -Rf $DIR/* rm -Rf $DIR/*
@ -60,6 +60,9 @@ do
done done
echo echo
# Cleanup trap
trap "cd /; fusermount -u -z $MNT; rm -rf $DIR $MNT" EXIT
echo "Starting fsstress loop" echo "Starting fsstress loop"
N=1 N=1
while true while true