Commit 3f2d94a4 authored by Pedro Tammela's avatar Pedro Tammela Committed by Jakub Kicinski

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: default avatarPedro Tammela <pctammela@mojatatu.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Link: https://lore.kernel.org/r/20231117171208.2066136-5-pctammela@mojatatu.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 3d5026fc
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment