summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py
diff options
context:
space:
mode:
authorPedro Tammela <pctammela@mojatatu.com>2023-11-17 14:12:06 -0300
committerJakub Kicinski <kuba@kernel.org>2023-11-20 18:06:36 -0800
commit3f2d94a4ff489ebbc6b66cc33f9775cb33c00533 (patch)
tree596e39e2f8b61a291a4f56be2873f3697309337e /tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py
parent3d5026fc5adbc796a0547fcef19d997786e0bb31 (diff)
downloadlinux-3f2d94a4ff489ebbc6b66cc33f9775cb33c00533.tar.gz
linux-3f2d94a4ff489ebbc6b66cc33f9775cb33c00533.tar.bz2
linux-3f2d94a4ff489ebbc6b66cc33f9775cb33c00533.zip
selftests: tc-testing: leverage -all in suite ns teardown
Instead of listing lingering ns pinned files and delete them one by one, leverage '-all' from iproute2 to do it in a single process fork. Signed-off-by: Pedro Tammela <pctammela@mojatatu.com> Reviewed-by: Simon Horman <horms@kernel.org> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Link: https://lore.kernel.org/r/20231117171208.2066136-5-pctammela@mojatatu.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py')
-rw-r--r--tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py b/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py
index 920dcbedc395..7b674befceec 100644
--- a/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py
+++ b/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py
@@ -74,13 +74,12 @@ class SubPlugin(TdcPlugin):
print('{}.post_suite'.format(self.sub_class))
# Make sure we don't leak resources
- for f in os.listdir('/run/netns/'):
- cmd = self._replace_keywords("$IP netns del {}".format(f))
+ cmd = "$IP -a netns del"
- if self.args.verbose > 3:
- print('_exec_cmd: command "{}"'.format(cmd))
+ if self.args.verbose > 3:
+ print('_exec_cmd: command "{}"'.format(cmd))
- subprocess.run(cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+ subprocess.run(cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
def adjust_command(self, stage, command):
super().adjust_command(stage, command)