aboutsummaryrefslogtreecommitdiff
path: root/tests/stress_tests/extractloop.bash
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-03-13 22:41:26 +0100
committerJakob Unterwurzacher2018-03-13 22:41:26 +0100
commit4b75b578a2053722f21c62fba3a6b6e3f4aaefeb (patch)
treeb0bc5d50b224b801bdc0d3167508587bf8d355cd /tests/stress_tests/extractloop.bash
parente46f6b940f3159e63f9cc4b4866d4b20085f34cc (diff)
tests: extractloop.sh: better cleanup logic, handle missing /proc
macos does not have /proc, so don't try to read it.
Diffstat (limited to 'tests/stress_tests/extractloop.bash')
-rwxr-xr-xtests/stress_tests/extractloop.bash8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/stress_tests/extractloop.bash b/tests/stress_tests/extractloop.bash
index d92b347..95eaecd 100755
--- a/tests/stress_tests/extractloop.bash
+++ b/tests/stress_tests/extractloop.bash
@@ -21,7 +21,9 @@ source ../fuse-unmount.bash
# Setup dirs
../dl-linux-tarball.bash
cd /tmp
-CRYPT=$(mktemp -d /tmp/$MYNAME.XXX)
+EXTRACTLOOP_TMPDIR=/tmp/extractloop_tmpdir
+mkdir -p $EXTRACTLOOP_TMPDIR
+CRYPT=$(mktemp -d $EXTRACTLOOP_TMPDIR/XXX)
CSV=$CRYPT.csv
MNT=$CRYPT.mnt
mkdir $MNT
@@ -65,7 +67,7 @@ ln -v -sTf $CSV /tmp/extractloop.csv 2> /dev/null || true # fails on MacOS, igno
# Cleanup trap
# Note: gocryptfs may have already umounted itself because bash relays SIGINT
# Just ignore unmount errors.
-trap "cd / ; fuse-unmount -z $MNT ; rm -rf $CRYPT; rmdir $MNT" EXIT
+trap "cd / ; rm -Rf $CRYPT ; fuse-unmount -z $MNT || true ; rmdir $MNT" EXIT
function loop {
ID=$1
@@ -86,7 +88,7 @@ function loop {
rm -Rf linux-3.0
t2=$SECONDS
delta=$((t2-t1))
- if [ $FSPID -gt 0 ]; then
+ if [[ $FSPID -gt 0 && -d /proc ]]; then
RSS=$(grep VmRSS /proc/$FSPID/status | tr -s ' ' | cut -f2 -d ' ')
echo "$N,$SECONDS,$RSS" >> $CSV
fi