From dea7b2ad7ef5cc4223984151367fda40bd718218 Mon Sep 17 00:00:00 2001 From: Christoph Galuschka Date: Nov 09 2012 18:58:49 +0000 Subject: made tests again less noisy, fixed tracepath to work with too many hops --- diff --git a/tests/p_iputils/tracepath_test.sh b/tests/p_iputils/tracepath_test.sh index 7594102..a06c0ca 100755 --- a/tests/p_iputils/tracepath_test.sh +++ b/tests/p_iputils/tracepath_test.sh @@ -14,18 +14,22 @@ t_Log "Running $0 - running ${TEST} to ${HOST}" ret_val=1 IP=$(host ${HOST}) +FILE=/var/tmp/tracepath_result regex='.*address\ ([0-9.]*)' if [[ $IP =~ $regex ]] then - tracepath -n ${HOST} - COUNT=$( tracepath -n ${HOST} | grep -c ${BASH_REMATCH[1]} ) + tracepath -n ${HOST} > ${FILE} + COUNT=$(grep -c ${BASH_REMATCH[1]} ${FILE}) + TTL=$(grep -c 'Too many hops' ${FILE}) if [ $COUNT = 1 ] then t_Log "${TEST} reached ${HOST}" ret_val=0 - else - t_Log "${TEST} didn't reach ${HOST}" + fi + if ([ $COUNT = 0 ] && $ [ TTL = 1 ]) + then + t_Log "${TEST} didn't reach ${HOST} because of too many hops. This is treated as SUCCESS." ret_val=1 fi fi diff --git a/tests/p_mtr/mtr_test.sh b/tests/p_mtr/mtr_test.sh index efec995..ee4a439 100755 --- a/tests/p_mtr/mtr_test.sh +++ b/tests/p_mtr/mtr_test.sh @@ -18,7 +18,6 @@ IP=$(host ${HOST}) regex='.*address\ ([0-9.]*)' if [[ $IP =~ $regex ]] then - mtr -nr -c1 ${HOST} COUNT=$( mtr -nr -c1 ${HOST} | grep -c ${BASH_REMATCH[1]} ) if [ $COUNT = 1 ] then @@ -30,5 +29,4 @@ then fi fi -echo $ret_val -#t_CheckExitStatus $ret_val +t_CheckExitStatus $ret_val diff --git a/tests/p_traceroute/traceroute_test.sh b/tests/p_traceroute/traceroute_test.sh index 0e690c1..01b36d2 100755 --- a/tests/p_traceroute/traceroute_test.sh +++ b/tests/p_traceroute/traceroute_test.sh @@ -18,7 +18,6 @@ IP=$(host ${HOST}) regex='.*address\ ([0-9.]*)' if [[ $IP =~ $regex ]] then - traceroute -n ${HOST} COUNT=$( traceroute -n ${HOST} | grep -c ${BASH_REMATCH[1]} ) if [ $COUNT = 2 ] then @@ -30,5 +29,4 @@ then fi fi -echo $ret_val -#t_CheckExitStatus $ret_val +t_CheckExitStatus $ret_val