Add test scripts

This commit is contained in:
Quentin Dufour 2019-03-11 15:41:42 +01:00
parent 5a3a367704
commit a6cc0f778e
4 changed files with 67 additions and 0 deletions

View file

@ -18,6 +18,9 @@ ENV HOME /home/donar
COPY --from=builder /home/donar-build/out/donar /usr/local/bin COPY --from=builder /home/donar-build/out/donar /usr/local/bin
COPY --from=builder /home/donar-build/out/measlat /usr/local/bin COPY --from=builder /home/donar-build/out/measlat /usr/local/bin
COPY --from=builder /home/donar-build/out/udpecho /usr/local/bin COPY --from=builder /home/donar-build/out/udpecho /usr/local/bin
COPY --from=builder /home/donar-build/out/torecho /usr/local/bin
COPY --from=builder /home/donar-build/scripts/xp1-client /usr/local/bin COPY --from=builder /home/donar-build/scripts/xp1-client /usr/local/bin
COPY --from=builder /home/donar-build/scripts/xp1-server /usr/local/bin COPY --from=builder /home/donar-build/scripts/xp1-server /usr/local/bin
COPY --from=builder /home/donar-build/scripts/xp2-client /usr/local/bin
COPY --from=builder /home/donar-build/scripts/xp2-server /usr/local/bin
COPY ./torrc_simple /etc/torrc COPY ./torrc_simple /etc/torrc

49
scripts/xp2 Executable file
View file

@ -0,0 +1,49 @@
#!/bin/bash
# Create workdir
XP_FOLDER=`mktemp -d -p . xp2-XXXXXXXXXXXXXXXX`
XP_ID=`echo $XP_FOLDER|cut -c 3-`
cd $XP_FOLDER
COUNT=$1
INTERVAL=$2
SIZE=$3
ALLOWED_BOOTSTRAP=190
ALLOWED_TIME=`expr $(expr ${COUNT} * ${INTERVAL}) / 1000 + ${ALLOWED_BOOTSTRAP}`
echo "Will run for ${ALLOWED_TIME} (count=$1, interval=$2)"
# Create folders
docker run \
--rm \
-ti \
-v `pwd`:/mnt \
ubuntu \
bash -c "cd /mnt; mkdir -p ./{shared,log,res}; chown -R 1000 ./{shared,log,res}"
# Run server
docker run \
--privileged \
--rm \
--name "$XP_ID-server" \
-v `pwd`/shared:/home/donar/shared \
-v `pwd`/log:/home/donar/log \
registry.gitlab.inria.fr/qdufour/donar \
xp2-server &
sleep 10
# Run client
docker run \
--privileged \
--rm \
--name "$XP_ID-client" \
-v `pwd`/res:/home/donar/res \
-v `pwd`/shared:/home/donar/shared \
-v `pwd`/log:/home/donar/log \
registry.gitlab.inria.fr/qdufour/donar \
xp2-client $COUNT $INTERVAL $SIZE &
sleep $ALLOWED_TIME
# Kill
docker kill "$XP_ID-client" || true
docker kill "$XP_ID-server" || true

8
scripts/xp2-client Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
mkdir -p ./log
tor -f /etc/torrc > ./log/client-tor-stdout.log 2> ./log/client-tor-stderr.log &
sleep 2
mkdir -p ./shared
HS="`cat ./shared/onion_services.pub | head -n1`.onion"
measlat -h $HS -p 7500 -t tcp > /dev/null 2>&1 # Used to wait for connections
measlat -h $HS -p 7500 -c $1 -i $2 -s $3 > ./res/xp2.csv 2> ./log/client-measlat-stderr.log

7
scripts/xp2-server Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
mkdir -p ./log
tor -f /etc/torrc > ./log/server-tor-stdout.log 2> ./log/server-tor-stderr.log &
sleep 2
mkdir -p ./shared
cd ./shared
torecho > ../log/server-udpecho-stdout.log 2> ../log/server-udpecho-stderr.log