From 74b723d765e246f3409d4e538325242eabbc96fe Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 3 Nov 2019 20:02:46 +0100 Subject: tests: send SIGUSR1 to loopback loopback needs to receive SIGUSR1 to write a memory profile. --- tests/stress_tests/extractloop.bash | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'tests/stress_tests') diff --git a/tests/stress_tests/extractloop.bash b/tests/stress_tests/extractloop.bash index e4be841..cdd0c25 100755 --- a/tests/stress_tests/extractloop.bash +++ b/tests/stress_tests/extractloop.bash @@ -48,16 +48,20 @@ function check_md5sums { # Mount FSPID=0 +FS="" if [ $# -eq 1 ] && [ "$1" == "-encfs" ]; then + FS=encfs echo "Testing EncFS" encfs --extpass="echo test" --standard $CRYPT $MNT > /dev/null elif [ $# -eq 1 ] && [ "$1" == "-loopback" ]; then + FS=loopback echo "Testing go-fuse loopback" rm -f /tmp/loopback*.memprof loopback -memprofile=/tmp/loopback $MNT $CRYPT & FSPID=$(jobs -p) disown else + FS=gocryptfs echo "Testing gocryptfs" gocryptfs -q -init -extpass="echo test" -scryptn=10 $CRYPT gocryptfs -q -extpass="echo test" -nosyslog -fg $CRYPT $MNT & @@ -75,7 +79,18 @@ 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 / ; rm -Rf $CRYPT ; fuse-unmount -z $MNT || true ; rmdir $MNT" EXIT +trap cleanup_exit EXIT + +function cleanup_exit { + if [[ $FS == loopback ]]; then + # SIGUSR1 causes loopback to write the memory profile to disk + kill -USR1 $FSPID + fi + cd / + rm -Rf $CRYPT + fuse-unmount -z $MNT || true + rmdir $MNT +} function loop { ID=$1 @@ -93,7 +108,7 @@ function loop { # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # Exclude the one symlink in the tarball - causes problems on MacOS: "Can't set permissions to 0755" check_md5sums $MD5 - rm -Rf linux-3.0 + rm -R linux-3.0 t2=$SECONDS delta=$((t2-t1)) if [[ $FSPID -gt 0 && -d /proc ]]; then @@ -114,5 +129,7 @@ function memprof { loop 1 & loop 2 & -#memprof & +if [[ $FS == loopback ]]; then + memprof & +fi wait -- cgit v1.2.3