From patchwork Mon Sep 28 07:13:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lingli Chen X-Patchwork-Id: 78976 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 9CE9EA04C0; Mon, 28 Sep 2020 09:14:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 665551D544; Mon, 28 Sep 2020 09:14:18 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id BE7911C1A6 for ; Mon, 28 Sep 2020 09:14:16 +0200 (CEST) IronPort-SDR: ZtemGv7t4HJOxyPlmlSBvwWrkCQ96aGsQxWJfw5ZnGQxNLs4A3Eqv5/TTttrEs+fTjX71Kf7Yp DarFC4mA8a5g== X-IronPort-AV: E=McAfee;i="6000,8403,9757"; a="180105675" X-IronPort-AV: E=Sophos;i="5.77,313,1596524400"; d="scan'208";a="180105675" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2020 00:14:13 -0700 IronPort-SDR: TW0EYkxDwBVQstfwZosn7miIsecrF9kDaiVmQrl9IClp+Wz66A7rNxF5W1VBDg2cqbYxXChtZl gTs6H0cBHpTA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,313,1596524400"; d="scan'208";a="324196278" Received: from unknown (HELO localhost.localdomain) ([10.240.183.80]) by orsmga002.jf.intel.com with ESMTP; 28 Sep 2020 00:14:12 -0700 From: Chen Linglix To: dts@dpdk.org Cc: chenlinglix Date: Mon, 28 Sep 2020 15:13:29 +0800 Message-Id: <20200928071329.8897-1-linglix.chen@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dts] [PATCH V1] tests/TestSuite_shutdown_api:fixed differences brought about by speed units 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" From: chenlinglix fixed differences brought about by speed units Signed-off-by: chenlinglix Tested-by: Chen, LingliX --- tests/TestSuite_shutdown_api.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tests/TestSuite_shutdown_api.py b/tests/TestSuite_shutdown_api.py index edd1dcf..5255639 100644 --- a/tests/TestSuite_shutdown_api.py +++ b/tests/TestSuite_shutdown_api.py @@ -515,8 +515,13 @@ class TestShutdownApi(TestCase): 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") + if config[0] in['1000', '10000']: + num =int(int(config[0])/1000) + self.verify("Link speed: %d Gbps" % num in out, + "Wrong speed reported by the dut") + else: + self.verify("Link speed: %s Mbps" % config[0] in out, + "Wrong speed reported by the dut") self.verify("Link duplex: %s-duplex" % config[1].lower() in out, "Wrong link type reported by the dut") out = self.tester.send_expect( @@ -547,7 +552,7 @@ class TestShutdownApi(TestCase): if not self.check_linkspeed_config(configs): return - result_linkspeed_scanner = r"Link\s*speed:\s([0-9]+)\s*Mbps" + result_linkspeed_scanner = r"Link\s*speed:\s([0-9]+)\s*(\S+)" linkspeed_scanner = re.compile(result_linkspeed_scanner, re.DOTALL) result_linktype_scanner = r"Link\s*duplex:\s*(\S*)\s*-\s*duplex" linktype_scanner = re.compile(result_linktype_scanner, re.DOTALL) @@ -576,11 +581,12 @@ class TestShutdownApi(TestCase): time.sleep(1) out = self.vm0_testpmd.execute_cmd('show port info all') - - linkspeed = linkspeed_scanner.findall(out) + linkspeed = linkspeed_scanner.findall(out)[0] linktype = linktype_scanner.findall(out) - - self.verify(config[0] in linkspeed, + actual_speed = int(linkspeed[0]) + if linkspeed[1] == "Gbps": + actual_speed = actual_speed * 1000 + self.verify(config[0] == str(actual_speed), "Wrong VF speed reported by the self.tester.") self.verify(config[1].lower() == linktype[0].lower(), "Wrong VF link type reported by the self.tester.")