From 54ec44b0ee6b7d32796ef07c9c88f2a06d5d4d67 Mon Sep 17 00:00:00 2001 From: Fabian Arrotin Date: Sep 15 2020 12:12:15 +0000 Subject: Merge pull request #62 from alexiri/fix_mtr 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