From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 50CD7282 for ; Wed, 15 Feb 2017 10:24:51 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Feb 2017 01:24:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,165,1484035200"; d="scan'208";a="1094979541" Received: from unknown (HELO dpdk-fedora20.icx.intel.com) ([10.240.176.135]) by orsmga001.jf.intel.com with ESMTP; 15 Feb 2017 01:24:49 -0800 From: Lijuan Tu To: dts@dpdk.org Cc: Lijuan Tu Date: Wed, 15 Feb 2017 17:24:31 +0800 Message-Id: <1487150671-26813-1-git-send-email-lijuanx.a.tu@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dts] [PATCH]virtual cases: use framework api to clearup vm. 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: Wed, 15 Feb 2017 09:24:52 -0000 and Fix grammatical & logic error Signed-off-by: Lijuan Tu --- tests/TestSuite_vf_macfilter.py | 10 +++++++--- tests/TestSuite_vf_packet_rxtx.py | 6 ++++++ tests/TestSuite_vf_port_start_stop.py | 21 ++++++++++++--------- tests/TestSuite_vf_rss.py | 12 ++++++++---- tests/TestSuite_vf_vlan.py | 13 +++++++------ tests/TestSuite_vm_power_manager.py | 1 + 6 files changed, 41 insertions(+), 22 deletions(-) diff --git a/tests/TestSuite_vf_macfilter.py b/tests/TestSuite_vf_macfilter.py index 1fce394..2eb521e 100644 --- a/tests/TestSuite_vf_macfilter.py +++ b/tests/TestSuite_vf_macfilter.py @@ -73,12 +73,14 @@ class TestVfMacFilter(TestCase): def destroy_2pf_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', '# ') - self.vm0_testpmd = None + if getattr(self, 'vm0_testpmd', None): + self.vm0_testpmd.execute_cmd('stop') + self.vm0_testpmd.execute_cmd('quit', '# ') + self.vm0_testpmd = None self.vm0_dut_ports = None #destroy vm0 self.vm0.stop() + self.dut.virt_exit() self.vm0 = None if getattr(self, 'host_testpmd', None): @@ -218,6 +220,8 @@ class TestVfMacFilter(TestCase): if getattr(self, 'vm0', None): self.vm0.stop() + self.dut.virt_exit() + for port_id in self.dut_ports: self.dut.destroy_sriov_vfs_by_port(port_id) diff --git a/tests/TestSuite_vf_packet_rxtx.py b/tests/TestSuite_vf_packet_rxtx.py index 62d3a3c..3eb9737 100644 --- a/tests/TestSuite_vf_packet_rxtx.py +++ b/tests/TestSuite_vf_packet_rxtx.py @@ -83,6 +83,8 @@ class TestVfPacketRxtx(TestCase): self.host_testpmd.execute_cmd('quit', '# ') self.host_testpmd = None + self.dut.virt_exit() + if getattr(self, 'used_dut_port_0', None) != None: self.dut.destroy_sriov_vfs_by_port(self.used_dut_port_0) port = self.dut.ports_info[self.used_dut_port_0]['port'] @@ -213,6 +215,8 @@ class TestVfPacketRxtx(TestCase): self.vm1.stop() self.vm1 = None + self.dut.virt_exit() + if getattr(self, 'host_testpmd', None) != None: self.host_testpmd.execute_cmd('quit', '# ') self.host_testpmd = None @@ -297,6 +301,8 @@ class TestVfPacketRxtx(TestCase): if getattr(self, 'vm1', None): self.vm1.stop() + self.dut.virt_exit() + for port_id in self.dut_ports: self.dut.destroy_sriov_vfs_by_port(port_id) diff --git a/tests/TestSuite_vf_port_start_stop.py b/tests/TestSuite_vf_port_start_stop.py index 35309c4..a272033 100644 --- a/tests/TestSuite_vf_port_start_stop.py +++ b/tests/TestSuite_vf_port_start_stop.py @@ -182,9 +182,10 @@ 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', '# ') - self.vm0_testpmd = None + if getattr(self, 'vm0_testpmd', None): + self.vm0_testpmd.execute_cmd('stop') + self.vm0_testpmd.execute_cmd('quit', '# ') + self.vm0_testpmd = None self.vm0_dut_ports = None #destroy vm0 self.vm0.stop() @@ -194,7 +195,7 @@ class TestVfPortStartStop(TestCase): self.host_testpmd.execute_cmd('quit', '# ') self.host_testpmd = None - if getattr(self, 'used_dut_port', None): + if getattr(self, 'used_dut_port', None) != None: self.dut.destroy_sriov_vfs_by_port(self.used_dut_port) port = self.dut.ports_info[self.used_dut_port]['port'] port.bind_driver() @@ -213,10 +214,7 @@ class TestVfPortStartStop(TestCase): self.vm0_dut_ports = self.vm_dut_0.get_ports('any') self.vm0_testpmd = PmdOutput(self.vm_dut_0) - if self.kdriver == "i40e": - self.vm0_testpmd.start_testpmd(VM_CORES_MASK, '--crc-strip') - else: - self.vm0_testpmd.start_testpmd(VM_CORES_MASK) + self.vm0_testpmd.start_testpmd(VM_CORES_MASK, '--crc-strip') self.vm0_testpmd.execute_cmd('set fwd mac') time.sleep(2) @@ -232,10 +230,15 @@ class TestVfPortStartStop(TestCase): def tear_down_all(self): self.pktgen_kill() - self.tester.send_expect("./dpdk-devbind.py --bind=%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=%s %s" \ + %(self.tester_port_driver, self.tester_tx_pci), "#") if getattr(self, 'vm0', None): self.vm0.stop() + self.dut.virt_exit() + for port_id in self.dut_ports: self.dut.destroy_sriov_vfs_by_port(port_id) diff --git a/tests/TestSuite_vf_rss.py b/tests/TestSuite_vf_rss.py index 21c717b..34f25cb 100644 --- a/tests/TestSuite_vf_rss.py +++ b/tests/TestSuite_vf_rss.py @@ -254,10 +254,11 @@ class TestVfRss(TestCase): self.vm0.set_vm_device(driver='pci-assign', **vf0_prot) self.vm_dut_0 = self.vm0.start() - self.vm0_testpmd = PmdOutput(self.vm_dut_0) if self.vm_dut_0 is None: raise Exception("Set up VM0 ENV failed!") + self.vm0_testpmd = PmdOutput(self.vm_dut_0) + self.setup_1pf_1vf_1vm_env_flag = 1 except Exception as e: self.destroy_1pf_1vf_1vm_env() @@ -265,18 +266,20 @@ class TestVfRss(TestCase): def destroy_1pf_1vf_1vm_env(self): if getattr(self, 'vm0', None): - self.vm0_testpmd.execute_cmd('quit', '# ') - self.vm0_testpmd = None + if getattr(self, 'vm0_testpmd', None): + self.vm0_testpmd.execute_cmd('quit', '# ') + self.vm0_testpmd = None self.vm0_dut_ports = None #destroy vm0 self.vm0.stop() + self.dut.virt_exit() self.vm0 = None if getattr(self, 'host_testpmd', None): self.host_testpmd.execute_cmd('quit', '# ') self.host_testpmd = None - if getattr(self, 'used_dut_port_0', None): + if getattr(self, 'used_dut_port_0', None) != None: self.dut.destroy_sriov_vfs_by_port(self.used_dut_port_0) port = self.dut.ports_info[self.used_dut_port_0]['port'] port.bind_driver() @@ -292,6 +295,7 @@ class TestVfRss(TestCase): # niantic kernel host driver not support this case if self.nic is 'niantic' and not self.host_testpmd: + self.logger.warning("niantic kernel host driver not support this case") return vm0dutPorts = self.vm_dut_0.get_ports('any') localPort = self.tester.get_local_port(vm0dutPorts[0]) diff --git a/tests/TestSuite_vf_vlan.py b/tests/TestSuite_vf_vlan.py index f106cac..74930b0 100644 --- a/tests/TestSuite_vf_vlan.py +++ b/tests/TestSuite_vf_vlan.py @@ -115,24 +115,26 @@ class TestVfVlan(TestCase): def destroy_vm_env(self): if getattr(self, 'vm0', None): - self.vm_dut_0.kill_all() + if getattr(self, 'vm_dut_0', None): + self.vm_dut_0.kill_all() self.vm0_testpmd = None self.vm0_dut_ports = None # destroy vm0 self.vm0.stop() + self.dut.virt_exit() self.vm0 = None - if getattr(self, 'used_dut_port_0', None): + if getattr(self, 'used_dut_port_0', None) != None: self.dut.destroy_sriov_vfs_by_port(self.used_dut_port_0) port = self.dut.ports_info[self.used_dut_port_0]['port'] self.used_dut_port_0 = None - if getattr(self, 'used_dut_port_1', None): + if getattr(self, 'used_dut_port_1', None) != None: self.dut.destroy_sriov_vfs_by_port(self.used_dut_port_1) port = self.dut.ports_info[self.used_dut_port_1]['port'] self.used_dut_port_1 = None - self.bind_nic_driver(self.dut_ports[:2], driver="igb_uio") + self.bind_nic_driver(self.dut_ports[:2], driver='igb_uio') self.env_done = False @@ -392,8 +394,7 @@ class TestVfVlan(TestCase): self.vm0_testpmd.quit() def tear_down(self): - self.vm_dut_0.kill_all() - pass + self.destroy_vm_env() def tear_down_all(self): self.destroy_vm_env() diff --git a/tests/TestSuite_vm_power_manager.py b/tests/TestSuite_vm_power_manager.py index 84f06dc..26245e6 100644 --- a/tests/TestSuite_vm_power_manager.py +++ b/tests/TestSuite_vm_power_manager.py @@ -445,4 +445,5 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator): """ self.dut.send_expect("quit", "# ") self.vm.stop() + self.dut.virt_exit() pass -- 1.9.3