From: Haiyang Zhao <haiyangx.zhao@intel.com>
To: dts@dpdk.org
Cc: Haiyang Zhao <haiyangx.zhao@intel.com>
Subject: [dts] [PATCH V1] tests/port_control: optimize code
Date: Fri, 10 Apr 2020 13:13:39 +0800 [thread overview]
Message-ID: <1586495619-37997-1-git-send-email-haiyangx.zhao@intel.com> (raw)
*.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@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 reply other threads:[~2020-04-10 5:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-10 5:13 Haiyang Zhao [this message]
2020-04-17 5:24 ` Zhao, XinfengX
2020-04-20 2:18 ` Tu, Lijuan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1586495619-37997-1-git-send-email-haiyangx.zhao@intel.com \
--to=haiyangx.zhao@intel.com \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).