From 6a95e198dd67902f248f08236da8059a2d327c44 Mon Sep 17 00:00:00 2001 From: Christoph Galuschka Date: Nov 10 2012 18:36:56 +0000 Subject: testing COUNT for 1 or 2 is now in one 'if' statement --- diff --git a/tests/p_iputils/tracepath_test.sh b/tests/p_iputils/tracepath_test.sh index 5964ee3..63d273c 100755 --- a/tests/p_iputils/tracepath_test.sh +++ b/tests/p_iputils/tracepath_test.sh @@ -11,10 +11,10 @@ else fi t_Log "Running $0 - running ${TEST} to ${HOST}" -ret_val=1 IP=$(host ${HOST}) FILE=/var/tmp/tracepath_result +ret_val=1 regex='.*address\ ([0-9.]*)' if [[ $IP =~ $regex ]] @@ -22,20 +22,17 @@ then tracepath -n ${HOST} > ${FILE} COUNT=$(grep -c ${BASH_REMATCH[1]} ${FILE}) TTL=$(grep -c 'Too many hops' ${FILE}) - if [ $COUNT = 1 ] + if ([ $COUNT = 1 ] || [ $COUNT = 2 ]) then t_Log "${TEST} reached ${HOST}" ret_val=0 - elif [ $COUNT = 2 ] - then - t_Log "${TEST} reached ${HOST}" - ret_val=0 - fi - - if ([ $COUNT = 0 ] && [ $TTL = 1 ]) + elif ([ $COUNT = 0 ] && [ $TTL = 1 ]) then t_Log "${TEST} didn't reach ${HOST} because of too many hops. This is treated as SUCCESS." ret_val=0 + else + t_Log "${TEST} didn't return anything we expect - FAILING" + ret_val=1 fi fi