aboutsummaryrefslogtreecommitdiff
path: root/stress_tests/fsstress-loopback.bash
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-05-25 00:18:51 +0200
committerJakob Unterwurzacher2016-05-25 00:18:51 +0200
commit30f0ae37207ea65221a3c66c1f91bc62c025c07d (patch)
tree61ba0747fe4d72173223a1124d29eed40fa31290 /stress_tests/fsstress-loopback.bash
parent432c94da01fd47bda6ad9297f44d8119a4053ed3 (diff)
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.
Diffstat (limited to 'stress_tests/fsstress-loopback.bash')
-rwxr-xr-xstress_tests/fsstress-loopback.bash9
1 files changed, 6 insertions, 3 deletions
diff --git a/stress_tests/fsstress-loopback.bash b/stress_tests/fsstress-loopback.bash
index 483df9c..a60face 100755
--- a/stress_tests/fsstress-loopback.bash
+++ b/stress_tests/fsstress-loopback.bash
@@ -15,9 +15,9 @@
set -eu
# Backing directory
-DIR=/tmp/a
+DIR=$(mktemp -d /tmp/fsstress.XXX)
# Mountpoint
-MNT=/tmp/b
+MNT="$DIR.mnt"
# fsstress binary
FSSTRESS=~/src/xfstests/ltp/fsstress
@@ -27,7 +27,7 @@ then
exit 1
fi
-# Cleanup + Setup
+# Setup
fusermount -u -z $MNT &> /dev/null || true
mkdir -p $DIR $MNT
rm -Rf $DIR/*
@@ -60,6 +60,9 @@ do
done
echo
+# Cleanup trap
+trap "cd /; fusermount -u -z $MNT; rm -rf $DIR $MNT" EXIT
+
echo "Starting fsstress loop"
N=1
while true