test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATH V1]tests/TestSuite_shutdown_api.py:fix dpdk-24948
@ 2020-11-25  9:03 Fan Zhang
  0 siblings, 0 replies; only message in thread
From: Fan Zhang @ 2020-11-25  9:03 UTC (permalink / raw)
  To: dts; +Cc: Fan Zhang

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-25  9:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25  9:03 [dts] [PATH V1]tests/TestSuite_shutdown_api.py:fix dpdk-24948 Fan Zhang

test suite reviews and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ http://inbox.dpdk.org/dts \
		dts@dpdk.org
	public-inbox-index dts

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dts


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git