From 00f7bd5cfbc15eaf30540e87e4f9f67d38a4a7cc Mon Sep 17 00:00:00 2001 From: Razvan Deaconescu Date: Tue, 16 Nov 2010 00:04:49 +0200 Subject: [PATCH] test-socket-signal: add eurocon test suite --- .../test/eurocon/.gitignore | 1 + Utils/test-socket-signal/test/eurocon/all-cts | 90 +++++++++++++++++++ .../test/eurocon/all_ct_rsync | 7 ++ .../test-socket-signal/test/eurocon/ct_rsync | 11 +++ .../test/eurocon/local_clean | 4 + .../test/eurocon/local_cont_client | 3 + .../test/eurocon/local_create_torrent | 7 ++ .../test/eurocon/local_ifdown | 3 + .../test/eurocon/local_ifup | 3 + .../test/eurocon/local_kill_client | 3 + .../test/eurocon/local_run_tracker | 3 + .../test/eurocon/local_start_leecher | 5 ++ .../test/eurocon/local_start_seeder | 5 ++ .../test/eurocon/local_suspend_client | 3 + .../test/eurocon/pairs-ifdown | 13 +++ .../test/eurocon/pairs-stop | 13 +++ .../test/eurocon/pairs-suspend | 13 +++ .../test/eurocon/remote_run_if | 51 +++++++++++ .../test/eurocon/remote_run_stop | 6 ++ .../test/eurocon/remote_run_suspend | 6 ++ 20 files changed, 250 insertions(+) create mode 100644 Utils/test-socket-signal/test/eurocon/.gitignore create mode 100644 Utils/test-socket-signal/test/eurocon/all-cts create mode 100755 Utils/test-socket-signal/test/eurocon/all_ct_rsync create mode 100755 Utils/test-socket-signal/test/eurocon/ct_rsync create mode 100755 Utils/test-socket-signal/test/eurocon/local_clean create mode 100755 Utils/test-socket-signal/test/eurocon/local_cont_client create mode 100755 Utils/test-socket-signal/test/eurocon/local_create_torrent create mode 100755 Utils/test-socket-signal/test/eurocon/local_ifdown create mode 100755 Utils/test-socket-signal/test/eurocon/local_ifup create mode 100755 Utils/test-socket-signal/test/eurocon/local_kill_client create mode 100755 Utils/test-socket-signal/test/eurocon/local_run_tracker create mode 100755 Utils/test-socket-signal/test/eurocon/local_start_leecher create mode 100755 Utils/test-socket-signal/test/eurocon/local_start_seeder create mode 100755 Utils/test-socket-signal/test/eurocon/local_suspend_client create mode 100644 Utils/test-socket-signal/test/eurocon/pairs-ifdown create mode 100644 Utils/test-socket-signal/test/eurocon/pairs-stop create mode 100644 Utils/test-socket-signal/test/eurocon/pairs-suspend create mode 100755 Utils/test-socket-signal/test/eurocon/remote_run_if create mode 100755 Utils/test-socket-signal/test/eurocon/remote_run_stop create mode 100755 Utils/test-socket-signal/test/eurocon/remote_run_suspend diff --git a/Utils/test-socket-signal/test/eurocon/.gitignore b/Utils/test-socket-signal/test/eurocon/.gitignore new file mode 100644 index 0000000..a8a0dce --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/.gitignore @@ -0,0 +1 @@ +*.bin diff --git a/Utils/test-socket-signal/test/eurocon/all-cts b/Utils/test-socket-signal/test/eurocon/all-cts new file mode 100644 index 0000000..4107171 --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/all-cts @@ -0,0 +1,90 @@ +p2p-next-01.grid.pub.ro,10122 +p2p-next-01.grid.pub.ro,10222 +p2p-next-01.grid.pub.ro,10322 +p2p-next-01.grid.pub.ro,10422 +p2p-next-01.grid.pub.ro,10522 +p2p-next-01.grid.pub.ro,10622 +p2p-next-01.grid.pub.ro,10722 +p2p-next-01.grid.pub.ro,10822 +p2p-next-01.grid.pub.ro,10922 +p2p-next-01.grid.pub.ro,11022 +p2p-next-03.grid.pub.ro,10122 +p2p-next-03.grid.pub.ro,10222 +p2p-next-03.grid.pub.ro,10322 +p2p-next-03.grid.pub.ro,10422 +p2p-next-03.grid.pub.ro,10522 +p2p-next-03.grid.pub.ro,10622 +p2p-next-03.grid.pub.ro,10722 +p2p-next-03.grid.pub.ro,10822 +p2p-next-03.grid.pub.ro,10922 +p2p-next-03.grid.pub.ro,11022 +p2p-next-04.grid.pub.ro,10122 +p2p-next-04.grid.pub.ro,10222 +p2p-next-04.grid.pub.ro,10322 +p2p-next-04.grid.pub.ro,10422 +p2p-next-04.grid.pub.ro,10522 +p2p-next-04.grid.pub.ro,10622 +p2p-next-04.grid.pub.ro,10722 +p2p-next-04.grid.pub.ro,10822 +p2p-next-04.grid.pub.ro,10922 +p2p-next-04.grid.pub.ro,11022 +p2p-next-05.grid.pub.ro,10122 +p2p-next-05.grid.pub.ro,10222 +p2p-next-05.grid.pub.ro,10322 +p2p-next-05.grid.pub.ro,10422 +p2p-next-05.grid.pub.ro,10522 +p2p-next-05.grid.pub.ro,10622 +p2p-next-05.grid.pub.ro,10722 +p2p-next-05.grid.pub.ro,10822 +p2p-next-05.grid.pub.ro,10922 +p2p-next-05.grid.pub.ro,11022 +p2p-next-06.grid.pub.ro,10122 +p2p-next-06.grid.pub.ro,10222 +p2p-next-06.grid.pub.ro,10322 +p2p-next-06.grid.pub.ro,10422 +p2p-next-06.grid.pub.ro,10522 +p2p-next-06.grid.pub.ro,10622 +p2p-next-06.grid.pub.ro,10722 +p2p-next-06.grid.pub.ro,10822 +p2p-next-06.grid.pub.ro,10922 +p2p-next-06.grid.pub.ro,11022 +p2p-next-07.grid.pub.ro,10122 +p2p-next-07.grid.pub.ro,10222 +p2p-next-07.grid.pub.ro,10322 +p2p-next-07.grid.pub.ro,10422 +p2p-next-07.grid.pub.ro,10522 +p2p-next-07.grid.pub.ro,10622 +p2p-next-07.grid.pub.ro,10722 +p2p-next-07.grid.pub.ro,10822 +p2p-next-07.grid.pub.ro,10922 +p2p-next-07.grid.pub.ro,11022 +p2p-next-08.grid.pub.ro,10122 +p2p-next-08.grid.pub.ro,10222 +p2p-next-08.grid.pub.ro,10322 +p2p-next-08.grid.pub.ro,10422 +p2p-next-08.grid.pub.ro,10522 +p2p-next-08.grid.pub.ro,10622 +p2p-next-08.grid.pub.ro,10722 +p2p-next-08.grid.pub.ro,10822 +p2p-next-08.grid.pub.ro,10922 +p2p-next-08.grid.pub.ro,11022 +p2p-next-09.grid.pub.ro,10122 +p2p-next-09.grid.pub.ro,10222 +p2p-next-09.grid.pub.ro,10322 +p2p-next-09.grid.pub.ro,10422 +p2p-next-09.grid.pub.ro,10522 +p2p-next-09.grid.pub.ro,10622 +p2p-next-09.grid.pub.ro,10722 +p2p-next-09.grid.pub.ro,10822 +p2p-next-09.grid.pub.ro,10922 +p2p-next-09.grid.pub.ro,11022 +p2p-next-10.grid.pub.ro,10122 +p2p-next-10.grid.pub.ro,10222 +p2p-next-10.grid.pub.ro,10322 +p2p-next-10.grid.pub.ro,10422 +p2p-next-10.grid.pub.ro,10522 +p2p-next-10.grid.pub.ro,10622 +p2p-next-10.grid.pub.ro,10722 +p2p-next-10.grid.pub.ro,10822 +p2p-next-10.grid.pub.ro,10922 +p2p-next-10.grid.pub.ro,11022 diff --git a/Utils/test-socket-signal/test/eurocon/all_ct_rsync b/Utils/test-socket-signal/test/eurocon/all_ct_rsync new file mode 100755 index 0000000..312dd56 --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/all_ct_rsync @@ -0,0 +1,7 @@ +#!/bin/bash + +IFS=',' + +while read host port; do + ./ct_rsync $host $port +done < all-cts diff --git a/Utils/test-socket-signal/test/eurocon/ct_rsync b/Utils/test-socket-signal/test/eurocon/ct_rsync new file mode 100755 index 0000000..56beebb --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/ct_rsync @@ -0,0 +1,11 @@ +#!/bin/bash + +if test $# -ne 2; then + echo "Usage: $0 hostname port" 1>&2 + exit 1 +fi + +host=$1 +port=$2 + +rsync -avz -e "ssh -p $port" ../eurocon p2p@$host: diff --git a/Utils/test-socket-signal/test/eurocon/local_clean b/Utils/test-socket-signal/test/eurocon/local_clean new file mode 100755 index 0000000..0e5a6a1 --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/local_clean @@ -0,0 +1,4 @@ +#!/bin/bash + +pkill -f bttrack +pkill -f hrktorrent diff --git a/Utils/test-socket-signal/test/eurocon/local_cont_client b/Utils/test-socket-signal/test/eurocon/local_cont_client new file mode 100755 index 0000000..d352157 --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/local_cont_client @@ -0,0 +1,3 @@ +#!/bin/bash + +kill -CONT $(pgrep hrktorrent) diff --git a/Utils/test-socket-signal/test/eurocon/local_create_torrent b/Utils/test-socket-signal/test/eurocon/local_create_torrent new file mode 100755 index 0000000..e74d5cc --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/local_create_torrent @@ -0,0 +1,7 @@ +#!/bin/bash + +addr=$(ip a s eth0 | grep 'inet ' | awk -F '[/ \t]+' '{print $3;}') + +cd /home/p2p/eurocon/ + +btmakemetafile http://$addr/announce /home/p2p/eurocon/Data.100M.bin diff --git a/Utils/test-socket-signal/test/eurocon/local_ifdown b/Utils/test-socket-signal/test/eurocon/local_ifdown new file mode 100755 index 0000000..06e9010 --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/local_ifdown @@ -0,0 +1,3 @@ +#!/bin/bash + +ip l s dev eth0 down diff --git a/Utils/test-socket-signal/test/eurocon/local_ifup b/Utils/test-socket-signal/test/eurocon/local_ifup new file mode 100755 index 0000000..fda32aa --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/local_ifup @@ -0,0 +1,3 @@ +#!/bin/bash + +ip l s dev eth0 up diff --git a/Utils/test-socket-signal/test/eurocon/local_kill_client b/Utils/test-socket-signal/test/eurocon/local_kill_client new file mode 100755 index 0000000..a8da362 --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/local_kill_client @@ -0,0 +1,3 @@ +#!/bin/bash + +kill -KILL $(pgrep hrktorrent) diff --git a/Utils/test-socket-signal/test/eurocon/local_run_tracker b/Utils/test-socket-signal/test/eurocon/local_run_tracker new file mode 100755 index 0000000..fac21bf --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/local_run_tracker @@ -0,0 +1,3 @@ +#!/bin/bash + +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 new file mode 100755 index 0000000..aa9b7f2 --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/local_start_leecher @@ -0,0 +1,5 @@ +#!/bin/bash + +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 diff --git a/Utils/test-socket-signal/test/eurocon/local_start_seeder b/Utils/test-socket-signal/test/eurocon/local_start_seeder new file mode 100755 index 0000000..d9ff445 --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/local_start_seeder @@ -0,0 +1,5 @@ +#!/bin/bash + +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 diff --git a/Utils/test-socket-signal/test/eurocon/local_suspend_client b/Utils/test-socket-signal/test/eurocon/local_suspend_client new file mode 100755 index 0000000..3196d58 --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/local_suspend_client @@ -0,0 +1,3 @@ +#!/bin/bash + +kill -STOP $(pgrep hrktorrent) diff --git a/Utils/test-socket-signal/test/eurocon/pairs-ifdown b/Utils/test-socket-signal/test/eurocon/pairs-ifdown new file mode 100644 index 0000000..661a059 --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/pairs-ifdown @@ -0,0 +1,13 @@ +p2p-next-01.grid.pub.ro,10122,p2p-next-03.grid.pub.ro,10122 +p2p-next-01.grid.pub.ro,10222,p2p-next-03.grid.pub.ro,10222 +p2p-next-01.grid.pub.ro,10322,p2p-next-03.grid.pub.ro,10322 +p2p-next-01.grid.pub.ro,10422,p2p-next-03.grid.pub.ro,10422 +p2p-next-01.grid.pub.ro,10522,p2p-next-03.grid.pub.ro,10522 +p2p-next-01.grid.pub.ro,10622,p2p-next-03.grid.pub.ro,10622 +p2p-next-01.grid.pub.ro,10722,p2p-next-03.grid.pub.ro,10722 +p2p-next-01.grid.pub.ro,10822,p2p-next-03.grid.pub.ro,10822 +p2p-next-01.grid.pub.ro,10922,p2p-next-03.grid.pub.ro,10922 +p2p-next-01.grid.pub.ro,11022,p2p-next-03.grid.pub.ro,11022 +p2p-next-08.grid.pub.ro,10122,p2p-next-09.grid.pub.ro,10122 +p2p-next-08.grid.pub.ro,10222,p2p-next-09.grid.pub.ro,10222 +p2p-next-08.grid.pub.ro,10322,p2p-next-09.grid.pub.ro,10322 diff --git a/Utils/test-socket-signal/test/eurocon/pairs-stop b/Utils/test-socket-signal/test/eurocon/pairs-stop new file mode 100644 index 0000000..9521844 --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/pairs-stop @@ -0,0 +1,13 @@ +p2p-next-04.grid.pub.ro,10122,p2p-next-05.grid.pub.ro,10122 +p2p-next-04.grid.pub.ro,10222,p2p-next-05.grid.pub.ro,10222 +p2p-next-04.grid.pub.ro,10322,p2p-next-05.grid.pub.ro,10322 +p2p-next-04.grid.pub.ro,10422,p2p-next-05.grid.pub.ro,10422 +p2p-next-04.grid.pub.ro,10522,p2p-next-05.grid.pub.ro,10522 +p2p-next-04.grid.pub.ro,10622,p2p-next-05.grid.pub.ro,10622 +p2p-next-04.grid.pub.ro,10722,p2p-next-05.grid.pub.ro,10722 +p2p-next-04.grid.pub.ro,10822,p2p-next-05.grid.pub.ro,10822 +p2p-next-04.grid.pub.ro,10922,p2p-next-05.grid.pub.ro,10922 +p2p-next-04.grid.pub.ro,11022,p2p-next-05.grid.pub.ro,11022 +p2p-next-08.grid.pub.ro,10422,p2p-next-09.grid.pub.ro,10422 +p2p-next-08.grid.pub.ro,10522,p2p-next-09.grid.pub.ro,10522 +p2p-next-08.grid.pub.ro,10622,p2p-next-09.grid.pub.ro,10622 diff --git a/Utils/test-socket-signal/test/eurocon/pairs-suspend b/Utils/test-socket-signal/test/eurocon/pairs-suspend new file mode 100644 index 0000000..8aa1199 --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/pairs-suspend @@ -0,0 +1,13 @@ +p2p-next-06.grid.pub.ro,10122,p2p-next-07.grid.pub.ro,10122 +p2p-next-06.grid.pub.ro,10222,p2p-next-07.grid.pub.ro,10222 +p2p-next-06.grid.pub.ro,10322,p2p-next-07.grid.pub.ro,10322 +p2p-next-06.grid.pub.ro,10422,p2p-next-07.grid.pub.ro,10422 +p2p-next-06.grid.pub.ro,10522,p2p-next-07.grid.pub.ro,10522 +p2p-next-06.grid.pub.ro,10622,p2p-next-07.grid.pub.ro,10622 +p2p-next-06.grid.pub.ro,10722,p2p-next-07.grid.pub.ro,10722 +p2p-next-06.grid.pub.ro,10822,p2p-next-07.grid.pub.ro,10822 +p2p-next-06.grid.pub.ro,10922,p2p-next-07.grid.pub.ro,10922 +p2p-next-06.grid.pub.ro,11022,p2p-next-07.grid.pub.ro,11022 +p2p-next-08.grid.pub.ro,10722,p2p-next-09.grid.pub.ro,10722 +p2p-next-08.grid.pub.ro,10822,p2p-next-09.grid.pub.ro,10822 +p2p-next-08.grid.pub.ro,10922,p2p-next-09.grid.pub.ro,10922 diff --git a/Utils/test-socket-signal/test/eurocon/remote_run_if b/Utils/test-socket-signal/test/eurocon/remote_run_if new file mode 100755 index 0000000..55523e3 --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/remote_run_if @@ -0,0 +1,51 @@ +#!/bin/bash + +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" + +# 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" + +# 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" + +# start leecher +ssh -n -f -p $port2 -l p2p $host2 "/home/p2p/eurocon/local_client_leecher" + +# wait for it +sleep 15 + +# put leecher interface down +ssh -n -f -p $port2 -l root $host2 "/home/p2p/eurocon/local_ifdown" + +# sleep as planned +sleep $timeout + +# put interface up +ssh -n -f -p $port2 -l root $host2 "/home/p2p/eurocon/local_ifup" + +sleep 45 + +# 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 diff --git a/Utils/test-socket-signal/test/eurocon/remote_run_stop b/Utils/test-socket-signal/test/eurocon/remote_run_stop new file mode 100755 index 0000000..6eaf8fb --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/remote_run_stop @@ -0,0 +1,6 @@ +#!/bin/bash + +if test $# -ne 4; then + echo "Usage: $0 host1 port1 host2 port2" 1>&2 + exit 1 +fi diff --git a/Utils/test-socket-signal/test/eurocon/remote_run_suspend b/Utils/test-socket-signal/test/eurocon/remote_run_suspend new file mode 100755 index 0000000..6eaf8fb --- /dev/null +++ b/Utils/test-socket-signal/test/eurocon/remote_run_suspend @@ -0,0 +1,6 @@ +#!/bin/bash + +if test $# -ne 4; then + echo "Usage: $0 host1 port1 host2 port2" 1>&2 + exit 1 +fi -- 2.20.1