[dts] [PATCH V1] tests/port_control: optimize code
Zhao, XinfengX
xinfengx.zhao at intel.com
Fri Apr 17 07:24:43 CEST 2020
Tested-by: Zhao, Xinfeng<xinfengx.zhao at intel.com>
-----Original Message-----
From: dts [mailto:dts-bounces at dpdk.org] On Behalf Of Haiyang Zhao
Sent: Friday, April 10, 2020 1:14 PM
To: dts at dpdk.org
Cc: Zhao, HaiyangX <haiyangx.zhao at intel.com>
Subject: [dts] [PATCH V1] tests/port_control: optimize code
*.when interface is active, bind to igb_uio will be failed,
flush ip and bind by force.
*.vm_testpmd is generated in the first case, if it failed will impact the second case, add judgement for it.
Signed-off-by: Haiyang Zhao <haiyangx.zhao at intel.com>
---
tests/TestSuite_port_control.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tests/TestSuite_port_control.py b/tests/TestSuite_port_control.py index 385eff6..1a588d3 100644
--- a/tests/TestSuite_port_control.py
+++ b/tests/TestSuite_port_control.py
@@ -156,7 +156,8 @@ class TestPortControl(TestCase):
vf_pci = re.findall(r"(\d+.\d+.\d+.\d+)", drive_info.split("kernel")[1])
terminal.send_expect("ifconfig %s hw ether %s" % (vf_if[1], self.vf_mac), "#")
terminal.send_expect("ifconfig %s up" % vf_if[1], "#")
- terminal.send_expect("./usertools/dpdk-devbind.py -b igb_uio %s" % vf_pci[1], "#")
+ terminal.send_expect("ip addr flush %s " % vf_if[1], "#")
+ terminal.send_expect("./usertools/dpdk-devbind.py -b igb_uio
+ --force %s" % vf_pci[1], "#")
cmd = "./%s/app/testpmd -n 1 -w %s -- -i" % (self.target, vf_pci[1])
terminal.send_expect(cmd, "testpmd>", 10)
@@ -178,7 +179,7 @@ class TestPortControl(TestCase):
terminal.execute_cmd("stop")
terminal.execute_cmd("port stop all")
ret = terminal.get_port_link_status(self.port_id_0)
- if self.nic.startswith('columbiaville') or terminal is self.vm_testpmd:
+ if self.nic.startswith('columbiaville') or (getattr(self, 'vm_testpmd', None) and terminal is self.vm_testpmd):
self.verify(ret != "", "port status error!")
else:
self.verify(ret == "down", "port not down!") @@ -187,7 +188,7 @@ class TestPortControl(TestCase):
def reset_pmd_port(self, terminal):
terminal.execute_cmd("port reset all")
ret = terminal.get_port_link_status(self.port_id_0)
- if self.nic.startswith('columbiaville') or terminal is self.vm_testpmd:
+ if self.nic.startswith('columbiaville') or (getattr(self, 'vm_testpmd', None) and terminal is self.vm_testpmd):
self.verify(ret != "", "port status error!")
else:
self.verify(ret == "down", "port not down!")
--
2.20.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestPortControl.log
Type: application/octet-stream
Size: 80100 bytes
Desc: TestPortControl.log
URL: <http://mails.dpdk.org/archives/dts/attachments/20200417/83b7b7b5/attachment.obj>
More information about the dts
mailing list