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

Message ID 20230703193459.41870-3-niklas.soderlund@corigine.com (mailing list archive)
State New
Headers
Series tests/blocklist: Add support for NFP PMD |

Checks

Context Check Description
ci/Intel-dts-format-test success Testing OK
ci/Intel-dts-pylama-test success Testing OK
ci/Intel-dts-suite-test success Testing OK

Commit Message

Niklas Söderlund July 3, 2023, 7:34 p.m. UTC
  From: Qin Ke <qin.ke@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@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Reviewed-by Dano Teixeira <dano.teixeira@corigine.com>
---
 tests/TestSuite_blocklist.py | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
  

Patch

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):
         """