From c11a99e7942383a11ef858aa1679a94d6eea5917 Mon Sep 17 00:00:00 2001 From: Vlad Buslov Date: Mon, 19 Aug 2019 10:52:07 +0300 Subject: [PATCH 1/2] tc-testing: use dedicated DUMMY interface name for dummy dev A lot of tests reuse $DEV1 veth name for naming dummy device. This causes problem when tdc is invoked without specifying a test group and tries to execute all tests. In this case tdc instantiates ns plugin, which creates veth pair once before running tests. However, if any of the tests that reuse $DEV1 run before test that depend on ns plugin, it will delete $DEV1 as a part of teardown section: =====> Test 3b88: Delete ingress qdisc twice [3770/41080] -----> prepare stage ns/SubPlugin.adjust_command adjust_command: stage is setup; inserting netns stuff in command [/sbin/ip link add dev v0p1 type dummy || /bin/true] list [['/sbin/ip', 'link', 'add', 'dev', 'v0p1', 'type', 'dummy', '||', '/bin/true']] adjust_command: return command [ip netns exec tcut /sbin/ip link add dev v0p1 type dummy || /bin/true] command "ip netns exec tcut /sbin/ip link add dev v0p1 type dummy || /bin/true" ns/SubPlugin.adjust_command adjust_command: stage is setup; inserting netns stuff in command [/sbin/tc qdisc add dev v0p1 ingress] list [['/sbin/tc', 'qdisc', 'add', 'dev', 'v0p1', 'ingress']] adjust_command: return command [ip netns exec tcut /sbin/tc qdisc add dev v0p1 ingress] command "ip netns exec tcut /sbin/tc qdisc add dev v0p1 ingress" ns/SubPlugin.adjust_command adjust_command: stage is setup; inserting netns stuff in command [/sbin/tc qdisc del dev v0p1 ingress] list [['/sbin/tc', 'qdisc', 'del', 'dev', 'v0p1', 'ingress']] adjust_command: return command [ip netns exec tcut /sbin/tc qdisc del dev v0p1 ingress] command "ip netns exec tcut /sbin/tc qdisc del dev v0p1 ingress" -----> execute stage ns/SubPlugin.adjust_command adjust_command: stage is execute; inserting netns stuff in command [/sbin/tc qdisc del dev v0p1 ingress] list [['/sbin/tc', 'qdisc', 'del', 'dev', 'v0p1', 'ingress']] adjust_command: return command [ip netns exec tcut /sbin/tc qdisc del dev v0p1 ingress] command "ip netns exec tcut /sbin/tc qdisc del dev v0p1 ingress" -----> verify stage ns/SubPlugin.adjust_command adjust_command: stage is verify; inserting netns stuff in command [/sbin/tc qdisc show dev v0p1] list [['/sbin/tc', 'qdisc', 'show', 'dev', 'v0p1']] adjust_command: return command [ip netns exec tcut /sbin/tc qdisc show dev v0p1] command "ip netns exec tcut /sbin/tc qdisc show dev v0p1" -----> teardown stage ns/SubPlugin.adjust_command adjust_command: stage is teardown; inserting netns stuff in command [/sbin/ip link del dev v0p1 type dummy] list [['/sbin/ip', 'link', 'del', 'dev', 'v0p1', 'type', 'dummy']] adjust_command: return command [ip netns exec tcut /sbin/ip link del dev v0p1 type dummy] command "ip netns exec tcut /sbin/ip link del dev v0p1 type dummy" After this ns-dependent tests will fail because dev doesn't exist: =====> Test 901f: Add fw filter with prio at 32-bit maxixum -----> prepare stage ns/SubPlugin.adjust_command adjust_command: stage is setup; inserting netns stuff in command [/sbin/tc qdisc add dev v0p1 ingress] list [['/sbin/tc', 'qdisc', 'add', 'dev', 'v0p1', 'ingress']] adjust_command: return command [ip netns exec tcut /sbin/tc qdisc add dev v0p1 ingress] command "ip netns exec tcut /sbin/tc qdisc add dev v0p1 ingress" -----> prepare stage *** Could not execute: "$TC qdisc add dev $DEV1 ingress" -----> prepare stage *** Error message: "Cannot find device "v0p1" " returncode 1; expected [0] -----> prepare stage *** Aborting test run. <_io.BufferedReader name=3> *** stdout *** <_io.BufferedReader name=5> *** stderr *** "-----> prepare stage" did not complete successfully Exception ('setup', None, '"-----> prepare stage" did not complete successfully') (caught in test_runner, running test 477 901f Add fw filter with prio at 32-bit maxixum stage setup) --------------- traceback File "./tdc.py", line 371, in test_runner res = run_one_test(pm, args, index, tidx) File "./tdc.py", line 272, in run_one_test prepare_env(args, pm, 'setup', "-----> prepare stage", tidx["setup"]) File "./tdc.py", line 247, in prepare_env '"{}" did not complete successfully'.format(prefix)) --------------- Fix the issue by introducing standalone $DUMMY config variable and substitute all usage of $DEV1 in tests that don't depend on ns plugin. Fixes: 489ce2f42514 ("tc-testing: Restore original behaviour for namespaces in tdc") Signed-off-by: Vlad Buslov Signed-off-by: David S. Miller --- .../tc-testing/tc-tests/filters/matchall.json | 238 +++++++++--------- .../tc-testing/tc-tests/qdiscs/fifo.json | 150 +++++------ .../tc-testing/tc-tests/qdiscs/ingress.json | 50 ++-- .../tc-testing/tc-tests/qdiscs/prio.json | 128 +++++----- .../selftests/tc-testing/tdc_config.py | 1 + 5 files changed, 284 insertions(+), 283 deletions(-) diff --git a/tools/testing/selftests/tc-testing/tc-tests/filters/matchall.json b/tools/testing/selftests/tc-testing/tc-tests/filters/matchall.json index 5f24c0598624..51799874a972 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/filters/matchall.json +++ b/tools/testing/selftests/tc-testing/tc-tests/filters/matchall.json @@ -7,17 +7,17 @@ "matchall" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 ingress" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY ingress" ], - "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 0x1 prio 1 protocol ip matchall action ok", + "cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ip matchall action ok", "expExitCode": "0", - "verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 1 prio 1 protocol ip matchall", + "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 1 prio 1 protocol ip matchall", "matchPattern": "^filter parent ffff: protocol ip pref 1 matchall.*handle 0x1.*gact action pass.*ref 1 bind 1", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 ingress", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY ingress", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -28,17 +28,17 @@ "matchall" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 root handle 1: prio" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY root handle 1: prio" ], - "cmdUnderTest": "$TC filter add dev $DEV1 parent 1: handle 0x1 prio 1 protocol ip matchall action ok", + "cmdUnderTest": "$TC filter add dev $DUMMY parent 1: handle 0x1 prio 1 protocol ip matchall action ok", "expExitCode": "0", - "verifyCmd": "$TC filter get dev $DEV1 parent 1: handle 1 prio 1 protocol ip matchall", + "verifyCmd": "$TC filter get dev $DUMMY parent 1: handle 1 prio 1 protocol ip matchall", "matchPattern": "^filter parent 1: protocol ip pref 1 matchall.*handle 0x1.*gact action pass.*ref 1 bind 1", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 root handle 1: prio", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY root handle 1: prio", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -49,17 +49,17 @@ "matchall" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 ingress" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY ingress" ], - "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 0x1 prio 1 protocol ipv6 matchall action drop", + "cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv6 matchall action drop", "expExitCode": "0", - "verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 1 prio 1 protocol ipv6 matchall", + "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 1 prio 1 protocol ipv6 matchall", "matchPattern": "^filter parent ffff: protocol ipv6 pref 1 matchall.*handle 0x1.*gact action drop.*ref 1 bind 1", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 ingress", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY ingress", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -70,17 +70,17 @@ "matchall" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 root handle 1: prio" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY root handle 1: prio" ], - "cmdUnderTest": "$TC filter add dev $DEV1 parent 1: handle 0x1 prio 1 protocol ipv6 matchall action drop", + "cmdUnderTest": "$TC filter add dev $DUMMY parent 1: handle 0x1 prio 1 protocol ipv6 matchall action drop", "expExitCode": "0", - "verifyCmd": "$TC filter get dev $DEV1 parent 1: handle 1 prio 1 protocol ipv6 matchall", + "verifyCmd": "$TC filter get dev $DUMMY parent 1: handle 1 prio 1 protocol ipv6 matchall", "matchPattern": "^filter parent 1: protocol ipv6 pref 1 matchall.*handle 0x1.*gact action drop.*ref 1 bind 1", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 root handle 1: prio", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY root handle 1: prio", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -91,17 +91,17 @@ "matchall" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 ingress" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY ingress" ], - "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 0x1 prio 65535 protocol ipv4 matchall action pass", + "cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 65535 protocol ipv4 matchall action pass", "expExitCode": "0", - "verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 1 prio 65535 protocol ipv4 matchall", + "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 1 prio 65535 protocol ipv4 matchall", "matchPattern": "^filter parent ffff: protocol ip pref 65535 matchall.*handle 0x1.*gact action pass.*ref 1 bind 1", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 ingress", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY ingress", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -112,17 +112,17 @@ "matchall" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 root handle 1: prio" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY root handle 1: prio" ], - "cmdUnderTest": "$TC filter add dev $DEV1 parent 1: handle 0x1 prio 65535 protocol ipv4 matchall action pass", + "cmdUnderTest": "$TC filter add dev $DUMMY parent 1: handle 0x1 prio 65535 protocol ipv4 matchall action pass", "expExitCode": "0", - "verifyCmd": "$TC filter get dev $DEV1 parent 1: handle 1 prio 65535 protocol ipv4 matchall", + "verifyCmd": "$TC filter get dev $DUMMY parent 1: handle 1 prio 65535 protocol ipv4 matchall", "matchPattern": "^filter parent 1: protocol ip pref 65535 matchall.*handle 0x1.*gact action pass.*ref 1 bind 1", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 root handle 1: prio", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY root handle 1: prio", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -133,17 +133,17 @@ "matchall" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 ingress" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY ingress" ], - "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 0x1 prio 655355 protocol ipv4 matchall action pass", + "cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 655355 protocol ipv4 matchall action pass", "expExitCode": "255", - "verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 1 prio 655355 protocol ipv4 matchall", + "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 1 prio 655355 protocol ipv4 matchall", "matchPattern": "^filter parent ffff: protocol ip pref 655355 matchall.*handle 0x1.*gact action pass.*ref 1 bind 1", "matchCount": "0", "teardown": [ - "$TC qdisc del dev $DEV1 ingress", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY ingress", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -154,17 +154,17 @@ "matchall" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 root handle 1: prio" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY root handle 1: prio" ], - "cmdUnderTest": "$TC filter add dev $DEV1 parent 1: handle 0x1 prio 655355 protocol ipv4 matchall action pass", + "cmdUnderTest": "$TC filter add dev $DUMMY parent 1: handle 0x1 prio 655355 protocol ipv4 matchall action pass", "expExitCode": "255", - "verifyCmd": "$TC filter get dev $DEV1 parent 1: handle 1 prio 655355 protocol ipv4 matchall", + "verifyCmd": "$TC filter get dev $DUMMY parent 1: handle 1 prio 655355 protocol ipv4 matchall", "matchPattern": "^filter parent 1: protocol ip pref 655355 matchall.*handle 0x1.*gact action pass.*ref 1 bind 1", "matchCount": "0", "teardown": [ - "$TC qdisc del dev $DEV1 root handle 1: prio", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY root handle 1: prio", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -175,17 +175,17 @@ "matchall" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 ingress" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY ingress" ], - "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 0xffffffff prio 1 protocol all matchall action continue", + "cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0xffffffff prio 1 protocol all matchall action continue", "expExitCode": "0", - "verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 0xffffffff prio 1 protocol all matchall", + "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 0xffffffff prio 1 protocol all matchall", "matchPattern": "^filter parent ffff: protocol all pref 1 matchall.*handle 0xffffffff.*gact action continue.*ref 1 bind 1", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 ingress", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY ingress", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -196,17 +196,17 @@ "matchall" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 root handle 1: prio" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY root handle 1: prio" ], - "cmdUnderTest": "$TC filter add dev $DEV1 parent 1: handle 0xffffffff prio 1 protocol all matchall action continue", + "cmdUnderTest": "$TC filter add dev $DUMMY parent 1: handle 0xffffffff prio 1 protocol all matchall action continue", "expExitCode": "0", - "verifyCmd": "$TC filter get dev $DEV1 parent 1: handle 0xffffffff prio 1 protocol all matchall", + "verifyCmd": "$TC filter get dev $DUMMY parent 1: handle 0xffffffff prio 1 protocol all matchall", "matchPattern": "^filter parent 1: protocol all pref 1 matchall.*handle 0xffffffff.*gact action continue.*ref 1 bind 1", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 root handle 1: prio", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY root handle 1: prio", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -217,17 +217,17 @@ "matchall" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 ingress" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY ingress" ], - "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 0x1 prio 1 protocol all matchall skip_hw action reclassify", + "cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol all matchall skip_hw action reclassify", "expExitCode": "0", - "verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 0x1 prio 1 protocol all matchall", + "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 0x1 prio 1 protocol all matchall", "matchPattern": "^filter parent ffff: protocol all pref 1 matchall.*handle 0x1.*skip_hw.*not_in_hw.*gact action reclassify.*ref 1 bind 1", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 ingress", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY ingress", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -238,17 +238,17 @@ "matchall" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 root handle 1: prio" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY root handle 1: prio" ], - "cmdUnderTest": "$TC filter add dev $DEV1 parent 1: handle 0x1 prio 1 protocol all matchall skip_hw action reclassify", + "cmdUnderTest": "$TC filter add dev $DUMMY parent 1: handle 0x1 prio 1 protocol all matchall skip_hw action reclassify", "expExitCode": "0", - "verifyCmd": "$TC filter get dev $DEV1 parent 1: handle 0x1 prio 1 protocol all matchall", + "verifyCmd": "$TC filter get dev $DUMMY parent 1: handle 0x1 prio 1 protocol all matchall", "matchPattern": "^filter parent 1: protocol all pref 1 matchall.*handle 0x1.*skip_hw.*not_in_hw.*gact action reclassify.*ref 1 bind 1", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 root handle 1: prio", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY root handle 1: prio", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -259,17 +259,17 @@ "matchall" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 ingress" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY ingress" ], - "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 0x1 prio 1 protocol ipv6 matchall classid 1:1 action pass", + "cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv6 matchall classid 1:1 action pass", "expExitCode": "0", - "verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 0x1 prio 1 protocol ipv6 matchall", + "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv6 matchall", "matchPattern": "^filter parent ffff: protocol ipv6 pref 1 matchall.*handle 0x1.*flowid 1:1.*gact action pass.*ref 1 bind 1", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 ingress", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY ingress", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -280,17 +280,17 @@ "matchall" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 ingress" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY ingress" ], - "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 0x1 prio 1 protocol ipv6 matchall classid 6789defg action pass", + "cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv6 matchall classid 6789defg action pass", "expExitCode": "1", - "verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 0x1 prio 1 protocol ipv6 matchall", + "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv6 matchall", "matchPattern": "^filter protocol ipv6 pref 1 matchall.*handle 0x1.*flowid 6789defg.*gact action pass.*ref 1 bind 1", "matchCount": "0", "teardown": [ - "$TC qdisc del dev $DEV1 ingress", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY ingress", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -301,18 +301,18 @@ "matchall" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 ingress", - "$TC filter add dev $DEV1 parent ffff: handle 0x1 prio 1 protocol ipv6 matchall classid 1:2 action pass" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY ingress", + "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv6 matchall classid 1:2 action pass" ], - "cmdUnderTest": "$TC filter del dev $DEV1 parent ffff: handle 0x1 prio 1 protocol ipv6 matchall", + "cmdUnderTest": "$TC filter del dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv6 matchall", "expExitCode": "0", - "verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 0x1 prio 1 protocol ipv6 matchall", + "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv6 matchall", "matchPattern": "^filter protocol ipv6 pref 1 matchall.*handle 0x1.*flowid 1:2.*gact action pass.*ref 1 bind 1", "matchCount": "0", "teardown": [ - "$TC qdisc del dev $DEV1 ingress", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY ingress", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -323,21 +323,21 @@ "matchall" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 ingress", - "$TC filter add dev $DEV1 parent ffff: handle 0x1 prio 1 protocol all matchall classid 1:2 action pass", - "$TC filter add dev $DEV1 parent ffff: handle 0x2 prio 2 protocol all matchall classid 1:3 action pass", - "$TC filter add dev $DEV1 parent ffff: handle 0x3 prio 3 protocol all matchall classid 1:4 action pass", - "$TC filter add dev $DEV1 parent ffff: handle 0x4 prio 4 protocol all matchall classid 1:5 action pass" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY ingress", + "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol all matchall classid 1:2 action pass", + "$TC filter add dev $DUMMY parent ffff: handle 0x2 prio 2 protocol all matchall classid 1:3 action pass", + "$TC filter add dev $DUMMY parent ffff: handle 0x3 prio 3 protocol all matchall classid 1:4 action pass", + "$TC filter add dev $DUMMY parent ffff: handle 0x4 prio 4 protocol all matchall classid 1:5 action pass" ], - "cmdUnderTest": "$TC filter del dev $DEV1 parent ffff:", + "cmdUnderTest": "$TC filter del dev $DUMMY parent ffff:", "expExitCode": "0", - "verifyCmd": "$TC filter show dev $DEV1 parent ffff:", + "verifyCmd": "$TC filter show dev $DUMMY parent ffff:", "matchPattern": "^filter protocol all pref.*matchall.*handle.*flowid.*gact action pass", "matchCount": "0", "teardown": [ - "$TC qdisc del dev $DEV1 ingress", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY ingress", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -348,21 +348,21 @@ "matchall" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 ingress", - "$TC filter add dev $DEV1 parent ffff: handle 0x1 prio 1 protocol all matchall classid 1:2 action pass", - "$TC filter add dev $DEV1 parent ffff: handle 0x2 prio 2 protocol all matchall classid 1:3 action pass", - "$TC filter add dev $DEV1 parent ffff: handle 0x3 prio 3 protocol all matchall classid 1:4 action pass", - "$TC filter add dev $DEV1 parent ffff: handle 0x4 prio 4 protocol all matchall classid 1:5 action pass" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY ingress", + "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol all matchall classid 1:2 action pass", + "$TC filter add dev $DUMMY parent ffff: handle 0x2 prio 2 protocol all matchall classid 1:3 action pass", + "$TC filter add dev $DUMMY parent ffff: handle 0x3 prio 3 protocol all matchall classid 1:4 action pass", + "$TC filter add dev $DUMMY parent ffff: handle 0x4 prio 4 protocol all matchall classid 1:5 action pass" ], - "cmdUnderTest": "$TC filter del dev $DEV1 parent ffff: protocol all handle 0x2 prio 2 matchall", + "cmdUnderTest": "$TC filter del dev $DUMMY parent ffff: protocol all handle 0x2 prio 2 matchall", "expExitCode": "0", - "verifyCmd": "$TC filter show dev $DEV1 parent ffff:", + "verifyCmd": "$TC filter show dev $DUMMY parent ffff:", "matchPattern": "^filter protocol all pref 2 matchall.*handle 0x2 flowid 1:2.*gact action pass", "matchCount": "0", "teardown": [ - "$TC qdisc del dev $DEV1 ingress", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY ingress", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -373,19 +373,19 @@ "matchall" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 ingress", - "$TC filter add dev $DEV1 parent ffff: handle 0x1 prio 1 protocol all chain 1 matchall classid 1:1 action pass", - "$TC filter add dev $DEV1 parent ffff: handle 0x1 prio 1 protocol ipv4 chain 2 matchall classid 1:3 action continue" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY ingress", + "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol all chain 1 matchall classid 1:1 action pass", + "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv4 chain 2 matchall classid 1:3 action continue" ], - "cmdUnderTest": "$TC filter del dev $DEV1 parent ffff: chain 2", + "cmdUnderTest": "$TC filter del dev $DUMMY parent ffff: chain 2", "expExitCode": "0", - "verifyCmd": "$TC filter show dev $DEV1 parent ffff:", + "verifyCmd": "$TC filter show dev $DUMMY parent ffff:", "matchPattern": "^filter protocol all pref 1 matchall chain 1 handle 0x1 flowid 1:1.*gact action pass", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 ingress", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY ingress", + "$IP link del dev $DUMMY type dummy" ] } ] diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/fifo.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/fifo.json index 9de61fa10878..5ecd93b4c473 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/fifo.json +++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/fifo.json @@ -8,16 +8,16 @@ "fifo" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 handle 1: root bfifo", + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root bfifo", "expExitCode": "0", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc bfifo 1: root.*limit [0-9]+b", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 handle 1: root bfifo", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY handle 1: root bfifo", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -29,16 +29,16 @@ "fifo" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 handle 1: root pfifo", + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root pfifo", "expExitCode": "0", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc pfifo 1: root.*limit [0-9]+p", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 handle 1: root pfifo", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY handle 1: root pfifo", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -49,16 +49,16 @@ "fifo" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 root handle ffff: bfifo", + "cmdUnderTest": "$TC qdisc add dev $DUMMY root handle ffff: bfifo", "expExitCode": "0", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc bfifo ffff: root.*limit [0-9]+b", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 handle ffff: root bfifo", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY handle ffff: root bfifo", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -69,16 +69,16 @@ "fifo" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 handle 1: root bfifo limit 3000b", + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root bfifo limit 3000b", "expExitCode": "0", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc bfifo 1: root.*limit 3000b", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 handle 1: root bfifo", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY handle 1: root bfifo", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -89,16 +89,16 @@ "fifo" ], "setup": [ - "$IP link add dev $DEV1 txqueuelen 3000 type dummy || /bin/true" + "$IP link add dev $DUMMY txqueuelen 3000 type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 handle 1: root pfifo limit 3000", + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root pfifo limit 3000", "expExitCode": "0", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc pfifo 1: root.*limit 3000p", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 handle 1: root pfifo", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY handle 1: root pfifo", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -109,15 +109,15 @@ "fifo" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 root handle 10000: bfifo", + "cmdUnderTest": "$TC qdisc add dev $DUMMY root handle 10000: bfifo", "expExitCode": "255", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc bfifo 10000: root.*limit [0-9]+b", "matchCount": "0", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] }, { @@ -128,15 +128,15 @@ "fifo" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 handle 1: root bfifo foorbar", + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root bfifo foorbar", "expExitCode": "1", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc bfifo 1: root", "matchCount": "0", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] }, { @@ -147,15 +147,15 @@ "fifo" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 handle 1: root pfifo foorbar", + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root pfifo foorbar", "expExitCode": "1", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc pfifo 1: root", "matchCount": "0", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] }, { @@ -166,18 +166,18 @@ "fifo" ], "setup": [ - "$IP link del dev $DEV1 type dummy || /bin/true", - "$IP link add dev $DEV1 txqueuelen 1000 type dummy", - "$TC qdisc add dev $DEV1 handle 1: root bfifo" + "$IP link del dev $DUMMY type dummy || /bin/true", + "$IP link add dev $DUMMY txqueuelen 1000 type dummy", + "$TC qdisc add dev $DUMMY handle 1: root bfifo" ], - "cmdUnderTest": "$TC qdisc replace dev $DEV1 handle 1: root bfifo limit 3000b", + "cmdUnderTest": "$TC qdisc replace dev $DUMMY handle 1: root bfifo limit 3000b", "expExitCode": "0", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc bfifo 1: root.*limit 3000b", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 handle 1: root bfifo", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY handle 1: root bfifo", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -188,18 +188,18 @@ "fifo" ], "setup": [ - "$IP link del dev $DEV1 type dummy || /bin/true", - "$IP link add dev $DEV1 txqueuelen 1000 type dummy", - "$TC qdisc add dev $DEV1 handle 1: root pfifo" + "$IP link del dev $DUMMY type dummy || /bin/true", + "$IP link add dev $DUMMY txqueuelen 1000 type dummy", + "$TC qdisc add dev $DUMMY handle 1: root pfifo" ], - "cmdUnderTest": "$TC qdisc replace dev $DEV1 handle 1: root pfifo limit 30", + "cmdUnderTest": "$TC qdisc replace dev $DUMMY handle 1: root pfifo limit 30", "expExitCode": "0", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc pfifo 1: root.*limit 30p", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 handle 1: root pfifo", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY handle 1: root pfifo", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -210,15 +210,15 @@ "fifo" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 handle 1: root bfifo limit foo-bar", + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root bfifo limit foo-bar", "expExitCode": "1", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc bfifo 1: root.*limit foo-bar", "matchCount": "0", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] }, { @@ -229,17 +229,17 @@ "fifo" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 handle 1: root bfifo" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY handle 1: root bfifo" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 handle 1: root bfifo", + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root bfifo", "expExitCode": "2", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc bfifo 1: root", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 handle 1: root bfifo", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY handle 1: root bfifo", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -250,15 +250,15 @@ "fifo" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc del dev $DEV1 root handle 1: bfifo", + "cmdUnderTest": "$TC qdisc del dev $DUMMY root handle 1: bfifo", "expExitCode": "2", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc bfifo 1: root", "matchCount": "0", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] }, { @@ -269,15 +269,15 @@ "fifo" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 root handle 123^ bfifo limit 100b", + "cmdUnderTest": "$TC qdisc add dev $DUMMY root handle 123^ bfifo limit 100b", "expExitCode": "255", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc bfifo 123 root", "matchCount": "0", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] }, { @@ -288,17 +288,17 @@ "fifo" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 root handle 1: bfifo", - "$TC qdisc del dev $DEV1 root handle 1: bfifo" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY root handle 1: bfifo", + "$TC qdisc del dev $DUMMY root handle 1: bfifo" ], - "cmdUnderTest": "$TC qdisc del dev $DEV1 handle 1: root bfifo", + "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 1: root bfifo", "expExitCode": "2", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc bfifo 1: root", "matchCount": "0", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] } ] diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/ingress.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/ingress.json index f518c55f468b..d99dba6e2b1a 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/ingress.json +++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/ingress.json @@ -7,16 +7,16 @@ "ingress" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 ingress", + "cmdUnderTest": "$TC qdisc add dev $DUMMY ingress", "expExitCode": "0", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc ingress ffff:", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 ingress", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY ingress", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -27,15 +27,15 @@ "ingress" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 ingress foorbar", + "cmdUnderTest": "$TC qdisc add dev $DUMMY ingress foorbar", "expExitCode": "1", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc ingress ffff:", "matchCount": "0", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] }, { @@ -46,17 +46,17 @@ "ingress" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 ingress" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY ingress" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 ingress", + "cmdUnderTest": "$TC qdisc add dev $DUMMY ingress", "expExitCode": "2", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc ingress ffff:", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 ingress", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY ingress", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -67,15 +67,15 @@ "ingress" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc del dev $DEV1 ingress", + "cmdUnderTest": "$TC qdisc del dev $DUMMY ingress", "expExitCode": "2", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc ingress ffff:", "matchCount": "0", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] }, { @@ -86,17 +86,17 @@ "ingress" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 ingress", - "$TC qdisc del dev $DEV1 ingress" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY ingress", + "$TC qdisc del dev $DUMMY ingress" ], - "cmdUnderTest": "$TC qdisc del dev $DEV1 ingress", + "cmdUnderTest": "$TC qdisc del dev $DUMMY ingress", "expExitCode": "2", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc ingress ffff:", "matchCount": "0", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] } ] diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/prio.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/prio.json index 9c792fa8ca23..3076c02d08d6 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/prio.json +++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/prio.json @@ -7,16 +7,16 @@ "prio" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 handle 1: root prio", + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root prio", "expExitCode": "0", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc prio 1: root", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 handle 1: root prio", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY handle 1: root prio", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -27,15 +27,15 @@ "prio" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 root handle ffff: prio", + "cmdUnderTest": "$TC qdisc add dev $DUMMY root handle ffff: prio", "expExitCode": "0", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc prio ffff: root", "matchCount": "1", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] }, { @@ -46,15 +46,15 @@ "prio" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 root handle 10000: prio", + "cmdUnderTest": "$TC qdisc add dev $DUMMY root handle 10000: prio", "expExitCode": "255", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc prio 10000: root", "matchCount": "0", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] }, { @@ -65,15 +65,15 @@ "prio" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 handle 1: root prio foorbar", + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root prio foorbar", "expExitCode": "1", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc prio 1: root", "matchCount": "0", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] }, { @@ -84,16 +84,16 @@ "prio" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 handle 1: root prio bands 4 priomap 1 1 2 2 3 3 0 0 1 2 3 0 0 0 0 0", + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root prio bands 4 priomap 1 1 2 2 3 3 0 0 1 2 3 0 0 0 0 0", "expExitCode": "0", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc prio 1: root.*bands 4 priomap.*1 1 2 2 3 3 0 0 1 2 3 0 0 0 0 0", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 handle 1: root prio", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY handle 1: root prio", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -104,15 +104,15 @@ "prio" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 handle 1: root prio bands 4 priomap 1 1 2 2 3 3 0 0 1 2 3 0 0 0 0 0 1 1", + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root prio bands 4 priomap 1 1 2 2 3 3 0 0 1 2 3 0 0 0 0 0 1 1", "expExitCode": "1", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc prio 1: root.*bands 4 priomap.*1 1 2 2 3 3 0 0 1 2 3 0 0 0 0 0 1 1", "matchCount": "0", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] }, { @@ -123,15 +123,15 @@ "prio" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 handle 1: root prio bands 4 priomap 1 1 2 2 7 5 0 0 1 2 3 0 0 0 0 0", + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root prio bands 4 priomap 1 1 2 2 7 5 0 0 1 2 3 0 0 0 0 0", "expExitCode": "1", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc prio 1: root.*bands 4 priomap.*1 1 2 2 7 5 0 0 1 2 3 0 0 0 0 0", "matchCount": "0", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] }, { @@ -142,15 +142,15 @@ "prio" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 handle 1: root prio bands 1 priomap 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0", + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root prio bands 1 priomap 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0", "expExitCode": "2", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc prio 1: root.*bands 1 priomap.*0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0", "matchCount": "0", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] }, { @@ -161,15 +161,15 @@ "prio" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 handle 1: root prio bands 1024 priomap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16", + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root prio bands 1024 priomap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16", "expExitCode": "2", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc prio 1: root.*bands 1024 priomap.*1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16", "matchCount": "0", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] }, { @@ -180,17 +180,17 @@ "prio" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 handle 1: root prio" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY handle 1: root prio" ], - "cmdUnderTest": "$TC qdisc replace dev $DEV1 handle 1: root prio bands 8 priomap 1 1 2 2 3 3 4 4 5 5 6 6 7 7 0 0", + "cmdUnderTest": "$TC qdisc replace dev $DUMMY handle 1: root prio bands 8 priomap 1 1 2 2 3 3 4 4 5 5 6 6 7 7 0 0", "expExitCode": "0", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc prio 1: root.*bands 8 priomap.*1 1 2 2 3 3 4 4 5 5 6 6 7 7 0 0", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 handle 1: root prio", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY handle 1: root prio", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -201,17 +201,17 @@ "prio" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 handle 1: root prio" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY handle 1: root prio" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 handle 1: root prio", + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root prio", "expExitCode": "2", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc prio 1: root", "matchCount": "1", "teardown": [ - "$TC qdisc del dev $DEV1 handle 1: root prio", - "$IP link del dev $DEV1 type dummy" + "$TC qdisc del dev $DUMMY handle 1: root prio", + "$IP link del dev $DUMMY type dummy" ] }, { @@ -222,15 +222,15 @@ "prio" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc del dev $DEV1 root handle 1: prio", + "cmdUnderTest": "$TC qdisc del dev $DUMMY root handle 1: prio", "expExitCode": "2", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc prio 1: root", "matchCount": "0", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] }, { @@ -241,15 +241,15 @@ "prio" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true" + "$IP link add dev $DUMMY type dummy || /bin/true" ], - "cmdUnderTest": "$TC qdisc add dev $DEV1 root handle 123^ prio", + "cmdUnderTest": "$TC qdisc add dev $DUMMY root handle 123^ prio", "expExitCode": "255", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc prio 123 root", "matchCount": "0", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] }, { @@ -260,17 +260,17 @@ "prio" ], "setup": [ - "$IP link add dev $DEV1 type dummy || /bin/true", - "$TC qdisc add dev $DEV1 root handle 1: prio", - "$TC qdisc del dev $DEV1 root handle 1: prio" + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY root handle 1: prio", + "$TC qdisc del dev $DUMMY root handle 1: prio" ], - "cmdUnderTest": "$TC qdisc del dev $DEV1 handle 1: root prio", + "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 1: root prio", "expExitCode": "2", - "verifyCmd": "$TC qdisc show dev $DEV1", + "verifyCmd": "$TC qdisc show dev $DUMMY", "matchPattern": "qdisc ingress ffff:", "matchCount": "0", "teardown": [ - "$IP link del dev $DEV1 type dummy" + "$IP link del dev $DUMMY type dummy" ] } ] diff --git a/tools/testing/selftests/tc-testing/tdc_config.py b/tools/testing/selftests/tc-testing/tdc_config.py index b771d4c89621..080709cc4297 100644 --- a/tools/testing/selftests/tc-testing/tdc_config.py +++ b/tools/testing/selftests/tc-testing/tdc_config.py @@ -16,6 +16,7 @@ NAMES = { 'DEV0': 'v0p0', 'DEV1': 'v0p1', 'DEV2': '', + 'DUMMY': 'dummy1', 'BATCH_FILE': './batch.txt', 'BATCH_DIR': 'tmp', # Length of time in seconds to wait before terminating a command From 14b54ac4fbb92f1a52966cc33477436de0f72965 Mon Sep 17 00:00:00 2001 From: Vlad Buslov Date: Mon, 19 Aug 2019 10:52:08 +0300 Subject: [PATCH 2/2] tc-testing: concurrency: wrap piped rule update commands Concurrent tests use several commands to update rules in parallel: 'find' prints names of batch files in tmp directory and pipes result to 'xargs' which runs instance of tc per batch file in parallel. This breaks when used with ns plugin that adds 'ip netns exec $NS' prefix to the command, which causes only first command in pipe to be executed in namespace: =====> Test e41d: Add 1M flower filters with 10 parallel tc instances -----> prepare stage ns/SubPlugin.adjust_command adjust_command: stage is setup; inserting netns stuff in command [/bin/mkdir tmp] list [['/bin/mkdir', 'tmp']] adjust_command: return command [ip netns exec tcut /bin/mkdir tmp] command "ip netns exec tcut /bin/mkdir tmp" ns/SubPlugin.adjust_command adjust_command: stage is setup; inserting netns stuff in command [/sbin/tc qdisc add dev ens1f0 ingress] list [['/sbin/tc', 'qdisc', 'add', 'dev', 'ens1f0', 'ingress']] adjust_command: return command [ip netns exec tcut /sbin/tc qdisc add dev ens1f0 ingress] command "ip netns exec tcut /sbin/tc qdisc add dev ens1f0 ingress" ns/SubPlugin.adjust_command adjust_command: stage is setup; inserting netns stuff in command [./tdc_multibatch.py ens1f0 tmp 100000 10 add] list [['./tdc_multibatch.py', 'ens1f0', 'tmp', '100000', '10', 'add']] adjust_command: return command [ip netns exec tcut ./tdc_multibatch.py ens1f0 tmp 100000 10 add] command "ip netns exec tcut ./tdc_multibatch.py ens1f0 tmp 100000 10 add" -----> execute stage ns/SubPlugin.adjust_command adjust_command: stage is execute; inserting netns stuff in command [find tmp/add* -print | xargs -n 1 -P 10 /sbin/tc -b] list [['find', 'tmp/add*', '-print', '|', 'xargs', '-n', '1', '-P', '10', '/sbin/tc', '-b'] ] adjust_command: return command [ip netns exec tcut find tmp/add* -print | xargs -n 1 -P 10 /sbin/tc -b] command "ip netns exec tcut find tmp/add* -print | xargs -n 1 -P 10 /sbin/tc -b" exit: 123 exit: 0 Cannot find device "ens1f0" Cannot find device "ens1f0" Command failed tmp/add_0:1 Command failed tmp/add_1:1 Cannot find device "ens1f0" Command failed tmp/add_2:1 Cannot find device "ens1f0" Command failed tmp/add_4:1 Cannot find device "ens1f0" Command failed tmp/add_3:1 Cannot find device "ens1f0" Command failed tmp/add_5:1 Cannot find device "ens1f0" Command failed tmp/add_6:1 Cannot find device "ens1f0" Command failed tmp/add_8:1 Cannot find device "ens1f0" Command failed tmp/add_7:1 Cannot find device "ens1f0" Command failed tmp/add_9:1 Fix the issue by executing whole compound command in namespace by wrapping it in 'bash -c' invocation. Fixes: 489ce2f42514 ("tc-testing: Restore original behaviour for namespaces in tdc") Signed-off-by: Vlad Buslov Signed-off-by: David S. Miller --- .../tc-tests/filters/concurrency.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/tc-testing/tc-tests/filters/concurrency.json b/tools/testing/selftests/tc-testing/tc-tests/filters/concurrency.json index 9002714b1851..c2a433a4737e 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/filters/concurrency.json +++ b/tools/testing/selftests/tc-testing/tc-tests/filters/concurrency.json @@ -12,7 +12,7 @@ "$TC qdisc add dev $DEV2 ingress", "./tdc_multibatch.py $DEV2 $BATCH_DIR 100000 10 add" ], - "cmdUnderTest": "find $BATCH_DIR/add* -print | xargs -n 1 -P 10 $TC -b", + "cmdUnderTest": "bash -c \"find $BATCH_DIR/add* -print | xargs -n 1 -P 10 $TC -b\"", "expExitCode": "0", "verifyCmd": "$TC -s filter show dev $DEV2 ingress", "matchPattern": "filter protocol ip pref 1 flower chain 0 handle", @@ -37,7 +37,7 @@ "$TC -b $BATCH_DIR/add_0", "./tdc_multibatch.py $DEV2 $BATCH_DIR 100000 10 del" ], - "cmdUnderTest": "find $BATCH_DIR/del* -print | xargs -n 1 -P 10 $TC -b", + "cmdUnderTest": "bash -c \"find $BATCH_DIR/del* -print | xargs -n 1 -P 10 $TC -b\"", "expExitCode": "0", "verifyCmd": "$TC -s filter show dev $DEV2 ingress", "matchPattern": "filter protocol ip pref 1 flower chain 0 handle", @@ -62,7 +62,7 @@ "$TC -b $BATCH_DIR/add_0", "./tdc_multibatch.py $DEV2 $BATCH_DIR 100000 10 replace" ], - "cmdUnderTest": "find $BATCH_DIR/replace* -print | xargs -n 1 -P 10 $TC -b", + "cmdUnderTest": "bash -c \"find $BATCH_DIR/replace* -print | xargs -n 1 -P 10 $TC -b\"", "expExitCode": "0", "verifyCmd": "$TC -s filter show dev $DEV2 ingress", "matchPattern": "filter protocol ip pref 1 flower chain 0 handle", @@ -87,7 +87,7 @@ "$TC -b $BATCH_DIR/add_0", "./tdc_multibatch.py -d $DEV2 $BATCH_DIR 100000 10 replace" ], - "cmdUnderTest": "find $BATCH_DIR/replace* -print | xargs -n 1 -P 10 $TC -b", + "cmdUnderTest": "bash -c \"find $BATCH_DIR/replace* -print | xargs -n 1 -P 10 $TC -b\"", "expExitCode": "0", "verifyCmd": "$TC -s filter show dev $DEV2 ingress", "matchPattern": "filter protocol ip pref 1 flower chain 0 handle", @@ -112,7 +112,7 @@ "$TC -b $BATCH_DIR/add_0", "./tdc_multibatch.py -d $DEV2 $BATCH_DIR 100000 10 del" ], - "cmdUnderTest": "find $BATCH_DIR/del* -print | xargs -n 1 -P 10 $TC -f -b", + "cmdUnderTest": "bash -c \"find $BATCH_DIR/del* -print | xargs -n 1 -P 10 $TC -f -b\"", "expExitCode": "123", "verifyCmd": "$TC -s filter show dev $DEV2 ingress", "matchPattern": "filter protocol ip pref 1 flower chain 0 handle", @@ -134,11 +134,11 @@ "/bin/mkdir $BATCH_DIR", "$TC qdisc add dev $DEV2 ingress", "./tdc_multibatch.py -x init_ $DEV2 $BATCH_DIR 100000 5 add", - "find $BATCH_DIR/init_* -print | xargs -n 1 -P 5 $TC -b", + "bash -c \"find $BATCH_DIR/init_* -print | xargs -n 1 -P 5 $TC -b\"", "./tdc_multibatch.py -x par_ -a 500001 -m 5 $DEV2 $BATCH_DIR 100000 5 add", "./tdc_multibatch.py -x par_ $DEV2 $BATCH_DIR 100000 5 del" ], - "cmdUnderTest": "find $BATCH_DIR/par_* -print | xargs -n 1 -P 10 $TC -b", + "cmdUnderTest": "bash -c \"find $BATCH_DIR/par_* -print | xargs -n 1 -P 10 $TC -b\"", "expExitCode": "0", "verifyCmd": "$TC -s filter show dev $DEV2 ingress", "matchPattern": "filter protocol ip pref 1 flower chain 0 handle", @@ -160,11 +160,11 @@ "/bin/mkdir $BATCH_DIR", "$TC qdisc add dev $DEV2 ingress", "./tdc_multibatch.py -x init_ $DEV2 $BATCH_DIR 100000 10 add", - "find $BATCH_DIR/init_* -print | xargs -n 1 -P 5 $TC -b", + "bash -c \"find $BATCH_DIR/init_* -print | xargs -n 1 -P 5 $TC -b\"", "./tdc_multibatch.py -x par_ -a 500001 -m 5 $DEV2 $BATCH_DIR 100000 5 replace", "./tdc_multibatch.py -x par_ $DEV2 $BATCH_DIR 100000 5 del" ], - "cmdUnderTest": "find $BATCH_DIR/par_* -print | xargs -n 1 -P 10 $TC -b", + "cmdUnderTest": "bash -c \"find $BATCH_DIR/par_* -print | xargs -n 1 -P 10 $TC -b\"", "expExitCode": "0", "verifyCmd": "$TC -s filter show dev $DEV2 ingress", "matchPattern": "filter protocol ip pref 1 flower chain 0 handle",