From: P2P-Next User Date: Wed, 3 Nov 2010 09:36:53 +0000 (+0200) Subject: TestSpecs/gen: resolved bugs in generation scripts X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=8595e2a5bcc2a3ca5c952c3ab42913722a56e3a8;p=p2p-testing-infrastructure.git TestSpecs/gen: resolved bugs in generation scripts --- diff --git a/TestSpecs/gen/rgen b/TestSpecs/gen/rgen index 18ff9e4..7537633 100755 --- a/TestSpecs/gen/rgen +++ b/TestSpecs/gen/rgen @@ -85,8 +85,8 @@ while read server port user remote_path remote_if dl_bw dl_burst ul_bw ul_burst cat < out.R +# + +if test $# -ne 1; then + echo "Usage: $0 scenario-config-file" 1>&2 + exit 1 +fi + +scenario_file=$1 + +scenario_name=$(basename ${scenario_file} .cfg) + +declare num_trackers +declare num_seeders +declare num_leechers +declare description +declare dl_max_limit +declare ul_max_limit + +# parse comment zone in scenario file (description, leechers, seeders etc.) +parse_comment() +{ + num_trackers=$(grep "^[ \t]*#[ \t]*Number of trackers:" ${scenario_file} | awk -F ":" '{print $2;}') + num_leechers=$(grep "^[ \t]*#[ \t]*Number of leechers:" ${scenario_file} | awk -F ":" '{print $2;}') + num_seeders=$(grep "^[ \t]*#[ \t]*Number of seeders:" ${scenario_file} | awk -F ":" '{print $2;}') + dl_max_limit=$(grep "^[ \t]*#[ \t]*Maximum download:" ${scenario_file} | awk -F ":" '{print $2;}') + dl_max_upload=$(grep "^[ \t]*#[ \t]*Maximum upload:" ${scenario_file} | awk -F ":" '{print $2;}') + description=$(grep "^[ \t]*#[ \t]*Description:" ${scenario_file} | awk -F ":" '{print $2;}') +} + +# test client description for "leecher" string +test_is_leecher() +{ + client_type=$1 + + grep "leecher" <<<"${client_type}" &> /dev/null +} + +# test client description for "seeder" string +test_is_seeder() +{ + client_type=$1 + + grep "seeder" <<<"${client_type}" &> /dev/null +} + +parse_comment + +cat <