From 4b75b578a2053722f21c62fba3a6b6e3f4aaefeb Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Tue, 13 Mar 2018 22:41:26 +0100 Subject: tests: extractloop.sh: better cleanup logic, handle missing /proc macos does not have /proc, so don't try to read it. --- tests/stress_tests/extractloop.bash | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tests/stress_tests') 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 -- cgit v1.2.3