From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7A260A04F5; Thu, 5 Dec 2019 02:41:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 222AE1BE84; Thu, 5 Dec 2019 02:41:15 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 2CA251BE82 for ; Thu, 5 Dec 2019 02:41:12 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Dec 2019 17:41:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,279,1571727600"; d="scan'208";a="219074267" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga001.fm.intel.com with ESMTP; 04 Dec 2019 17:41:12 -0800 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 4 Dec 2019 17:41:11 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 4 Dec 2019 17:41:11 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.19]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.222]) with mapi id 14.03.0439.000; Thu, 5 Dec 2019 09:41:09 +0800 From: "Tu, Lijuan" To: "Luo, Michael" , "dts@dpdk.org" Thread-Topic: [dts] [PATCH v2] tests/userspace_ethtool: pull and check link status Thread-Index: AQHVqm8uPUaicoPJQECAwfn7+dEgxKeqxTtw Date: Thu, 5 Dec 2019 01:41:09 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BB7DD1B@SHSMSX101.ccr.corp.intel.com> References: <1575440957-5752-1-git-send-email-michael.luo@intel.com> <1575441871-6234-1-git-send-email-michael.luo@intel.com> In-Reply-To: <1575441871-6234-1-git-send-email-michael.luo@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.2.0.6 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWJiYzcxY2MtNDMwNS00ZDllLTk0OWQtOTdmMjU5NWNjNzE4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiQmtrdHVUaHdrNnRRWFpmTDRrMHpVOEVKZkREcWROXC9IamptSXJkNG1sRTdhTzVMRXlmZkN1Z2FGc2hKcVVIUWkifQ== 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 v2] tests/userspace_ethtool: pull and check link status 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 > michael.luo@intel.com > Sent: Wednesday, December 4, 2019 2:45 PM > To: dts@dpdk.org > Subject: [dts] [PATCH v2] tests/userspace_ethtool: pull and check link st= atus >=20 > From: Gaoliang Luo >=20 > in test_port_config, pull and check the link status insteading of using s= leep to > wait after DPDK ethtool app stop/open the port. >=20 > Signed-off-by: Gaoliang Luo > --- > tests/TestSuite_userspace_ethtool.py | 19 ++++++++++++++++--- > 1 file changed, 16 insertions(+), 3 deletions(-) >=20 > diff --git a/tests/TestSuite_userspace_ethtool.py > b/tests/TestSuite_userspace_ethtool.py > index e9b6ccf..f5583f2 100644 > --- a/tests/TestSuite_userspace_ethtool.py > +++ b/tests/TestSuite_userspace_ethtool.py > @@ -221,6 +221,18 @@ class TestUserspaceEthtool(TestCase, > IxiaPacketGenerator): >=20 > return status, msg >=20 > + def ethapp_check_link_status(self, port_id, expected_status =3D 'Up'= ): > + retries =3D 0 > + reg_str =3D 'Port\s+{}:\s+(Up|Down)'.format(port_id) > + while retries < 5: > + out =3D self.dut.send_expect("link", "EthApp> ", 10) > + if out is not None: > + status =3D re.search(reg_str, out).group(1) > + if status =3D=3D expected_status: > + return True > + time.sleep(1) > + return False > + > def test_dump_driver_info(self): > """ > Test ethtool can dump basic information @@ -519,7 +531,8 @@ clas= s > TestUserspaceEthtool(TestCase, IxiaPacketGenerator): > time.sleep(10) > # stop port > self.dut.send_expect("stop %d" % index, "EthApp>") > - time.sleep(10) > + self.verify(self.ethapp_check_link_status(index, 'Down') =3D= =3D True, > + 'Fail to stop port{}'.format(index)) > # check packet not forwarded when port is stop > pkt =3D Packet(pkt_type=3D'UDP') > tester_port =3D self.tester.get_local_port(port) @@ -528,11 = +541,11 > @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator): > rx_pkts, tx_pkts =3D self.strip_portstats(index) > self.verify(rx_pkts =3D=3D ori_rx_pkts, "Failed to stop port= ") > # restart port and check packet can normally forwarded > - time.sleep(2) > self.dut.send_expect("open %d" % index, "EthApp>") > + self.verify(self.ethapp_check_link_status(index, 'Up') =3D= =3D True, > + 'Fail to Open port{}'.format(index)) > # wait few time for port ready > rx_pkts, tx_pkts =3D self.strip_portstats(index) > - time.sleep(2) > pkt.send_pkt(self.tester, tx_port=3Dintf, count=3D4) > rx_pkts_open, tx_pkts_open =3D self.strip_portstats(index) > self.verify(rx_pkts_open =3D=3D rx_pkts + 4, "Failed to reop= en port rx") > -- > 2.7.4