From patchwork Wed Nov 25 09:03:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fan Zhang X-Patchwork-Id: 84541 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 8A815A0527; Wed, 25 Nov 2020 10:03:05 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 24030C940; Wed, 25 Nov 2020 10:03:04 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 149D8C93E for ; Wed, 25 Nov 2020 10:03:00 +0100 (CET) IronPort-SDR: vGntffVN511rEnpOAV8BLMrrrR4V6yM1qG4XDJuC8RWQRWn+s9L1VgPlmTt8PcRzuczIIwPOO/ Ls0Hxl8hynpA== X-IronPort-AV: E=McAfee;i="6000,8403,9815"; a="256802958" X-IronPort-AV: E=Sophos;i="5.78,368,1599548400"; d="scan'208";a="256802958" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2020 01:02:58 -0800 IronPort-SDR: TdfM4z3iA87ZeSKUVboMcNi3RrWtOQ0nAKV4nAqqfS8zI3gBEG/ZObbhljcLe+OAeye8Y8ysLh xKkUM1UDczJA== X-IronPort-AV: E=Sophos;i="5.78,368,1599548400"; d="scan'208";a="478844447" Received: from unknown (HELO localhost.localdomain) ([10.240.183.65]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2020 01:02:57 -0800 From: Fan Zhang To: dts@dpdk.org Cc: Fan Zhang Date: Wed, 25 Nov 2020 17:03:05 +0800 Message-Id: <20201125090305.15534-1-fan1x.zhang@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dts] [PATH V1]tests/TestSuite_shutdown_api.py:fix dpdk-24948 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" change Mbps to Gbps when speed >= 1000 in test_change_linkspeed Signed-off-by: Fan Zhang --- tests/TestSuite_shutdown_api.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tests/TestSuite_shutdown_api.py b/tests/TestSuite_shutdown_api.py index edd1dcf..11eb6af 100644 --- a/tests/TestSuite_shutdown_api.py +++ b/tests/TestSuite_shutdown_api.py @@ -471,6 +471,15 @@ class TestShutdownApi(TestCase): self.dut.send_expect("start", "testpmd> ") self.check_forwarding() + def smart_check_speed(self, speed: str, out: str): + s = int(speed) + if s >= 1000: + self.verify(("Speed: %dMb/s" % s in out) or ("Link speed: %d Gbps" % (s // 1000) in out), + "Wrong speed reported by the self.tester!") + else: + self.verify("Speed: %dMb/s" % s in out, + "Wrong speed reported by the self.tester.") + def test_change_linkspeed(self): """ Change Link Speed. @@ -493,7 +502,7 @@ class TestShutdownApi(TestCase): configs = m[:-int(len(m) / 2)] if not self.check_linkspeed_config(configs): - return; + return for config in configs: print(config) @@ -514,20 +523,22 @@ class TestShutdownApi(TestCase): for port in self.ports: out = self.dut.send_expect("show port info %s" % port, "testpmd>") self.verify("Link status: up" in out, - "Wrong link status reported by the dut") - self.verify("Link speed: %s Mbps" % config[0] in out, - "Wrong speed reported by the dut") + "Wrong link status reported by the dut %s" % port) + # fix the issue dpdk-24948 + self.smart_check_speed(config[0], out) self.verify("Link duplex: %s-duplex" % config[1].lower() in out, "Wrong link type reported by the dut") out = self.tester.send_expect( "ethtool %s" % self.tester.get_interface(self.tester.get_local_port(port)), "# ") - self.verify("Speed: %sMb/s" % config[0] in out, - "Wrong speed reported by the self.tester.") + + # fix the issue dpdk-24948 + self.smart_check_speed(config[0], out) self.verify("Duplex: %s" % config[1] in out, "Wrong link type reported by the self.tester.") self.dut.send_expect("start", "testpmd> ") self.check_forwarding() self.dut.send_expect("stop", "testpmd> ") + def test_change_linkspeed_vf(self): """ Change Link Speed VF .