test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts]  [PATCH V1] tests/dcf_lifecycle  script optimization
@ 2020-11-18 14:14 sunqin
  2020-11-18  5:41 ` Sun, QinX
  2020-11-19  8:41 ` Tu, Lijuan
  0 siblings, 2 replies; 3+ messages in thread
From: sunqin @ 2020-11-18 14:14 UTC (permalink / raw)
  To: dts; +Cc: sunqin

Optimization item:

1.Remove the copy command of dpdk-testpmd

2.Kill the app base on the app_name and file-prefix instead of the app_name

3.Add the prefilx './' before the bin file

Signed-off-by: sunqin <qinx.sun@intel.com>
---
 tests/TestSuite_dcf_lifecycle.py | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/tests/TestSuite_dcf_lifecycle.py b/tests/TestSuite_dcf_lifecycle.py
index 0923dab0..f303bc79 100644
--- a/tests/TestSuite_dcf_lifecycle.py
+++ b/tests/TestSuite_dcf_lifecycle.py
@@ -317,7 +317,7 @@ class TestDcfLifeCycle(TestCase):
             "{whitelist} "
             "--file-prefix={prefix} "
             "-- -i ").format(**{
-                'bin': self.vf_dcf_testpmd,
+                'bin': ''.join(['./',self.vf_dcf_testpmd]),
                 'core_mask': core_mask,
                 'mem_channel': self.dut.get_memory_channels(),
                 'whitelist': whitelist,
@@ -335,13 +335,14 @@ class TestDcfLifeCycle(TestCase):
             self.logger.error(traceback.format_exc())
         self.is_vf_dcf_pmd_on = False
 
-    def kill_vf_dcf_process(self):
+    def kill_vf_dcf_process(self,**kwargs):
         '''
         Kill DCF process
         '''
         cmd = "ps aux | grep testpmd"
         self.d_a_con(cmd)
-        cmd = r"kill -9 `ps -ef | grep %s | grep -v grep | grep -v %s | awk '{print $2}'`" % (self.vf_dcf_testpmd.split('/')[-1], self.vf_testpmd2.split('/')[-1])
+        file_prefix = '='.join(['file-prefix',kwargs['file_prefix']])
+        cmd = r"kill -9 `ps -ef | grep %s | grep -v grep | grep %s | awk '{print $2}'`" % (self.vf_dcf_testpmd.split('/')[-1], file_prefix)
         self.d_a_con(cmd)
         self.is_vf_dcf_pmd_on = False
         time.sleep(2)
@@ -357,14 +358,8 @@ class TestDcfLifeCycle(TestCase):
         self.verify(output, msg)
         return output
 
-    def create_vf_testpmd2(self):
-        self.vf_testpmd2 = self.dut.apps_name['testpmd_vf']
-        cmd = 'rm -f /root/dpdk/{vf_pmd2};cp /root/dpdk/{vf_dcf_pmd} /root/dpdk/{vf_pmd2}'.format(
-            **{'vf_dcf_pmd': self.vf_dcf_testpmd, 'vf_pmd2': self.vf_testpmd2})
-        self.d_a_con(cmd)
-
     def init_vf_testpmd2(self):
-        self.create_vf_testpmd2()
+        self.vf_testpmd2 = self.dut.apps_name['test-pmd']
         self.vf_pmd2_session_name = 'vf_testpmd2'
         self.vf_pmd2_session = self.dut.new_session(
             self.vf_pmd2_session_name)
@@ -382,7 +377,7 @@ class TestDcfLifeCycle(TestCase):
             "{whitelist} "
             "--file-prefix={prefix} "
             "-- -i ").format(**{
-                'bin': self.vf_testpmd2,
+                'bin': ''.join(['./',self.vf_testpmd2]),
                 'core_mask': core_mask,
                 'mem_channel': self.dut.get_memory_channels(),
                 'whitelist': whitelist,
@@ -460,7 +455,7 @@ class TestDcfLifeCycle(TestCase):
         self.verify(output, msg)
         return output
 
-    def check_vf_pmd2_traffic(self, func_name, topo=None, flag=False):
+    def check_vf_pmd2_traffic(self, func_name, topo=None, flag=False,**kwargs):
         dut_port_id, vf_id = topo if topo else [0, 1]
         pkt = self.config_stream(dut_port_id, vf_id)
         traffic = partial(self.send_packet_by_scapy, pkt, dut_port_id, vf_id)
@@ -468,7 +463,7 @@ class TestDcfLifeCycle(TestCase):
         self.vf_pmd2_clear_port_stats()
         self.check_vf_pmd2_stats(traffic, verbose_parser)
         status_change_func = getattr(self, func_name)
-        status_change_func()
+        status_change_func(**kwargs)
         self.check_vf_pmd2_stats(traffic, verbose_parser, is_traffic_valid=flag)
 
     def run_test_pre(self, pmd_opitons):
@@ -689,7 +684,7 @@ class TestDcfLifeCycle(TestCase):
             pmd_opts = [['pf1_vf0_dcf', 'dcf'], ['pf1_vf1', 'vf']]
             self.run_test_pre(pmd_opts)
             self.vf_dcf_testpmd_set_flow_rule()
-            self.check_vf_pmd2_traffic('kill_vf_dcf_process', flag=True)
+            self.check_vf_pmd2_traffic('kill_vf_dcf_process', flag=True,**{'file_prefix':pmd_opts[0][1]})
         except Exception as e:
             self.logger.error(traceback.format_exc())
             except_content = e
-- 
2.17.1


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

end of thread, other threads:[~2020-11-19  8:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18 14:14 [dts] [PATCH V1] tests/dcf_lifecycle script optimization sunqin
2020-11-18  5:41 ` Sun, QinX
2020-11-19  8:41 ` Tu, Lijuan

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