[PATCH net-next v2 10/12] selftests: tc-testing: run dependsOn probes outside the test namespace

From: Todd Freed

Date: Wed Nov 18 2026 - 20:32:53 EST


A test's dependsOn probe runs as an execute stage command, but before
the test's namespace is created. nsPlugin prefixes the command with
"ip netns exec tcut", which makes it fail. Every test with a probe
that requires nsPlugin is therefore skipped currently, for example the
mirred blockid tests and the tunnel_key nofrag test.

Probes are meant to check what tc and the kernel support, not anything
in the test's namespace. Run them as their own stage ("probe"), which
makes them run in the base namespace. Add the stage to the README, and
say in AddingTestCases.txt that dependsOn runs in the base namespace.

Fixes: 98cfbe4234a4 ("selftests/tc-testing: localize test resources")
Signed-off-by: Todd Freed <toddfreed@xxxxxxxx>
---
tools/testing/selftests/tc-testing/README | 1 +
.../tc-testing/creating-testcases/AddingTestCases.txt | 4 +++-
tools/testing/selftests/tc-testing/tdc.py | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/tc-testing/README b/tools/testing/selftests/tc-testing/README
index fc8e858ff119..430ac0bf68ab 100644
--- a/tools/testing/selftests/tc-testing/README
+++ b/tools/testing/selftests/tc-testing/README
@@ -168,6 +168,7 @@ of the command.
The stages are identified by the following strings:

- pre (pre-suite)
+ - probe (dependsOn, before setup)
- setup
- command
- verify
diff --git a/tools/testing/selftests/tc-testing/creating-testcases/AddingTestCases.txt b/tools/testing/selftests/tc-testing/creating-testcases/AddingTestCases.txt
index ff956d8c99c5..c61f2e2020e0 100644
--- a/tools/testing/selftests/tc-testing/creating-testcases/AddingTestCases.txt
+++ b/tools/testing/selftests/tc-testing/creating-testcases/AddingTestCases.txt
@@ -39,7 +39,9 @@ skip: A completely optional key, if the corresponding value is "yes"
marked as skipped. This key can be placed anywhere inside the
test case at the top level.
dependsOn: Same as 'skip', but the value is executed as a command. The test
- is skipped when the command returns non-zero.
+ is skipped when the command returns non-zero. The command runs
+ in the base namespace, before setup, so it can't use the test's
+ devices.
category: A list of single-word descriptions covering what the command
under test is testing. Example: filter, actions, u32, gact, etc.
setup: The list of commands required to ensure the command under test
diff --git a/tools/testing/selftests/tc-testing/tdc.py b/tools/testing/selftests/tc-testing/tdc.py
index 511d66c36a2a..541caf984519 100755
--- a/tools/testing/selftests/tc-testing/tdc.py
+++ b/tools/testing/selftests/tc-testing/tdc.py
@@ -399,7 +399,7 @@ def run_one_test(pm, args, index, tidx):
if 'dependsOn' in tidx:
if (args.verbose > 0):
print('probe command for test skip')
- (p, procout) = exec_cmd(tidx, args, pm, 'execute', tidx['dependsOn'])
+ (p, procout) = exec_cmd(tidx, args, pm, 'probe', tidx['dependsOn'])
if p:
if (p.returncode != 0):
res = TestResult(tidx['id'], tidx['name'])
--
2.53.1-Meta