test suite reviews and discussions
 help / color / mirror / Atom feed
From: Fan Zhang <fan1x.zhang@intel.com>
To: dts@dpdk.org
Cc: Fan Zhang <fan1x.zhang@intel.com>
Subject: [dts] [PATH V1]tests/TestSuite_shutdown_api.py:fix dpdk-24948
Date: Wed, 25 Nov 2020 17:03:05 +0800	[thread overview]
Message-ID: <20201125090305.15534-1-fan1x.zhang@intel.com> (raw)

change Mbps to Gbps when speed >= 1000 in test_change_linkspeed

Signed-off-by: Fan Zhang <fan1x.zhang@intel.com>
---
 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 .
-- 
2.17.1


                 reply	other threads:[~2020-11-25  9:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201125090305.15534-1-fan1x.zhang@intel.com \
    --to=fan1x.zhang@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).