From 7b1f46d8d0dd15c3104e45f7bcb450082fb59e6a Mon Sep 17 00:00:00 2001 From: Alex Iribarren Date: Sep 15 2020 12:01:14 +0000 Subject: Fix mtr test --- diff --git a/tests/p_mtr/mtr_test.sh b/tests/p_mtr/mtr_test.sh index dfd0194..36a76f2 100755 --- a/tests/p_mtr/mtr_test.sh +++ b/tests/p_mtr/mtr_test.sh @@ -12,13 +12,14 @@ fi t_Log "Running $0 - running ${TEST} to ${HOST}" ret_val=1 +FILE=/var/tmp/mtr_result -IP=$(host ${HOST}) +IP=$(dig +short ${HOST} A ${HOST} AAAA) -regex='.*address\ ([0-9.]*)' -if [[ $IP =~ $regex ]] +if [[ ! -z "$IP" ]] then - COUNT=$( mtr -nr -c1 ${HOST} | grep -c ${BASH_REMATCH[1]} ) + mtr -nr -c1 ${HOST} > ${FILE} + COUNT=$(echo "$IP" | grep -cf - ${FILE}) if [ $COUNT = 1 ] then t_Log "${TEST} reached ${HOST}" @@ -29,4 +30,5 @@ then fi fi +/bin/rm ${FILE} t_CheckExitStatus $ret_val