Skip to content

Commit 02a3f0d

Browse files
dcarattidavem330
authored andcommitted
tc-testing: don't hardcode 'ip' in nsPlugin.py
the following tdc test fails on Fedora: # ./tdc.py -e 2638 -- ns/SubPlugin.__init__ Test 2638: Add matchall and try to get it -----> prepare stage *** Could not execute: "$TC qdisc add dev $DEV1 clsact" -----> prepare stage *** Error message: "/bin/sh: ip: command not found" returncode 127; expected [0] -----> prepare stage *** Aborting test run. Let nsPlugin.py use the 'IP' variable introduced with commit 92c1a19 ("tc-tests: added path to ip command in tdc"), so that the path to 'ip' is correctly resolved to the value we have in tdc_config.py. # ./tdc.py -e 2638 -- ns/SubPlugin.__init__ Test 2638: Add matchall and try to get it All test results: 1..1 ok 1 2638 - Add matchall and try to get it Fixes: 489ce2f ("tc-testing: Restore original behaviour for namespaces in tdc") Reported-by: Hangbin Liu <[email protected]> Signed-off-by: Davide Caratti <[email protected]> Acked-by: Nicolas Dichtel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3daa418 commit 02a3f0d

File tree

1 file changed

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

1 file changed

+11
-11
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def adjust_command(self, stage, command):
6464
cmdlist.insert(0, self.args.NAMES['NS'])
6565
cmdlist.insert(0, 'exec')
6666
cmdlist.insert(0, 'netns')
67-
cmdlist.insert(0, 'ip')
67+
cmdlist.insert(0, self.args.NAMES['IP'])
6868
else:
6969
pass
7070

@@ -78,16 +78,16 @@ def adjust_command(self, stage, command):
7878
return command
7979

8080
def _ports_create(self):
81-
cmd = 'ip link add $DEV0 type veth peer name $DEV1'
81+
cmd = '$IP link add $DEV0 type veth peer name $DEV1'
8282
self._exec_cmd('pre', cmd)
83-
cmd = 'ip link set $DEV0 up'
83+
cmd = '$IP link set $DEV0 up'
8484
self._exec_cmd('pre', cmd)
8585
if not self.args.namespace:
86-
cmd = 'ip link set $DEV1 up'
86+
cmd = '$IP link set $DEV1 up'
8787
self._exec_cmd('pre', cmd)
8888

8989
def _ports_destroy(self):
90-
cmd = 'ip link del $DEV0'
90+
cmd = '$IP link del $DEV0'
9191
self._exec_cmd('post', cmd)
9292

9393
def _ns_create(self):
@@ -97,16 +97,16 @@ def _ns_create(self):
9797
'''
9898
self._ports_create()
9999
if self.args.namespace:
100-
cmd = 'ip netns add {}'.format(self.args.NAMES['NS'])
100+
cmd = '$IP netns add {}'.format(self.args.NAMES['NS'])
101101
self._exec_cmd('pre', cmd)
102-
cmd = 'ip link set $DEV1 netns {}'.format(self.args.NAMES['NS'])
102+
cmd = '$IP link set $DEV1 netns {}'.format(self.args.NAMES['NS'])
103103
self._exec_cmd('pre', cmd)
104-
cmd = 'ip -n {} link set $DEV1 up'.format(self.args.NAMES['NS'])
104+
cmd = '$IP -n {} link set $DEV1 up'.format(self.args.NAMES['NS'])
105105
self._exec_cmd('pre', cmd)
106106
if self.args.device:
107-
cmd = 'ip link set $DEV2 netns {}'.format(self.args.NAMES['NS'])
107+
cmd = '$IP link set $DEV2 netns {}'.format(self.args.NAMES['NS'])
108108
self._exec_cmd('pre', cmd)
109-
cmd = 'ip -n {} link set $DEV2 up'.format(self.args.NAMES['NS'])
109+
cmd = '$IP -n {} link set $DEV2 up'.format(self.args.NAMES['NS'])
110110
self._exec_cmd('pre', cmd)
111111

112112
def _ns_destroy(self):
@@ -115,7 +115,7 @@ def _ns_destroy(self):
115115
devices as well)
116116
'''
117117
if self.args.namespace:
118-
cmd = 'ip netns delete {}'.format(self.args.NAMES['NS'])
118+
cmd = '$IP netns delete {}'.format(self.args.NAMES['NS'])
119119
self._exec_cmd('post', cmd)
120120

121121
def _exec_cmd(self, stage, command):

0 commit comments

Comments
 (0)