X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2Fresources%2Fscripts%2FtinyTestcase.sh;h=90ac75b03d9c51956bfbee4514a1c08e06e95cee;hb=8b51505bc973e127e02454e8b867471393fe4c23;hp=dad68ed0b60a5cfc59738d11314aa0a95426a406;hpb=b313b5840c8e1319c5d967bd0d38ef911b66df96;p=anna.git diff --git a/example/diameter/launcher/resources/scripts/tinyTestcase.sh b/example/diameter/launcher/resources/scripts/tinyTestcase.sh index dad68ed..90ac75b 100755 --- a/example/diameter/launcher/resources/scripts/tinyTestcase.sh +++ b/example/diameter/launcher/resources/scripts/tinyTestcase.sh @@ -17,6 +17,7 @@ _exit() { } usage() { + echo echo "Usage: $0 \"[test_end_points]\" [timeout]" echo echo " source_directory:" @@ -49,7 +50,8 @@ usage() { echo echo " This script will create a basic testcase based on frames timeline (11, 13, 15, etc.), from the desired" echo " end-point list. For example, from the 'gentraf' point of view, outgoing requests will be translated as" - echo " sendxml operations with corresponding waits for answers and corresponding result codes (normally 2001)." + echo " sendxml operations with corresponding waits for answers and corresponding result codes (normally 2001)" + echo " if those answers are provided (2001 will be assigned as result-code condition if no answer is found)." echo " CER/A are detected creating a symbolic link to better reference them, and DPR/A are ignored." echo echo " The provided test end point list shall match metadata 'src' field in order to filter the valid testcase" @@ -118,8 +120,15 @@ update_testcase () { echo "test|1|sendxml2e|$xml" >> $TESTCASE_BN if [ -n "$resultcode" ] then - local rc=$(getResultCode $xml) - [ -z "$rc" ] && rc=2001 + local hbh="$(grep -o "hop-by-hop-id=\"[0-9]*\"" $xml)" + local hbh_matchs=( $(grep -l "$hbh" *.xml) ) + local ans_xml=${hbh_matchs[1]} + local rc=2001 + if [ -n "$ans_xml" ] + then + _rc=$(getResultCode $ans_xml) + [ -n "$_rc" ] && rc=$_rc + fi s_waitfe="${s_waitfe}|${rc}" fi echo "$s_waitfe" >> $TESTCASE_BN @@ -132,7 +141,6 @@ update_testcase () { ############# # EXECUTION # ############# -echo SOURCE_DIR=$1 [ -z "$SOURCE_DIR" ] && usage SOURCE_DIR=`readlink -f $SOURCE_DIR` @@ -150,10 +158,16 @@ if [ -z "$END_POINTS" ] then src_eps=( $(grep "^src=" *.*metadata | cut -d= -f2 | sort -u) ) [ ${#src_eps[@]} -eq 0 ] && _exit "No source end-points detected: metadata must have an 'src=xxx' line." - echo "Input a space-separated list for desired end-points to be processed as test side: " - echo " (available source end-points: ${src_eps[*]})" - read END_POINTS - [ -z "$END_POINTS" ] && _exit "Invalid empty input !!" + if [ ${#src_eps[@]} -eq 1 ] + then + END_POINTS=$src_eps + echo "Detected a unique end-point: $END_POINTS" + else + echo "Input a space-separated list for desired end-points to be processed as test side: " + echo " (available source end-points: ${src_eps[*]})" + read END_POINTS + [ -z "$END_POINTS" ] && _exit "Invalid empty input !!" + fi fi # Identify useful frames: those which are created at test-bed side (all except frames coming from tested systems):