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

selftests: tc-testing: use netns delete from pyroute2

When pyroute2 is available, use the native netns delete routine instead
of calling iproute2 to do it. As forks are expensive with some kernel
configs, minimize its usage to avoid kselftests timeouts.
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-4-pctammela@mojatatu.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 50a5988a
......@@ -64,6 +64,9 @@ class SubPlugin(TdcPlugin):
if self.args.verbose:
print('{}.post_case'.format(self.sub_class))
if netlink == True:
self._nl_ns_destroy()
else:
self._ns_destroy()
def post_suite(self, index):
......@@ -174,6 +177,10 @@ class SubPlugin(TdcPlugin):
'''
self._exec_cmd_batched('pre', self._ns_create_cmds())
def _nl_ns_destroy(self):
ns = self.args.NAMES['NS']
netns.remove(ns)
def _ns_destroy_cmd(self):
return self._replace_keywords('netns delete {}'.format(self.args.NAMES['NS']))
......
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