From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 67FA52A58 for ; Mon, 19 Sep 2016 16:28:23 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 19 Sep 2016 07:27:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,362,1470726000"; d="scan'208";a="1053314577" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga002.jf.intel.com with ESMTP; 19 Sep 2016 07:27:56 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 19 Sep 2016 07:27:55 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.234]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.118]) with mapi id 14.03.0248.002; Mon, 19 Sep 2016 22:27:53 +0800 From: "Liu, Yong" To: "Tu, LijuanX A" , "dts@dpdk.org" CC: "Tu, LijuanX A" Thread-Topic: [dts] [PATCH v2]vf cases: fix cases not clear resources Thread-Index: AQHSEjY9qFSPhmQYUkaUUkJbah4F4KCA27qw Date: Mon, 19 Sep 2016 14:27:52 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E602DA1F6@SHSMSX103.ccr.corp.intel.com> References: <1474262788-20471-1-git-send-email-lijuanx.a.tu@intel.com> In-Reply-To: <1474262788-20471-1-git-send-email-lijuanx.a.tu@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTMxMTMwMzItY2FkOC00MTY1LTkyZDktNDQ1ZDE3M2I4YTI2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6Ilwvd05cL1wvOTZoaUk2Q3ZpcnBcLzE4ZXRlTFFjWm5Cdk5CZnBTMWxkbXNhaHkwPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH v2]vf cases: fix cases not clear resources 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: , X-List-Received-Date: Mon, 19 Sep 2016 14:28:24 -0000 > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Lijuan Tu > Sent: Monday, September 19, 2016 1:26 PM > To: dts@dpdk.org > Cc: Tu, LijuanX A > Subject: [dts] [PATCH v2]vf cases: fix cases not clear resources >=20 > vf_jumboframe,vf_offload,vf_packet_rxtx,vf_port_start_stop,vf_vlani: >=20 > "used_dut_port =3D=3D 0" is ture, so the judgement is error. >=20 > Signed-off-by: Lijuan Tu > --- > tests/TestSuite_vf_jumboframe.py | 9 +++++---- > tests/TestSuite_vf_offload.py | 8 +++++--- > tests/TestSuite_vf_packet_rxtx.py | 19 ++++++++++--------- > tests/TestSuite_vf_port_start_stop.py | 13 +++++++------ > tests/TestSuite_vf_vlan.py | 6 +++--- > 5 files changed, 30 insertions(+), 25 deletions(-) >=20 > diff --git a/tests/TestSuite_vf_jumboframe.py > b/tests/TestSuite_vf_jumboframe.py > index bac4a29..e0cbbcf 100644 > --- a/tests/TestSuite_vf_jumboframe.py > +++ b/tests/TestSuite_vf_jumboframe.py > @@ -4,6 +4,7 @@ import re > import time >=20 > import dts > +import utils > from qemu_kvm import QEMUKvm > from test_case import TestCase > from pmd_output import PmdOutput > @@ -60,7 +61,7 @@ class TestVfJumboFrame(TestCase): > for port in ports: > netdev =3D self.dut.ports_info[port]['port'] > driver_now =3D netdev.get_nic_driver() > - if driver =3D=3D "": > + if driver =3D=3D None: > driver =3D netdev.default_driver > if driver !=3D driver_now: > netdev.bind_driver(driver=3Ddriver) > @@ -125,11 +126,11 @@ class TestVfJumboFrame(TestCase): > self.vm.stop() > self.vm =3D None >=20 > - if getattr(self, 'used_dut_port', None): > + time.sleep(3) Framework should take the responsibility to make sure everything can work a= fter stop virtual machine. As I known, we will wait 5 seconds after vm stop. Could you please check wh= at's the issue?=20 > + if getattr(self, 'used_dut_port', None) !=3D None: Please following code style, here should be "is not None". > self.dut.destroy_sriov_vfs_by_port(self.used_dut_port) > self.used_dut_port =3D None > - > - self.bind_nic_driver(self.dut_ports[:1], driver=3D"igb_uio") > + self.bind_nic_driver(self.dut_ports[:1], driver=3D'default') >=20 > self.env_done =3D False >=20 > diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.p= y > index 78fa5a6..3551e2d 100644 > --- a/tests/TestSuite_vf_offload.py > +++ b/tests/TestSuite_vf_offload.py > @@ -2,15 +2,16 @@ >=20 > import re > import time > +import string >=20 > import dts > +import utils > from qemu_kvm import QEMUKvm > from test_case import TestCase > from pmd_output import PmdOutput > from utils import RED, GREEN > from net_device import NetDevice > from crb import Crb > -from scapy.all import * > from settings import HEADER_SIZE > VM_CORES_MASK =3D 'all' >=20 > @@ -79,17 +80,18 @@ class TestVfOffload(TestCase): > self.vm0.stop() > self.vm0 =3D None >=20 > + time.sleep(3) > if getattr(self, 'host_testpmd', None): > self.host_testpmd.execute_cmd('quit', '# ') > self.host_testpmd =3D None >=20 > - if getattr(self, 'used_dut_port_0', None): > + if getattr(self, 'used_dut_port_0', None) !=3D None: > self.dut.destroy_sriov_vfs_by_port(self.used_dut_port_0) > port =3D self.dut.ports_info[self.used_dut_port_0]['port'] > port.bind_driver() > self.used_dut_port_0 =3D None >=20 > - if getattr(self, 'used_dut_port_1', None): > + if getattr(self, 'used_dut_port_1', None) !=3D None: > self.dut.destroy_sriov_vfs_by_port(self.used_dut_port_1) > port =3D self.dut.ports_info[self.used_dut_port_1]['port'] > port.bind_driver() > diff --git a/tests/TestSuite_vf_packet_rxtx.py > b/tests/TestSuite_vf_packet_rxtx.py > index 2f9dfc1..9ae1e73 100644 > --- a/tests/TestSuite_vf_packet_rxtx.py > +++ b/tests/TestSuite_vf_packet_rxtx.py > @@ -3,7 +3,6 @@ > import re > import time >=20 > -import dts > from qemu_kvm import QEMUKvm > from test_case import TestCase > from pmd_output import PmdOutput > @@ -82,13 +81,13 @@ class TestVfPacketRxtx(TestCase): > self.host_testpmd.execute_cmd('quit', '# ') > self.host_testpmd =3D None >=20 > - if getattr(self, 'used_dut_port_0', None): > + if getattr(self, 'used_dut_port_0', None) !=3D None: > self.dut.destroy_sriov_vfs_by_port(self.used_dut_port_0) > port =3D self.dut.ports_info[self.used_dut_port_0]['port'] > port.bind_driver() > self.used_dut_port_0 =3D None >=20 > - if getattr(self, 'used_dut_port_1', None): > + if getattr(self, 'used_dut_port_1', None) !=3D None: > self.dut.destroy_sriov_vfs_by_port(self.used_dut_port_1) > port =3D self.dut.ports_info[self.used_dut_port_1]['port'] > port.bind_driver() > @@ -200,8 +199,9 @@ class TestVfPacketRxtx(TestCase): >=20 > def destroy_3vf_2vm_env(self): > if getattr(self, 'vm0', None): > - self.vm0_testpmd.execute_cmd('stop') > - self.vm0_testpmd.execute_cmd('quit', '# ') In virtualization case, there're lots of entities should be freed in destro= y function. Is there any common solution for this purpose? There need one simple functi= on that can help us make sure environment clean. > + if getattr(self, 'vm0_testpmd', None): > + self.vm0_testpmd.execute_cmd('stop') > + self.vm0_testpmd.execute_cmd('quit', '# ') > self.vm0_testpmd =3D None > self.vm0_dut_ports =3D None > self.vm_dut_0 =3D None > @@ -209,19 +209,20 @@ class TestVfPacketRxtx(TestCase): > self.vm0 =3D None >=20 > if getattr(self, 'vm1', None): > - self.vm1_testpmd.execute_cmd('stop') > - self.vm1_testpmd.execute_cmd('quit', '# ') > + if getattr(self, 'vm1_testpmd', None): > + self.vm1_testpmd.execute_cmd('stop') > + self.vm1_testpmd.execute_cmd('quit', '# ') > self.vm1_testpmd =3D None > self.vm1_dut_ports =3D None > self.vm_dut_1 =3D None > self.vm1.stop() > self.vm1 =3D None >=20 > - if getattr(self, 'host_testpmd', None): > + if getattr(self, 'host_testpmd', None) !=3D None: > self.host_testpmd.execute_cmd('quit', '# ') > self.host_testpmd =3D None >=20 > - if getattr(self, 'used_dut_port', None): > + if getattr(self, 'used_dut_port', None) !=3D None: > self.dut.destroy_sriov_vfs_by_port(self.used_dut_port) > port =3D self.dut.ports_info[self.used_dut_port]['port'] > port.bind_driver() > diff --git a/tests/TestSuite_vf_port_start_stop.py > b/tests/TestSuite_vf_port_start_stop.py > index 7657879..078b926 100644 > --- a/tests/TestSuite_vf_port_start_stop.py > +++ b/tests/TestSuite_vf_port_start_stop.py > @@ -3,7 +3,6 @@ > import re > import time >=20 > -import dts > from qemu_kvm import QEMUKvm > from test_case import TestCase > from pmd_output import PmdOutput > @@ -73,7 +72,7 @@ class TestVfPortStartStop(TestCase): > self.tester_tx_pci =3D > self.tester.ports_info[self.tester_tx_port]['pci'] > port =3D self.tester.ports_info[self.tester_tx_port]['port'] > self.tester_port_driver =3D port.get_nic_driver() > - self.tester.send_expect("./dpdk-devbind.py --bind=3Digb_uio %s" = % > self.tester_tx_pci, "#") > + self.tester.send_expect("./dpdk_nic_bind.py --bind=3Digb_uio %s"= % > self.tester_tx_pci, "#") Tool's name has been changed, it should be "dpdk-devbind". >=20 > src_mac =3D self.tester.get_mac(self.tester_tx_port) > if src_mac =3D=3D 'N/A': > @@ -183,8 +182,9 @@ class TestVfPortStartStop(TestCase): > def destroy_1pf_2vf_1vm_env(self): > if getattr(self, 'vm0', None): > #destroy testpmd in vm0 > - self.vm0_testpmd.execute_cmd('stop') > - self.vm0_testpmd.execute_cmd('quit', '# ') > + if getattr(self, 'vm0_testpmd', None): > + self.vm0_testpmd.execute_cmd('stop') > + self.vm0_testpmd.execute_cmd('quit', '# ') > self.vm0_testpmd =3D None > self.vm0_dut_ports =3D None > #destroy vm0 > @@ -195,7 +195,7 @@ class TestVfPortStartStop(TestCase): > self.host_testpmd.execute_cmd('quit', '# ') > self.host_testpmd =3D None >=20 > - if getattr(self, 'used_dut_port', None): > + if getattr(self, 'used_dut_port', None) !=3D None: > self.dut.destroy_sriov_vfs_by_port(self.used_dut_port) > port =3D self.dut.ports_info[self.used_dut_port]['port'] > port.bind_driver() > @@ -233,7 +233,8 @@ class TestVfPortStartStop(TestCase): > def tear_down_all(self): >=20 > self.pktgen_kill() > - self.tester.send_expect("./dpdk-devbind.py -- > bind=3D%s %s" %(self.tester_port_driver, self.tester_tx_pci), "#") > + if getattr(self, 'tester_port_driver', None) and getattr(self, > 'tester_tx_pci', None): > + self.tester.send_expect("./dpdk_nic_bind.py -- > bind=3D%s %s" %(self.tester_port_driver, self.tester_tx_pci), "#") >=20 > if getattr(self, 'vm0', None): > self.vm0.stop() > diff --git a/tests/TestSuite_vf_vlan.py b/tests/TestSuite_vf_vlan.py > index fc1527c..0568543 100644 > --- a/tests/TestSuite_vf_vlan.py > +++ b/tests/TestSuite_vf_vlan.py > @@ -123,17 +123,17 @@ class TestVfVlan(TestCase): > self.vm0.stop() > self.vm0 =3D None >=20 > - if getattr(self, 'used_dut_port_0', None): > + if getattr(self, 'used_dut_port_0', None) !=3D None: > self.dut.destroy_sriov_vfs_by_port(self.used_dut_port_0) > port =3D self.dut.ports_info[self.used_dut_port_0]['port'] > self.used_dut_port_0 =3D None >=20 > - if getattr(self, 'used_dut_port_1', None): > + if getattr(self, 'used_dut_port_1', None) !=3D None: > self.dut.destroy_sriov_vfs_by_port(self.used_dut_port_1) > port =3D self.dut.ports_info[self.used_dut_port_1]['port'] > self.used_dut_port_1 =3D None >=20 > - self.bind_nic_driver(self.dut_ports[:2], driver=3D"igb_uio") > + self.bind_nic_driver(self.dut_ports[:2], driver=3D'default') >=20 > self.env_done =3D False >=20 > -- > 1.9.3