From patchwork Wed Nov 18 14:14:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sun, QinX" X-Patchwork-Id: 84287 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2207CA04E6; Wed, 18 Nov 2020 06:38:27 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D8E6758C4; Wed, 18 Nov 2020 06:38:25 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id A293BF90 for ; Wed, 18 Nov 2020 06:38:22 +0100 (CET) IronPort-SDR: grnW2eyMSch6F+e2wWeZwtiIRWXMJrV1JG+L9VZ0PSY3CCBwZwg1e12FWFF6HoC5anJWvy4Mm7 2gXyTJzrfGRg== X-IronPort-AV: E=McAfee;i="6000,8403,9808"; a="171237329" X-IronPort-AV: E=Sophos;i="5.77,486,1596524400"; d="scan'208";a="171237329" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2020 21:38:21 -0800 IronPort-SDR: rnMsiADzvMl6o1Q682B+oH802AL6SkUYvfruwoiP54d80N1o/nk1HcZ9y3Z8WnscEgzl2rfOdL 2LbOPNvb00eQ== X-IronPort-AV: E=Sophos;i="5.77,486,1596524400"; d="scan'208";a="544351861" Received: from unknown (HELO dpdk-wenjielx-tetser203.icx.intel.com) ([10.240.183.105]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2020 21:38:20 -0800 From: sunqin To: dts@dpdk.org Cc: sunqin Date: Wed, 18 Nov 2020 14:14:17 +0000 Message-Id: <20201118141417.27342-1-qinx.sun@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dts] [PATCH V1] tests/dcf_lifecycle script optimization 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" 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 Tested-by: Sun, QinX --- 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