tests: send SIGUSR1 to loopback

loopback needs to receive SIGUSR1 to write a memory profile.
This commit is contained in:
Jakob Unterwurzacher 2019-11-03 20:02:46 +01:00
parent 6c91f697e1
commit 74b723d765
1 changed files with 20 additions and 3 deletions

View File

@ -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