From 51de6cd9405aa0db3b248324623c82cbc05e61ae Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Wed, 7 Mar 2018 20:37:10 +0100 Subject: macos: tests: make extractloop.bash work on macos macos' bash and ln lack a few features we used. --- tests/stress_tests/extractloop.bash | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'tests/stress_tests') diff --git a/tests/stress_tests/extractloop.bash b/tests/stress_tests/extractloop.bash index e25f721..26496ba 100755 --- a/tests/stress_tests/extractloop.bash +++ b/tests/stress_tests/extractloop.bash @@ -48,7 +48,7 @@ echo "Test dir: $CRYPT" sleep 1 cd $MNT -ln -sTf $CSV /tmp/extractloop.csv +ln -sTf $CSV /tmp/extractloop.csv || true # fails on MacOS # Cleanup trap # Note: gocryptfs may have already umounted itself because bash relays SIGINT @@ -56,12 +56,11 @@ ln -sTf $CSV /tmp/extractloop.csv trap "cd /; fuse-unmount -z $MNT; rm -rf $CRYPT $MNT" EXIT function loop { - # Note: In a subshell, $$ returns the PID of the parent shell. - # We need our own PID, which is why we use $BASHPID. - mkdir $BASHPID - cd $BASHPID + ID=$1 + mkdir $ID + cd $ID - echo "[pid $BASHPID] Starting loop" + echo "[looper $ID] Starting" N=1 RSS=0 @@ -77,7 +76,7 @@ function loop { RSS=$(grep VmRSS /proc/$FSPID/status | tr -s ' ' | cut -f2 -d ' ') echo "$N,$SECONDS,$RSS" >> $CSV fi - echo "[pid $BASHPID] Iteration $N done, $delta seconds, RSS $RSS kiB" + echo "[looper $ID] Iteration $N done, $delta seconds, RSS $RSS kiB" let N=$N+1 done } @@ -89,7 +88,7 @@ function memprof { done } -loop & -loop & +loop 1 & +loop 2 & #memprof & wait -- cgit v1.2.3