testsuite: Prepare for ss tests
This merges the shared bits from ts_tc() and ts_ip() into a common function for being wrapped by the first ones and adds a third ts_ss() for testing ss commands. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
38d209ecf2
commit
744bd07662
|
|
@ -65,7 +65,7 @@ endif
|
||||||
TMP_ERR=`mktemp /tmp/tc_testsuite.XXXXXX`; \
|
TMP_ERR=`mktemp /tmp/tc_testsuite.XXXXXX`; \
|
||||||
TMP_OUT=`mktemp /tmp/tc_testsuite.XXXXXX`; \
|
TMP_OUT=`mktemp /tmp/tc_testsuite.XXXXXX`; \
|
||||||
STD_ERR="$$TMP_ERR" STD_OUT="$$TMP_OUT" \
|
STD_ERR="$$TMP_ERR" STD_OUT="$$TMP_OUT" \
|
||||||
TC="$$i/tc/tc" IP="$$i/ip/ip" DEV="$(DEV)" IPVER="$@" SNAME="$$i" \
|
TC="$$i/tc/tc" IP="$$i/ip/ip" SS=$$i/misc/ss DEV="$(DEV)" IPVER="$@" SNAME="$$i" \
|
||||||
ERRF="$(RESULTS_DIR)/$@.$$o.err" $(KENV) $(PREFIX) tests/$@ > $(RESULTS_DIR)/$@.$$o.out; \
|
ERRF="$(RESULTS_DIR)/$@.$$o.err" $(KENV) $(PREFIX) tests/$@ > $(RESULTS_DIR)/$@.$$o.out; \
|
||||||
if [ "$$?" = "127" ]; then \
|
if [ "$$?" = "127" ]; then \
|
||||||
echo "SKIPPED"; \
|
echo "SKIPPED"; \
|
||||||
|
|
|
||||||
|
|
@ -26,16 +26,17 @@ ts_skip()
|
||||||
exit 127
|
exit 127
|
||||||
}
|
}
|
||||||
|
|
||||||
ts_tc()
|
__ts_cmd()
|
||||||
{
|
{
|
||||||
|
CMD=$1; shift
|
||||||
SCRIPT=$1; shift
|
SCRIPT=$1; shift
|
||||||
DESC=$1; shift
|
DESC=$1; shift
|
||||||
|
|
||||||
$TC $@ 2> $STD_ERR > $STD_OUT
|
$CMD $@ 2> $STD_ERR > $STD_OUT
|
||||||
|
|
||||||
if [ -s $STD_ERR ]; then
|
if [ -s $STD_ERR ]; then
|
||||||
ts_err "${SCRIPT}: ${DESC} failed:"
|
ts_err "${SCRIPT}: ${DESC} failed:"
|
||||||
ts_err "command: $TC $@"
|
ts_err "command: $CMD $@"
|
||||||
ts_err "stderr output:"
|
ts_err "stderr output:"
|
||||||
ts_err_cat $STD_ERR
|
ts_err_cat $STD_ERR
|
||||||
if [ -s $STD_OUT ]; then
|
if [ -s $STD_OUT ]; then
|
||||||
|
|
@ -50,29 +51,19 @@ ts_tc()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ts_tc()
|
||||||
|
{
|
||||||
|
__ts_cmd "$TC" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
ts_ip()
|
ts_ip()
|
||||||
{
|
{
|
||||||
SCRIPT=$1; shift
|
__ts_cmd "$IP" "$@"
|
||||||
DESC=$1; shift
|
}
|
||||||
|
|
||||||
$IP $@ 2> $STD_ERR > $STD_OUT
|
ts_ss()
|
||||||
RET=$?
|
{
|
||||||
|
__ts_cmd "$SS" "$@"
|
||||||
if [ -s $STD_ERR ] || [ "$RET" != "0" ]; then
|
|
||||||
ts_err "${SCRIPT}: ${DESC} failed:"
|
|
||||||
ts_err "command: $IP $@"
|
|
||||||
ts_err "stderr output:"
|
|
||||||
ts_err_cat $STD_ERR
|
|
||||||
if [ -s $STD_OUT ]; then
|
|
||||||
ts_err "stdout output:"
|
|
||||||
ts_err_cat $STD_OUT
|
|
||||||
fi
|
|
||||||
elif [ -s $STD_OUT ]; then
|
|
||||||
echo "${SCRIPT}: ${DESC} succeeded with output:"
|
|
||||||
cat $STD_OUT
|
|
||||||
else
|
|
||||||
echo "${SCRIPT}: ${DESC} succeeded"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ts_qdisc_available()
|
ts_qdisc_available()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue