From f20e0087cf8f3c68c04c8f365156b798cf3cf3be Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Thu, 21 Jan 2016 23:13:50 +0100 Subject: [PATCH] Improvs. --- .../resources/scripts/tinyTestcase.sh | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/example/diameter/launcher/resources/scripts/tinyTestcase.sh b/example/diameter/launcher/resources/scripts/tinyTestcase.sh index dad68ed..330d08e 100755 --- a/example/diameter/launcher/resources/scripts/tinyTestcase.sh +++ b/example/diameter/launcher/resources/scripts/tinyTestcase.sh @@ -49,7 +49,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 +119,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 @@ -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): @@ -238,5 +252,6 @@ do count=$((count+1)) done +echo exit 0 -- 2.20.1