macos: tests: make extractloop.bash work on macos
macos' bash and ln lack a few features we used.
This commit is contained in:
parent
02693912e5
commit
51de6cd940
@ -48,7 +48,7 @@ echo "Test dir: $CRYPT"
|
|||||||
sleep 1
|
sleep 1
|
||||||
cd $MNT
|
cd $MNT
|
||||||
|
|
||||||
ln -sTf $CSV /tmp/extractloop.csv
|
ln -sTf $CSV /tmp/extractloop.csv || true # fails on MacOS
|
||||||
|
|
||||||
# Cleanup trap
|
# Cleanup trap
|
||||||
# Note: gocryptfs may have already umounted itself because bash relays SIGINT
|
# 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
|
trap "cd /; fuse-unmount -z $MNT; rm -rf $CRYPT $MNT" EXIT
|
||||||
|
|
||||||
function loop {
|
function loop {
|
||||||
# Note: In a subshell, $$ returns the PID of the parent shell.
|
ID=$1
|
||||||
# We need our own PID, which is why we use $BASHPID.
|
mkdir $ID
|
||||||
mkdir $BASHPID
|
cd $ID
|
||||||
cd $BASHPID
|
|
||||||
|
|
||||||
echo "[pid $BASHPID] Starting loop"
|
echo "[looper $ID] Starting"
|
||||||
|
|
||||||
N=1
|
N=1
|
||||||
RSS=0
|
RSS=0
|
||||||
@ -77,7 +76,7 @@ function loop {
|
|||||||
RSS=$(grep VmRSS /proc/$FSPID/status | tr -s ' ' | cut -f2 -d ' ')
|
RSS=$(grep VmRSS /proc/$FSPID/status | tr -s ' ' | cut -f2 -d ' ')
|
||||||
echo "$N,$SECONDS,$RSS" >> $CSV
|
echo "$N,$SECONDS,$RSS" >> $CSV
|
||||||
fi
|
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
|
let N=$N+1
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -89,7 +88,7 @@ function memprof {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
loop &
|
loop 1 &
|
||||||
loop &
|
loop 2 &
|
||||||
#memprof &
|
#memprof &
|
||||||
wait
|
wait
|
||||||
|
Loading…
Reference in New Issue
Block a user