Blame tests/p_iputils/tracepath_test.sh
|
Christoph Galuschka |
fe4cd3 |
#!/bin/sh
|
|
Christoph Galuschka |
fe4cd3 |
# Author: Christoph Galuschka <christoph.galuschka@chello.at>
|
|
Christoph Galuschka |
fe4cd3 |
|
|
Christoph Galuschka |
fe4cd3 |
TEST=tracepath
|
|
Christoph Galuschka |
fe4cd3 |
|
|
Christoph Galuschka |
fe4cd3 |
# Testing availability of network
|
|
Christoph Galuschka |
fe4cd3 |
if [ $SKIP_QA_HARNESS -eq 1 ]; then
|
|
Christoph Galuschka |
67e17b |
HOST="wiki.centos.org"
|
|
Christoph Galuschka |
fe4cd3 |
else
|
|
Christoph Galuschka |
fe4cd3 |
HOST="repo.centos.qa"
|
|
Christoph Galuschka |
fe4cd3 |
fi
|
|
Christoph Galuschka |
fe4cd3 |
|
|
Christoph Galuschka |
67e17b |
t_Log "Running $0 - running ${TEST} to ${HOST}"
|
|
Christoph Galuschka |
67e17b |
ret_val=1
|
|
Christoph Galuschka |
fe4cd3 |
|
|
Christoph Galuschka |
67e17b |
IP=$(host ${HOST})
|
|
Christoph Galuschka |
67e17b |
|
|
Christoph Galuschka |
67e17b |
regex='.*address\ ([0-9.]*)'
|
|
Christoph Galuschka |
fe4cd3 |
if [[ $IP =~ $regex ]]
|
|
Christoph Galuschka |
fe4cd3 |
then
|
|
Christoph Galuschka |
67e17b |
tracepath -n ${HOST}
|
|
Christoph Galuschka |
67e17b |
COUNT=$( tracepath -n ${HOST} | grep -c ${BASH_REMATCH[1]} )
|
|
Christoph Galuschka |
67e17b |
if [ $COUNT = 1 ]
|
|
Christoph Galuschka |
fe4cd3 |
then
|
|
Christoph Galuschka |
67e17b |
t_Log "${TEST} reached ${HOST}"
|
|
Christoph Galuschka |
67e17b |
ret_val=0
|
|
Christoph Galuschka |
67e17b |
else
|
|
Christoph Galuschka |
67e17b |
t_Log "${TEST} didn't reach ${HOST}"
|
|
Christoph Galuschka |
67e17b |
ret_val=1
|
|
Christoph Galuschka |
fe4cd3 |
fi
|
|
Christoph Galuschka |
fe4cd3 |
fi
|
|
Christoph Galuschka |
fe4cd3 |
|
|
Christoph Galuschka |
67e17b |
echo $ret_val
|
|
Christoph Galuschka |
67e17b |
#t_CheckExitStatus $ret_val
|