From 67e17b5a73b91a250630867cc9c5936de497293f Mon Sep 17 00:00:00 2001 From: Christoph Galuschka Date: Nov 09 2012 18:10:26 +0000 Subject: made tests more verbose for debugging --- diff --git a/tests/p_iputils/tracepath_test.sh b/tests/p_iputils/tracepath_test.sh index 79098ea..7594102 100755 --- a/tests/p_iputils/tracepath_test.sh +++ b/tests/p_iputils/tracepath_test.sh @@ -2,39 +2,33 @@ # Author: Christoph Galuschka TEST=tracepath -t_Log "Running $0 - running ${TEST} to webhost" # Testing availability of network if [ $SKIP_QA_HARNESS -eq 1 ]; then - HOST="www.centos.org" + HOST="wiki.centos.org" else HOST="repo.centos.qa" fi -IP=$(ping -qn -c 1 ${HOST} | grep -i 'ping '${HOST}) +t_Log "Running $0 - running ${TEST} to ${HOST}" +ret_val=1 -regex='PING\ '${HOST}'\ \(([0-9.]*)\).*' +IP=$(host ${HOST}) + +regex='.*address\ ([0-9.]*)' if [[ $IP =~ $regex ]] then - t_Log "resolved ${HOST} successfully - continuing" - ping -q -c 2 -i 0.25 ${HOST} - if [ $? = 0 ] + tracepath -n ${HOST} + COUNT=$( tracepath -n ${HOST} | grep -c ${BASH_REMATCH[1]} ) + if [ $COUNT = 1 ] then - t_Log "$HOST is reachable - continuing" - tracepath -n ${HOST} - COUNT=$( tracepath -n ${HOST} | grep -c ${BASH_REMATCH[1]} ) - if [ $COUNT = 1 ] - then - t_Log "${TEST} reached ${HOST}" - ret_val=0 - else - t_Log "${TEST} didn't reach ${HOST}" - ret_val=1 - fi + t_Log "${TEST} reached ${HOST}" + ret_val=0 + else + t_Log "${TEST} didn't reach ${HOST}" + ret_val=1 fi -else - t_Log "$HOST seems to be unavailable - skipping" - ret_val=0 fi -t_CheckExitStatus $ret_val +echo $ret_val +#t_CheckExitStatus $ret_val diff --git a/tests/p_mtr/mtr_test.sh b/tests/p_mtr/mtr_test.sh index 8624128..efec995 100755 --- a/tests/p_mtr/mtr_test.sh +++ b/tests/p_mtr/mtr_test.sh @@ -2,38 +2,33 @@ # Author: Christoph Galuschka TEST=mtr -t_Log "Running $0 - running ${TEST} to webhost" # Testing availability of network if [ $SKIP_QA_HARNESS -eq 1 ]; then - HOST="www.centos.org" + HOST="wiki.centos.org" else HOST="repo.centos.qa" fi -IP=$(ping -qn -c 1 ${HOST} | grep -i 'ping '${HOST}) +t_Log "Running $0 - running ${TEST} to ${HOST}" +ret_val=1 -regex='PING\ '${HOST}'\ \(([0-9.]*)\).*' +IP=$(host ${HOST}) + +regex='.*address\ ([0-9.]*)' if [[ $IP =~ $regex ]] then - t_Log "resolved ${HOST} successfully - continuing" - ping -q -c 2 -i 0.25 ${HOST} - if [ $? = 0 ] + mtr -nr -c1 ${HOST} + COUNT=$( mtr -nr -c1 ${HOST} | grep -c ${BASH_REMATCH[1]} ) + if [ $COUNT = 1 ] then - t_Log "$HOST is reachable - continuing" - COUNT=$( mtr -nr -c1 ${HOST} | grep -c ${BASH_REMATCH[1]} ) - if [ $COUNT = 1 ] - then - t_Log "${TEST} reached ${HOST}" - ret_val=0 - else - t_Log "${TEST} didn't reach ${HOST}" - ret_val=1 - fi + t_Log "${TEST} reached ${HOST}" + ret_val=0 + else + t_Log "${TEST} didn't reach ${HOST}" + ret_val=1 fi -else - t_Log "$HOST seems to be unavailable - skipping" - ret_val=0 fi -t_CheckExitStatus $ret_val +echo $ret_val +#t_CheckExitStatus $ret_val diff --git a/tests/p_traceroute/traceroute_test.sh b/tests/p_traceroute/traceroute_test.sh index 217e3bf..0e690c1 100755 --- a/tests/p_traceroute/traceroute_test.sh +++ b/tests/p_traceroute/traceroute_test.sh @@ -2,38 +2,33 @@ # Author: Christoph Galuschka TEST=traceroute -t_Log "Running $0 - running ${TEST} to webhost" # Testing availability of network if [ $SKIP_QA_HARNESS -eq 1 ]; then - HOST="www.centos.org" + HOST="wiki.centos.org" else HOST="repo.centos.qa" fi -IP=$(ping -qn -c 1 ${HOST} | grep -i 'ping '${HOST}) +t_Log "Running $0 - running ${TEST} to ${HOST}" +ret_val=1 -regex='PING\ '${HOST}'\ \(([0-9.]*)\).*' +IP=$(host ${HOST}) + +regex='.*address\ ([0-9.]*)' if [[ $IP =~ $regex ]] then - t_Log "resolved ${HOST} successfully - continuing" - ping -q -c 2 -i 0.25 ${HOST} - if [ $? = 0 ] + traceroute -n ${HOST} + COUNT=$( traceroute -n ${HOST} | grep -c ${BASH_REMATCH[1]} ) + if [ $COUNT = 2 ] then - t_Log "$HOST is reachable - continuing" - COUNT=$( traceroute -n ${HOST} | grep -c ${BASH_REMATCH[1]} ) - if [ $COUNT = 2 ] - then - t_Log "${TEST} reached ${HOST}" - ret_val=0 - else - t_Log "${TEST} didn't reach ${HOST}" - ret_val=1 - fi + t_Log "${TEST} reached ${HOST}" + ret_val=0 + else + t_Log "${TEST} didn't reach ${HOST}" + ret_val=1 fi -else - t_Log "$HOST seems to be unavailable - skipping" - ret_val=0 fi -t_CheckExitStatus $ret_val +echo $ret_val +#t_CheckExitStatus $ret_val