Skip to content

Commit 3f2d94a

Browse files
tammelakuba-moo
authored andcommitted
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>
1 parent 3d5026f commit 3f2d94a

File tree

1 file changed

+4
-5
lines changed
  • tools/testing/selftests/tc-testing/plugin-lib

1 file changed

+4
-5
lines changed

tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,12 @@ def post_suite(self, index):
7474
print('{}.post_suite'.format(self.sub_class))
7575

7676
# Make sure we don't leak resources
77-
for f in os.listdir('/run/netns/'):
78-
cmd = self._replace_keywords("$IP netns del {}".format(f))
77+
cmd = "$IP -a netns del"
7978

80-
if self.args.verbose > 3:
81-
print('_exec_cmd: command "{}"'.format(cmd))
79+
if self.args.verbose > 3:
80+
print('_exec_cmd: command "{}"'.format(cmd))
8281

83-
subprocess.run(cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
82+
subprocess.run(cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
8483

8584
def adjust_command(self, stage, command):
8685
super().adjust_command(stage, command)

0 commit comments

Comments
 (0)