From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 982B2A046B for ; Wed, 29 May 2019 05:00:00 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 747362E8F; Wed, 29 May 2019 05:00:00 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id CAACF1B19 for ; Wed, 29 May 2019 04:59:58 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 May 2019 19:59:57 -0700 X-ExtLoop1: 1 Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga005.jf.intel.com with ESMTP; 28 May 2019 19:59:57 -0700 Received: from fmsmsx124.amr.corp.intel.com (10.18.125.39) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 28 May 2019 19:59:57 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx124.amr.corp.intel.com (10.18.125.39) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 28 May 2019 19:59:56 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.129]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.6]) with mapi id 14.03.0415.000; Wed, 29 May 2019 10:59:54 +0800 From: "Tu, Lijuan" To: "Mo, YufengX" , "dts@dpdk.org" CC: "Mo, YufengX" Thread-Topic: [dts] [PATCH V1][tests/metering_and_policing]: fix typo and remove hard code Thread-Index: AQHVFDBfDFD7ZgIAokWx1TwdYiHG/KZ9soEAgAO6P7A= Date: Wed, 29 May 2019 02:59:53 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BA867B1@SHSMSX101.ccr.corp.intel.com> References: <1558922660-37013-1-git-send-email-yufengx.mo@intel.com> <1558922660-37013-2-git-send-email-yufengx.mo@intel.com> In-Reply-To: <1558922660-37013-2-git-send-email-yufengx.mo@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNmJiOTZjNDEtY2NkOC00MGViLWIxMGUtMjI5ZDdlMmQ3ZDM5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiQm82TTROcXZwbE00NTRZOVVWZkN3TkRCR0U1Y3I1Szk5dnBYTXJscUp3M0ZXMVpWaXhYSW8ybFwvdGoybmx4UUkifQ== 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 V1][tests/metering_and_policing]: fix typo and remove hard code 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" Applied, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of yufengmx > Sent: Monday, May 27, 2019 10:04 AM > To: dts@dpdk.org > Cc: Mo, YufengX > Subject: [dts] [PATCH V1][tests/metering_and_policing]: fix typo and remo= ve > hard code >=20 >=20 > *. remove hard code of dpdk source directory to fix a directory error whe= n > use --dir option. > *. change Copyright year to 2019 > *. fix typo. >=20 > Signed-off-by: yufengmx > --- > tests/TestSuite_metering_and_policing.py | 42 ++++++++++++++++++--------= -- > ---- > 1 file changed, 24 insertions(+), 18 deletions(-) >=20 > diff --git a/tests/TestSuite_metering_and_policing.py > b/tests/TestSuite_metering_and_policing.py > index 38687e6..c4c83d6 100644 > --- a/tests/TestSuite_metering_and_policing.py > +++ b/tests/TestSuite_metering_and_policing.py > @@ -1,6 +1,6 @@ > #BSD LICENSE > # > -# Copyright(c) 2010-2016 Intel Corporation. All rights reserved. > +# Copyright(c) 2010-2019 Intel Corporation. All rights reserved. > # All rights reserved. > # > # Redistribution and use in source and binary forms, with or without @@ = - > 28,14 +28,12 @@ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN > ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE > POSSIBILITY OF SUCH DAMAGE. > - > - > - > - > """ > DPDK Test suite. > Test metering_and_policing. > """ > + > +import os > import utils > import string > import time > @@ -55,7 +53,8 @@ class TestMeteringAndPolicing(TestCase): > file =3D 'meter_and_policy_config.tar.gz' > src_file =3D r'./dep/%s' % file > dst1 =3D '/tmp' > - dst2 =3D '/root/dpdk/drivers/net/softnic' > + dst2 =3D os.sep.join([self.target_dir, > + 'drivers/net/softnic']) > self.dut.session.copy_file_to(src_file, dst1) > self.dut.send_expect("tar xf %s/%s -C %s" % (dst1, file, dst2), = "#", 30) >=20 > @@ -63,9 +62,12 @@ class TestMeteringAndPolicing(TestCase): > """ > Update firmware.cli. > """ > - self.ori_firmware_cli =3D > "/root/dpdk/drivers/net/softnic/meter_and_policing_firmware.cli" > + self.ori_firmware_cli =3D os.sep.join([self.target_dir, > + > + 'drivers/net/softnic/meter_and_policing_firmware.cli']) > + > if len(self.dut_ports) =3D=3D 4: > - self.ori_firmware_cli =3D > "/root/dpdk/drivers/net/softnic/meter_and_policing_firmware_4ports.cli" > + self.ori_firmware_cli =3D os.sep.join([self.target_dir, > + > + "drivers/net/softnic/meter_and_policing_firmware_4ports.cli"]) > self.new_firmware_cli =3D "%s-%s" % (self.ori_firmware_cli, case= ID) > self.dut.send_expect("rm -f %s" % self.new_firmware_cli, "#") > self.dut.send_expect("cp %s %s" % (self.ori_firmware_cli, > self.new_firmware_cli), "#") @@ -102,21 +104,21 @@ class > TestMeteringAndPolicing(TestCase): > else: > self.dut.send_expect("sed -i -e 's/^.*%s.*$/%s acl ipv4 offs= et 270 size > 4K action AP0/g' %s" > % (temp, temp, self.new_firmware_cli), = "#") > - > # use .sh file as RX table > temp =3D "pipeline RX table 0 dscp" > + target_dir =3D '\/'.join(self.target_dir.split('/')) > if caseID =3D=3D 10: > - self.dut.send_expect("sed -i -e 's/^.*%s.*$/%s > \/root\/dpdk\/drivers\/net\/softnic\/dscp_red.sh/g' %s" > - % (temp, temp, self.new_firmware_cli), = "#") > + self.dut.send_expect("sed -i -e > 's/^.*%s.*$/%s %s\/drivers\/net\/softnic\/dscp_red.sh/g' %s" > + % (temp, temp, target_dir, > + self.new_firmware_cli), "#") > elif caseID =3D=3D 11: > - self.dut.send_expect("sed -i -e 's/^.*%s.*$/%s > \/root\/dpdk\/drivers\/net\/softnic\/dscp_yellow.sh/g' %s" > - % (temp, temp, self.new_firmware_cli), = "#") > + self.dut.send_expect("sed -i -e > 's/^.*%s.*$/%s %s\/drivers\/net\/softnic\/dscp_yellow.sh/g' %s" > + % (temp, temp, target_dir, > + self.new_firmware_cli), "#") > elif caseID =3D=3D 12: > - self.dut.send_expect("sed -i -e 's/^.*%s.*$/%s > \/root\/dpdk\/drivers\/net\/softnic\/dscp_green.sh/g' %s" > - % (temp, temp, self.new_firmware_cli), = "#") > + self.dut.send_expect("sed -i -e > 's/^.*%s.*$/%s %s\/drivers\/net\/softnic\/dscp_green.sh/g' %s" > + % (temp, temp, target_dir, > + self.new_firmware_cli), "#") > elif caseID =3D=3D 13: > - self.dut.send_expect("sed -i -e 's/^.*%s.*$/%s > \/root\/dpdk\/drivers\/net\/softnic\/dscp_default.sh/g' %s" > - % (temp, temp, self.new_firmware_cli), = "#") > + self.dut.send_expect("sed -i -e > 's/^.*%s.*$/%s %s\/drivers\/net\/softnic\/dscp_default.sh/g' %s" > + % (temp, temp, target_dir, > + self.new_firmware_cli), "#") >=20 > # thread * pipeline RX/TX enable > self.dut.send_expect("sed -i -e 's/thread 5 pipeline RX > enable/thread %d pipeline RX enable/g' %s" > @@ -257,7 +259,7 @@ class TestMeteringAndPolicing(TestCase): > for i in range(0, len(self.dut_ports)): > self.verify(int(tx_packets_port[i]) =3D=3D 0, "Wrong: th= e packet is not > dropped") > else: > - self.verify(int(tx_packets_port[expect_port]) =3D=3D 1, "Wro= ng: can't > forward package to port %d " % expect_port) > + self.verify(int(tx_packets_port[expect_port]) =3D=3D 1, "Wro= ng: > + can't forward packet to port %d " % expect_port) >=20 > def run_param(self, cbs, pbs, head): > """ > @@ -278,6 +280,10 @@ class TestMeteringAndPolicing(TestCase): > """ > Run at the start of each test suite. > """ > + # get absolute directory of target source code > + self.target_dir =3D '/root' + self.dut.base_dir[1:] \ > + if self.dut.base_dir.startswith('~') else \ > + self.dut.base_dir > self.dut_ports =3D self.dut.get_ports() > self.port_nums =3D 2 > self.verify(len(self.dut_ports) >=3D self.port_nums, > -- > 1.9.3