test-signal-socket: new version of eurocon scripts
authorRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Tue, 16 Nov 2010 00:09:23 +0000 (02:09 +0200)
committerRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Tue, 16 Nov 2010 00:09:50 +0000 (02:09 +0200)
16 files changed:
Utils/test-socket-signal/test/eurocon/all_install [new file with mode: 0755]
Utils/test-socket-signal/test/eurocon/all_run_if [new file with mode: 0755]
Utils/test-socket-signal/test/eurocon/all_run_stop [new file with mode: 0755]
Utils/test-socket-signal/test/eurocon/all_run_suspend [new file with mode: 0755]
Utils/test-socket-signal/test/eurocon/local_create_torrent
Utils/test-socket-signal/test/eurocon/local_get_ip [new file with mode: 0755]
Utils/test-socket-signal/test/eurocon/local_install [new file with mode: 0755]
Utils/test-socket-signal/test/eurocon/local_run_tracker
Utils/test-socket-signal/test/eurocon/local_start_leecher
Utils/test-socket-signal/test/eurocon/local_start_seeder
Utils/test-socket-signal/test/eurocon/remote_run_if
Utils/test-socket-signal/test/eurocon/remote_run_stop
Utils/test-socket-signal/test/eurocon/remote_run_suspend
Utils/test-socket-signal/test/eurocon/super_run_if [new file with mode: 0755]
Utils/test-socket-signal/test/eurocon/super_run_stop [new file with mode: 0755]
Utils/test-socket-signal/test/eurocon/super_run_suspend [new file with mode: 0755]

diff --git a/Utils/test-socket-signal/test/eurocon/all_install b/Utils/test-socket-signal/test/eurocon/all_install
new file mode 100755 (executable)
index 0000000..9d22c11
--- /dev/null
@@ -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 (executable)
index 0000000..86d9e2f
--- /dev/null
@@ -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 (executable)
index 0000000..2c5968e
--- /dev/null
@@ -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 (executable)
index 0000000..b71c5b8
--- /dev/null
@@ -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
index e74d5cc..8fabbb9 100755 (executable)
@@ -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 (executable)
index 0000000..d71aa1a
--- /dev/null
@@ -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 (executable)
index 0000000..53121bb
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+apt-get install -y bittornado
index fac21bf..2d2a76b 100755 (executable)
@@ -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 &
index aa9b7f2..bfdf560 100755 (executable)
@@ -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
index d9ff445..044bb5e 100755 (executable)
@@ -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
index 55523e3..09ef9e6 100755 (executable)
@@ -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"
index 6eaf8fb..1606c90 100755 (executable)
@@ -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"
index 6eaf8fb..5bda131 100755 (executable)
@@ -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 (executable)
index 0000000..d4dbb61
--- /dev/null
@@ -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 (executable)
index 0000000..7b9fbe1
--- /dev/null
@@ -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 (executable)
index 0000000..ff8234b
--- /dev/null
@@ -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