summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorPetr Machata <petrm@mellanox.com>2018-12-04 16:07:42 +0000
committerStephen Hemminger <stephen@networkplumber.org>2018-12-04 14:28:31 -0800
commit4ac421746417bf5166ad2dd0556b7138b276a807 (patch)
treeb033d0ee9cc53fc7615f99a8e3ae41081dbd34b4 /testsuite
parent0951cbcddf5ade08a42ff8ce65bb9b2017ec9cee (diff)
downloadiproute2-4ac421746417bf5166ad2dd0556b7138b276a807.tar.gz
testsuite: Add a test for batch processing
Test that when a second or following command in a batch fails, tc reports it correctly. This is a test for the previous patch. Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/tests/tc/batch.t23
1 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/tests/tc/batch.t b/testsuite/tests/tc/batch.t
new file mode 100755
index 00000000..50e7ba37
--- /dev/null
+++ b/testsuite/tests/tc/batch.t
@@ -0,0 +1,23 @@
+#!/bin/sh
+. lib/generic.sh
+
+DEV="$(rand_dev)"
+ts_ip "$0" "Add $DEV dummy interface" link add dev $DEV type dummy
+ts_ip "$0" "Enable $DEV" link set $DEV up
+ts_tc "$0" "Add ingress qdisc" qdisc add dev $DEV clsact
+
+TMP="$(mktemp)"
+echo filt add dev $DEV ingress pref 1000 matchall action pass >> "$TMP"
+echo filt add dev $DEV ingress pref 1000 matchall action pass >> "$TMP"
+
+"$TC" -b "$TMP" 2> $STD_ERR > $STD_OUT
+if [ $? -eq 0 ]; then
+ ts_err "$0: batch passed when it should have failed"
+elif [ ! -s $STD_ERR ]; then
+ ts_err "$0: batch produced no error message"
+else
+ echo "$0: batch failed, as expected"
+fi
+
+rm "$TMP"
+ts_ip "$0" "Del $DEV dummy interface" link del dev $DEV