From: Phil Sutter Date: Tue, 14 Aug 2018 12:18:07 +0000 (+0200) Subject: testsuite: Prepare for ss tests X-Git-Tag: v4.19.0~81 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=744bd07662c09db406be79c0be7ec7698be5283e;p=thirdparty%2Fiproute2.git 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 Signed-off-by: Stephen Hemminger --- diff --git a/testsuite/Makefile b/testsuite/Makefile index 2a54e5c84..8fcbc557f 100644 --- a/testsuite/Makefile +++ b/testsuite/Makefile @@ -65,7 +65,7 @@ endif TMP_ERR=`mktemp /tmp/tc_testsuite.XXXXXX`; \ TMP_OUT=`mktemp /tmp/tc_testsuite.XXXXXX`; \ 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; \ if [ "$$?" = "127" ]; then \ echo "SKIPPED"; \ diff --git a/testsuite/lib/generic.sh b/testsuite/lib/generic.sh index 8cef20fa1..f92260fc4 100644 --- a/testsuite/lib/generic.sh +++ b/testsuite/lib/generic.sh @@ -26,16 +26,17 @@ ts_skip() exit 127 } -ts_tc() +__ts_cmd() { + CMD=$1; shift SCRIPT=$1; shift DESC=$1; shift - $TC $@ 2> $STD_ERR > $STD_OUT + $CMD $@ 2> $STD_ERR > $STD_OUT if [ -s $STD_ERR ]; then ts_err "${SCRIPT}: ${DESC} failed:" - ts_err "command: $TC $@" + ts_err "command: $CMD $@" ts_err "stderr output:" ts_err_cat $STD_ERR if [ -s $STD_OUT ]; then @@ -50,29 +51,19 @@ ts_tc() fi } -ts_ip() +ts_tc() { - SCRIPT=$1; shift - DESC=$1; shift + __ts_cmd "$TC" "$@" +} - $IP $@ 2> $STD_ERR > $STD_OUT - RET=$? +ts_ip() +{ + __ts_cmd "$IP" "$@" +} - 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_ss() +{ + __ts_cmd "$SS" "$@" } ts_qdisc_available()