From 728a7b020c474cd1b2b8332adf5c785458f42c8a Mon Sep 17 00:00:00 2001 From: Razvan Deaconescu Date: Wed, 18 Aug 2010 12:05:44 +0300 Subject: [PATCH] TestSpecs/gen: complete R script generation script --- TestSpecs/gen/rgen | 93 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 70 insertions(+), 23 deletions(-) diff --git a/TestSpecs/gen/rgen b/TestSpecs/gen/rgen index bb86cb4..f553700 100755 --- a/TestSpecs/gen/rgen +++ b/TestSpecs/gen/rgen @@ -5,19 +5,43 @@ # configuration file # # Sample run: -# ./rgen ../test-campaign.cfg ../test-scenario-pre-post-nop-ul.cfg > out.R +# ./rgen performance-experiments-3.01.cfg > out.R # -if test $# -ne 2; then - echo "Usage: $0 campaign-config-file scenario-config-file" 1>&2 +if test $# -ne 1; then + echo "Usage: $0 scenario-config-file" 1>&2 exit 1 fi -campaign_file=$1 -scenario_file=$2 +scenario_file=$1 -campaign_name=${campaign_file/%.cfg} -scenario_name=${scenario_file/%.cfg} +scenario_name=$(basename ${scenario_file} .cfg) + +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_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 +} + +parse_comment cat <