2016-05-05 12:58:44 +02:00
|
|
|
#!/bin/bash
|
2016-05-24 21:08:13 +02:00
|
|
|
#
|
|
|
|
# Mount a gocryptfs filesystem somewhere on /tmp, then run two parallel
|
|
|
|
# infinite loops inside that do the following:
|
|
|
|
# 1) Extract linux-3.0.tar.gz
|
|
|
|
# 2) Verify the md5sums
|
|
|
|
# 3) Delete, go to (1)
|
|
|
|
#
|
|
|
|
# This test is good at discovering inode-related memory leaks because it creates
|
|
|
|
# huge numbers of files.
|
2016-05-05 12:58:44 +02:00
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2016-05-24 21:08:13 +02:00
|
|
|
cd "$(dirname "$0")"
|
2016-06-07 23:36:35 +02:00
|
|
|
MD5="$PWD/linux-3.0.md5sums"
|
2016-05-24 21:08:13 +02:00
|
|
|
|
2016-07-11 22:10:41 +02:00
|
|
|
# Setup dirs
|
2016-05-05 12:58:44 +02:00
|
|
|
cd /tmp
|
|
|
|
wget -nv --show-progress -c https://www.kernel.org/pub/linux/kernel/v3.0/linux-3.0.tar.gz
|
2016-07-12 08:30:29 +02:00
|
|
|
DIR1=$(mktemp -d /tmp/extractloop.XXX)
|
|
|
|
DIR2=$DIR1.mnt
|
|
|
|
mkdir $DIR2
|
2016-07-11 22:10:41 +02:00
|
|
|
|
|
|
|
# Mount
|
|
|
|
if [ $# -eq 1 ] && [ "$1" == "-encfs" ]; then
|
|
|
|
echo "Testing EncFS"
|
|
|
|
encfs --extpass="echo test" --standard $DIR1 $DIR2 > /dev/null
|
2016-07-12 08:30:29 +02:00
|
|
|
elif [ $# -eq 1 ] && [ "$1" == "-loopback" ]; then
|
|
|
|
echo "Testing go-fuse loopback"
|
|
|
|
loopback -l $DIR2 $DIR1 &
|
|
|
|
sleep 1
|
2016-07-11 22:10:41 +02:00
|
|
|
else
|
|
|
|
gocryptfs -q -init -extpass="echo test" -scryptn=10 $DIR1
|
|
|
|
gocryptfs -q -extpass="echo test" $DIR1 $DIR2
|
2016-07-12 08:30:29 +02:00
|
|
|
#gocryptfs -q -extpass="echo test" -nosyslog -memprofile /tmp/extractloop-mem $DIR1 $DIR2
|
2016-07-11 22:10:41 +02:00
|
|
|
fi
|
2016-05-05 12:58:44 +02:00
|
|
|
cd $DIR2
|
|
|
|
|
|
|
|
# Cleanup trap
|
|
|
|
# Note: gocryptfs may have already umounted itself because bash relays SIGINT
|
|
|
|
# Just ignore fusermount errors.
|
|
|
|
trap "cd /; fusermount -u -z $DIR2; rm -rf $DIR1 $DIR2" EXIT
|
|
|
|
|
2016-05-05 14:17:05 +02:00
|
|
|
function loop {
|
2016-05-24 21:08:13 +02:00
|
|
|
# Note: In a subshell, $$ returns the PID of the *parent* shell,
|
|
|
|
# we need our own, which is why we have to use $BASHPID.
|
2016-05-05 14:17:05 +02:00
|
|
|
mkdir $BASHPID
|
|
|
|
cd $BASHPID
|
|
|
|
|
2016-05-24 21:08:13 +02:00
|
|
|
echo "[pid $BASHPID] Starting loop"
|
|
|
|
|
2016-05-05 14:17:05 +02:00
|
|
|
N=1
|
|
|
|
while true
|
|
|
|
do
|
2016-05-24 21:22:02 +02:00
|
|
|
t1=$SECONDS
|
2016-05-05 14:17:05 +02:00
|
|
|
tar xf /tmp/linux-3.0.tar.gz
|
2016-05-24 21:08:13 +02:00
|
|
|
md5sum --status -c $MD5
|
2016-05-05 14:17:05 +02:00
|
|
|
rm -Rf linux-3.0
|
2016-05-24 21:22:02 +02:00
|
|
|
t2=$SECONDS
|
2016-05-24 21:08:13 +02:00
|
|
|
delta=$((t2-t1))
|
|
|
|
echo "[pid $BASHPID] Iteration $N done, $delta seconds"
|
2016-05-05 14:17:05 +02:00
|
|
|
let N=$N+1
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
loop &
|
|
|
|
loop &
|
|
|
|
wait
|