From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 159F8A0599; Fri, 10 Apr 2020 07:20:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BD71B1C2F1; Fri, 10 Apr 2020 07:20:25 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id AC3061C297 for ; Fri, 10 Apr 2020 07:20:24 +0200 (CEST) IronPort-SDR: Ditvo1+D4gs0gY2MwhulQ0IN+SWsLpAMF3rlkW9ud+5vc6hmXxIetb7JiKCmJevdLd+oXKllwQ 3mbSMkKzNsiQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2020 22:20:23 -0700 IronPort-SDR: 6uIZLMOiEgW8fCVmzEvlpDNM9xmwXwLR+2mB9LbOiwfN8NdNp/FECCUF7Q6R8osxTiBw1KbKuQ 4kjICYiyJtjA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,364,1580803200"; d="scan'208";a="287114144" Received: from unknown (HELO dpdk-zhaohy-t.localdomain) ([10.240.183.68]) by fmsmga002.fm.intel.com with ESMTP; 09 Apr 2020 22:20:22 -0700 From: Haiyang Zhao To: dts@dpdk.org Cc: Haiyang Zhao Date: Fri, 10 Apr 2020 13:13:39 +0800 Message-Id: <1586495619-37997-1-git-send-email-haiyangx.zhao@intel.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dts] [PATCH V1] tests/port_control: optimize code X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" *.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 --- 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