X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=blobdiff_plain;f=src%2Flibswift%2Ftests%2Fpex_test.sh;fp=src%2Flibswift%2Ftests%2Fpex_test.sh;h=ff6540677bb3dd2ca4933a33c2611f0374414f17;hb=45963a7511531cd1656ad5d3847d2dafd015c54d;hp=0000000000000000000000000000000000000000;hpb=d069796805ad79542fd7e4406d1e9c6d2d8c2ef7;p=swifty.git diff --git a/src/libswift/tests/pex_test.sh b/src/libswift/tests/pex_test.sh new file mode 100755 index 0000000..ff65406 --- /dev/null +++ b/src/libswift/tests/pex_test.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +EXEC=build/Debug/ +PEERCOUNT=2 +STORE=_pextest +TOKILL= +rm -rf $STORE +mkdir $STORE + +#$EXEC/seeder doc/sofi.jpg 7001 + +for i in `seq 1 $PEERCOUNT`; do + ( $EXEC/leecher 282a863d5567695161721686a59f0c667250a35d \ + $STORE/sofi$i.jpg 7001 710$i > $STORE/leecher$i.log ) & + TOKILL="$TOKILL $!" + sleep 4; +done + +sleep 10 + +for p in $TOKILL; do + kill -9 $p +done + +for i in `seq 1 $PEERCOUNT`; do + cat $STORE/leecher$i.log | grep sent | awk '{print $5}' | \ + sort | uniq -c > $STORE/peers$i.txt + peers=`wc -l < $STORE/peers$i.txt` + if [ $peers -ne $PEERCOUNT ]; then + echo Peer $i has $peers peers + fi +done