From: Razvan Deaconescu Date: Tue, 16 Nov 2010 00:09:23 +0000 (+0200) Subject: test-signal-socket: new version of eurocon scripts X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=976c6c50bc45c87f7fef1636adf459754728063b;p=p2p-testing-infrastructure.git test-signal-socket: new version of eurocon scripts --- diff --git a/Utils/test-socket-signal/test/eurocon/all_install b/Utils/test-socket-signal/test/eurocon/all_install new file mode 100755 index 0000000..9d22c11 --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/all_install @@ -0,0 +1,7 @@ +#!/bin/bash + +IFS=',' + +while read host port; do + ssh -n -f -l root $host -p $port "/home/p2p/eurocon/local_install" +done < all-cts diff --git a/Utils/test-socket-signal/test/eurocon/all_run_if b/Utils/test-socket-signal/test/eurocon/all_run_if new file mode 100755 index 0000000..86d9e2f --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/all_run_if @@ -0,0 +1,16 @@ +#!/bin/bash + +if test $# -ne 5; then + echo "Usage: $0 host1 port1 host2 port2 id" 1>&2 + exit 1 +fi + +host1=$1 +port1=$2 +host2=$3 +port2=$4 +ID=$5 + +for ts in 4 8 16 32 64 128 256 512; do + ./remote_run_if $host1 $port1 $host2 $port2 $ts $ID +done diff --git a/Utils/test-socket-signal/test/eurocon/all_run_stop b/Utils/test-socket-signal/test/eurocon/all_run_stop new file mode 100755 index 0000000..2c5968e --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/all_run_stop @@ -0,0 +1,16 @@ +#!/bin/bash + +if test $# -ne 5; then + echo "Usage: $0 host1 port1 host2 port2 id" 1>&2 + exit 1 +fi + +host1=$1 +port1=$2 +host2=$3 +port2=$4 +ID=$5 + +for ts in 4 8 16 32 64 128 256 512; do + ./remote_run_stop $host1 $port1 $host2 $port2 $ts $ID +done diff --git a/Utils/test-socket-signal/test/eurocon/all_run_suspend b/Utils/test-socket-signal/test/eurocon/all_run_suspend new file mode 100755 index 0000000..b71c5b8 --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/all_run_suspend @@ -0,0 +1,16 @@ +#!/bin/bash + +if test $# -ne 5; then + echo "Usage: $0 host1 port1 host2 port2 id" 1>&2 + exit 1 +fi + +host1=$1 +port1=$2 +host2=$3 +port2=$4 +ID=$5 + +for ts in 4 8 16 32 64 128 256 512; do + ./remote_run_suspend $host1 $port1 $host2 $port2 $ts $ID +done diff --git a/Utils/test-socket-signal/test/eurocon/local_create_torrent b/Utils/test-socket-signal/test/eurocon/local_create_torrent index e74d5cc..8fabbb9 100755 --- a/Utils/test-socket-signal/test/eurocon/local_create_torrent +++ b/Utils/test-socket-signal/test/eurocon/local_create_torrent @@ -1,7 +1,12 @@ #!/bin/bash -addr=$(ip a s eth0 | grep 'inet ' | awk -F '[/ \t]+' '{print $3;}') +if test $# -ne 1; then + echo "Usage: $0 ip-address" 1>&2 + exit 1 +fi + +addr=$1 cd /home/p2p/eurocon/ -btmakemetafile http://$addr/announce /home/p2p/eurocon/Data.100M.bin +btmakemetafile http://$addr:6969/announce /home/p2p/eurocon/Data.100M.bin diff --git a/Utils/test-socket-signal/test/eurocon/local_get_ip b/Utils/test-socket-signal/test/eurocon/local_get_ip new file mode 100755 index 0000000..d71aa1a --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/local_get_ip @@ -0,0 +1,3 @@ +#!/bin/bash + +ip a s eth0 | grep 'inet ' | awk -F '[/ \t]+' '{print $3;}' diff --git a/Utils/test-socket-signal/test/eurocon/local_install b/Utils/test-socket-signal/test/eurocon/local_install new file mode 100755 index 0000000..53121bb --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/local_install @@ -0,0 +1,3 @@ +#!/bin/bash + +apt-get install -y bittornado diff --git a/Utils/test-socket-signal/test/eurocon/local_run_tracker b/Utils/test-socket-signal/test/eurocon/local_run_tracker index fac21bf..2d2a76b 100755 --- a/Utils/test-socket-signal/test/eurocon/local_run_tracker +++ b/Utils/test-socket-signal/test/eurocon/local_run_tracker @@ -1,3 +1,3 @@ #!/bin/bash -nohup bttrack --port 6969 --dfile track.file > track.log 2>&1 & +nohup bttrack --port 6969 --dfile track.file >> track.log 2>&1 & diff --git a/Utils/test-socket-signal/test/eurocon/local_start_leecher b/Utils/test-socket-signal/test/eurocon/local_start_leecher index aa9b7f2..bfdf560 100755 --- a/Utils/test-socket-signal/test/eurocon/local_start_leecher +++ b/Utils/test-socket-signal/test/eurocon/local_start_leecher @@ -2,4 +2,4 @@ cd /tmp/ -LD_LIBRARY_PATH=/home/p2p/p2p-clients/hrktorrent/libtorrent-rasterbar/lib/ /home/p2p/cs-p2p-next/instrumentation/hrktorrent/hrktorrent --nodht --limitlocal --noupnp --maxconnections 1 --maxdown 100 /home/p2p/eurocon/Data.100M.ct.torrent +LD_LIBRARY_PATH=/home/p2p/p2p-clients/hrktorrent/libtorrent-rasterbar/lib/ /home/p2p/cs-p2p-next/instrumentation/hrktorrent/hrktorrent --nodht --limitlocal --noupnp --maxconnections 1 --maxdown 100 /home/p2p/eurocon/Data.100M.bin.torrent >> /home/p2p/eurocon/hrk.log 2>&1 diff --git a/Utils/test-socket-signal/test/eurocon/local_start_seeder b/Utils/test-socket-signal/test/eurocon/local_start_seeder index d9ff445..044bb5e 100755 --- a/Utils/test-socket-signal/test/eurocon/local_start_seeder +++ b/Utils/test-socket-signal/test/eurocon/local_start_seeder @@ -2,4 +2,4 @@ cd /home/p2p/eurocon/ -LD_LIBRARY_PATH=/home/p2p/p2p-clients/hrktorrent/libtorrent-rasterbar/lib/ /home/p2p/cs-p2p-next/instrumentation/hrktorrent/hrktorrent --nodht --limitlocal --noupnp --maxconnections 1 --maxdown 100 /home/p2p/Data.100M.bin +LD_LIBRARY_PATH=/home/p2p/p2p-clients/hrktorrent/libtorrent-rasterbar/lib/ /home/p2p/cs-p2p-next/instrumentation/hrktorrent/hrktorrent --nodht --limitlocal --noupnp --maxconnections 1 --maxdown 100 /home/p2p/eurocon/Data.100M.bin.torrent >> /home/p2p/eurocon/hrk.log 2>&1 diff --git a/Utils/test-socket-signal/test/eurocon/remote_run_if b/Utils/test-socket-signal/test/eurocon/remote_run_if index 55523e3..09ef9e6 100755 --- a/Utils/test-socket-signal/test/eurocon/remote_run_if +++ b/Utils/test-socket-signal/test/eurocon/remote_run_if @@ -16,21 +16,22 @@ _id=$6 ssh -n -f -p $port1 -l root $host1 "/home/p2p/eurocon/local_clean" ssh -n -f -p $port2 -l root $host2 "/home/p2p/eurocon/local_clean" +ip=$(ssh -n -f -p $port1 -l root $host1 "/home/p2p/eurocon/local_get_ip") + # make torrent file -ssh -n -f -p $port1 -l p2p $host1 "/home/p2p/eurocon/local_create_torrent" -ssh -n -f -p $port2 -l p2p $host2 "/home/p2p/eurocon/local_create_torrent" +ssh -n -f -p $port1 -l p2p $host1 "/home/p2p/eurocon/local_create_torrent $ip" +ssh -n -f -p $port2 -l p2p $host2 "/home/p2p/eurocon/local_create_torrent $ip" # start tracker ssh -n -f -p $port1 -l p2p $host1 "/home/p2p/eurocon/local_run_tracker" -ssh -n -f -p $port2 -l p2p $host2 "/home/p2p/eurocon/local_run_tracker" sleep 5 # start seeder -ssh -n -f -p $port1 -l p2p $host1 "/home/p2p/eurocon/local_client_seeder" +ssh -n -f -p $port1 -l p2p $host1 "/home/p2p/eurocon/local_start_seeder" # start leecher -ssh -n -f -p $port2 -l p2p $host2 "/home/p2p/eurocon/local_client_leecher" +ssh -n -f -p $port2 -l p2p $host2 "/home/p2p/eurocon/local_start_leecher" # wait for it sleep 15 @@ -46,6 +47,14 @@ ssh -n -f -p $port2 -l root $host2 "/home/p2p/eurocon/local_ifup" sleep 45 +# cleanup +ssh -n -f -p $port1 -l root $host1 "/home/p2p/eurocon/local_clean" +ssh -n -f -p $port2 -l root $host2 "/home/p2p/eurocon/local_clean" + # sync back -rsync -avz -e "ssh -p $port1" p2p@$host1:/home/p2p/eurocon/hrk.log $host1-$id-seeder.log -rsync -avz -e "ssh -p $port2" p2p@$host2:/home/p2p/eurocon/hrk.log $host2-$id-leecher.log +rsync -avz -e "ssh -p $port1" p2p@$host1:/home/p2p/eurocon/hrk.log ../eurocon-log/$host1-$port1-$id-$timeout-seeder.log +rsync -avz -e "ssh -p $port2" p2p@$host2:/home/p2p/eurocon/hrk.log ../eurocon-log/$host2-$port2-$id-$timeout-leecher.log + +# backup logs +ssh -n -f -p $port1 -l p2p $host1 "mv /home/p2p/eurocon/hrk.log hrk-$(date +%s).log" +ssh -n -f -p $port2 -l p2p $host2 "mv /home/p2p/eurocon/hrk.log hrk-$(date +%s).log" diff --git a/Utils/test-socket-signal/test/eurocon/remote_run_stop b/Utils/test-socket-signal/test/eurocon/remote_run_stop index 6eaf8fb..1606c90 100755 --- a/Utils/test-socket-signal/test/eurocon/remote_run_stop +++ b/Utils/test-socket-signal/test/eurocon/remote_run_stop @@ -1,6 +1,60 @@ #!/bin/bash -if test $# -ne 4; then - echo "Usage: $0 host1 port1 host2 port2" 1>&2 +if test $# -ne 6; then + echo "Usage: $0 host1 port1 host2 port2 timeout id" 1>&2 exit 1 fi + +host1=$1 +port1=$2 +host2=$3 +port2=$4 +timeout=$5 +_id=$6 + +# cleanup +ssh -n -f -p $port1 -l root $host1 "/home/p2p/eurocon/local_clean" +ssh -n -f -p $port2 -l root $host2 "/home/p2p/eurocon/local_clean" + +ip=$(ssh -n -f -p $port1 -l root $host1 "/home/p2p/eurocon/local_get_ip") + +# make torrent file +ssh -n -f -p $port1 -l p2p $host1 "/home/p2p/eurocon/local_create_torrent $ip" +ssh -n -f -p $port2 -l p2p $host2 "/home/p2p/eurocon/local_create_torrent $ip" + +# start tracker +ssh -n -f -p $port1 -l p2p $host1 "/home/p2p/eurocon/local_run_tracker" + +sleep 5 + +# start seeder +ssh -n -f -p $port1 -l p2p $host1 "/home/p2p/eurocon/local_start_seeder" + +# start leecher +ssh -n -f -p $port2 -l p2p $host2 "/home/p2p/eurocon/local_start_leecher" + +# wait for it +sleep 15 + +# put leecher down +ssh -n -f -p $port2 -l root $host2 "/home/p2p/eurocon/local_kill_client" + +# sleep as planned +sleep $timeout + +# restart client +ssh -n -f -p $port2 -l root $host2 "/home/p2p/eurocon/local_start_leecher" + +sleep 45 + +# cleanup +ssh -n -f -p $port1 -l root $host1 "/home/p2p/eurocon/local_clean" +ssh -n -f -p $port2 -l root $host2 "/home/p2p/eurocon/local_clean" + +# sync back +rsync -avz -e "ssh -p $port1" p2p@$host1:/home/p2p/eurocon/hrk.log ../eurocon-log/$host1-$port1-$id-$timeout-seeder.log +rsync -avz -e "ssh -p $port2" p2p@$host2:/home/p2p/eurocon/hrk.log ../eurocon-log/$host2-$port2-$id-$timeout-leecher.log + +# backup logs +ssh -n -f -p $port1 -l p2p $host1 "mv /home/p2p/eurocon/hrk.log hrk-$(date +%s).log" +ssh -n -f -p $port2 -l p2p $host2 "mv /home/p2p/eurocon/hrk.log hrk-$(date +%s).log" diff --git a/Utils/test-socket-signal/test/eurocon/remote_run_suspend b/Utils/test-socket-signal/test/eurocon/remote_run_suspend index 6eaf8fb..5bda131 100755 --- a/Utils/test-socket-signal/test/eurocon/remote_run_suspend +++ b/Utils/test-socket-signal/test/eurocon/remote_run_suspend @@ -1,6 +1,60 @@ #!/bin/bash -if test $# -ne 4; then - echo "Usage: $0 host1 port1 host2 port2" 1>&2 +if test $# -ne 6; then + echo "Usage: $0 host1 port1 host2 port2 timeout id" 1>&2 exit 1 fi + +host1=$1 +port1=$2 +host2=$3 +port2=$4 +timeout=$5 +_id=$6 + +# cleanup +ssh -n -f -p $port1 -l root $host1 "/home/p2p/eurocon/local_clean" +ssh -n -f -p $port2 -l root $host2 "/home/p2p/eurocon/local_clean" + +ip=$(ssh -n -f -p $port1 -l root $host1 "/home/p2p/eurocon/local_get_ip") + +# make torrent file +ssh -n -f -p $port1 -l p2p $host1 "/home/p2p/eurocon/local_create_torrent $ip" +ssh -n -f -p $port2 -l p2p $host2 "/home/p2p/eurocon/local_create_torrent $ip" + +# start tracker +ssh -n -f -p $port1 -l p2p $host1 "/home/p2p/eurocon/local_run_tracker" + +sleep 5 + +# start seeder +ssh -n -f -p $port1 -l p2p $host1 "/home/p2p/eurocon/local_start_seeder" + +# start leecher +ssh -n -f -p $port2 -l p2p $host2 "/home/p2p/eurocon/local_start_leecher" + +# wait for it +sleep 15 + +# suspend leecher +ssh -n -f -p $port2 -l root $host2 "/home/p2p/eurocon/local_suspend_client" + +# sleep as planned +sleep $timeout + +# resume leecher +ssh -n -f -p $port2 -l root $host2 "/home/p2p/eurocon/local_cont_client" + +sleep 45 + +# cleanup +ssh -n -f -p $port1 -l root $host1 "/home/p2p/eurocon/local_clean" +ssh -n -f -p $port2 -l root $host2 "/home/p2p/eurocon/local_clean" + +# sync back +rsync -avz -e "ssh -p $port1" p2p@$host1:/home/p2p/eurocon/hrk.log ../eurocon-log/$host1-$port1-$id-$timeout-seeder.log +rsync -avz -e "ssh -p $port2" p2p@$host2:/home/p2p/eurocon/hrk.log ../eurocon-log/$host2-$port2-$id-$timeout-leecher.log + +# backup logs +ssh -n -f -p $port1 -l p2p $host1 "mv /home/p2p/eurocon/hrk.log hrk-$(date +%s).log" +ssh -n -f -p $port2 -l p2p $host2 "mv /home/p2p/eurocon/hrk.log hrk-$(date +%s).log" diff --git a/Utils/test-socket-signal/test/eurocon/super_run_if b/Utils/test-socket-signal/test/eurocon/super_run_if new file mode 100755 index 0000000..d4dbb61 --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/super_run_if @@ -0,0 +1,10 @@ +#!/bin/bash + +ID=1 + +IFS=',' + +while read host1 port1 host2 port2; do + echo "bla" + xterm -e /bin/bash -l -c "cd /home/razvan/projects/p2p-next/P2P-Testing-Infrastructure/Utils/test-socket-signal/test/eurocon && ./all_run_if $host1 $port1 $host2 $port2 $ID" & +done < pairs-if diff --git a/Utils/test-socket-signal/test/eurocon/super_run_stop b/Utils/test-socket-signal/test/eurocon/super_run_stop new file mode 100755 index 0000000..7b9fbe1 --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/super_run_stop @@ -0,0 +1,10 @@ +#!/bin/bash + +ID=1 + +IFS=',' + +while read host1 port1 host2 port2; do + echo "bla" + xterm -e /bin/bash -l -c "cd /home/razvan/projects/p2p-next/P2P-Testing-Infrastructure/Utils/test-socket-signal/test/eurocon && ./all_run_stop $host1 $port1 $host2 $port2 $ID" & +done < pairs-stop diff --git a/Utils/test-socket-signal/test/eurocon/super_run_suspend b/Utils/test-socket-signal/test/eurocon/super_run_suspend new file mode 100755 index 0000000..ff8234b --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/super_run_suspend @@ -0,0 +1,9 @@ +#!/bin/bash + +ID=1 + +IFS=',' + +while read host1 port1 host2 port2; do + xterm -e /bin/bash -l -c "cd /home/razvan/projects/p2p-next/P2P-Testing-Infrastructure/Utils/test-socket-signal/test/eurocon && ./all_run_suspend $host1 $port1 $host2 $port2 $ID" & +done < pairs-suspend