[PATCH 2/2] tests/blocklist: optimize case of bl_one_port to adapt to more scenarios

Niklas Söderlund niklas.soderlund at corigine.com
Mon Jul 3 21:34:59 CEST 2023


From: Qin Ke <qin.ke at corigine.com>

when one port blocked, the port with same PCIADRESS will also be blocked,
optimize it to adapt to more scenarios whether the PCIADRESS of ports are
same or not.

Signed-off-by: Qin Ke <qin.ke at corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund at corigine.com>
Reviewed-by Dano Teixeira <dano.teixeira at corigine.com>
---
 tests/TestSuite_blocklist.py | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/tests/TestSuite_blocklist.py b/tests/TestSuite_blocklist.py
index 9d12c8319b23..61b5bf6800cd 100644
--- a/tests/TestSuite_blocklist.py
+++ b/tests/TestSuite_blocklist.py
@@ -78,10 +78,25 @@ class TestBlockList(TestCase):
         Run testpmd with one port blocklisted.
         """
         self.dut.kill_all()
+        blocked_pci_address = self.dut.ports_info[0]["pci"]
         out = self.pmdout.start_testpmd(
-            "Default", eal_param="-b %s" % self.dut.ports_info[0]["pci"]
+            "Default", eal_param="-b %s" % blocked_pci_address
         )
-        self.check_blocklisted_ports(out, self.ports[1:])
+
+        """
+        To multi-port NIC with one PCIADRESS, port has same PCIADRESS will also
+        be blocked when selected port blocked.
+        """
+        ports_to_blocklist = []
+        ports_no_blocklist = []
+        for port in self.ports:
+            if self.dut.ports_info[port]["pci"] == blocked_pci_address:
+                ports_to_blocklist.append(port)
+            else:
+                ports_no_blocklist.append(port)
+
+        self.check_blocklisted_ports(out, ports_to_blocklist, True)
+        self.check_blocklisted_ports(out, ports_no_blocklist)
 
     def test_bl_all_but_one_port_blocklisted(self):
         """
-- 
2.41.0



More information about the dts mailing list