[dts] [PATH V1]tests/TestSuite_shutdown_api.py:fix dpdk-24948
Fan Zhang
fan1x.zhang at intel.com
Wed Nov 25 10:03:05 CET 2020
change Mbps to Gbps when speed >= 1000 in test_change_linkspeed
Signed-off-by: Fan Zhang <fan1x.zhang at 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
More information about the dts
mailing list