test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH]virtual cases: use framework api to clearup vm.
@ 2017-02-15  9:24 Lijuan Tu
  2017-02-20  7:48 ` Liu, Yong
  0 siblings, 1 reply; 2+ messages in thread
From: Lijuan Tu @ 2017-02-15  9:24 UTC (permalink / raw)
  To: dts; +Cc: Lijuan Tu

and Fix grammatical & logic error

Signed-off-by: Lijuan Tu <lijuanx.a.tu@intel.com>
---
 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dts] [PATCH]virtual cases: use framework api to clearup vm.
  2017-02-15  9:24 [dts] [PATCH]virtual cases: use framework api to clearup vm Lijuan Tu
@ 2017-02-20  7:48 ` Liu, Yong
  0 siblings, 0 replies; 2+ messages in thread
From: Liu, Yong @ 2017-02-20  7:48 UTC (permalink / raw)
  To: Lijuan Tu, dts

Thanks, applied.

On 02/15/2017 05:24 PM, Lijuan Tu wrote:
> and Fix grammatical & logic error
>
> Signed-off-by: Lijuan Tu <lijuanx.a.tu@intel.com>
> ---
>   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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-20  7:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-15  9:24 [dts] [PATCH]virtual cases: use framework api to clearup vm Lijuan Tu
2017-02-20  7:48 ` Liu, Yong

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).