DPDK patches and discussions
 help / color / mirror / Atom feed
From: Luca Vizzarro <luca.vizzarro@arm.com>
To: dev@dpdk.org
Cc: Paul Szczepanek <paul.szczepanek@arm.com>,
	Patrick Robb <probb@iol.unh.edu>,
	Luca Vizzarro <luca.vizzarro@arm.com>
Subject: [PATCH v2 2/2] dts: add blocklist test suite
Date: Thu,  7 Nov 2024 13:56:54 +0000	[thread overview]
Message-ID: <20241107135654.4121761-3-luca.vizzarro@arm.com> (raw)
In-Reply-To: <20241107135654.4121761-1-luca.vizzarro@arm.com>

This test suite tests the port blocklisting functionality built in
testpmd.

Signed-off-by: Luca Vizzarro <luca.vizzarro@arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
---
 dts/framework/config/conf_yaml_schema.json |  3 +-
 dts/tests/TestSuite_blocklist.py           | 63 ++++++++++++++++++++++
 2 files changed, 65 insertions(+), 1 deletion(-)
 create mode 100644 dts/tests/TestSuite_blocklist.py

diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json
index cc3e78cef5..65d0991686 100644
--- a/dts/framework/config/conf_yaml_schema.json
+++ b/dts/framework/config/conf_yaml_schema.json
@@ -244,7 +244,8 @@
         "hello_world",
         "os_udp",
         "pmd_buffer_scatter",
-        "vlan"
+        "vlan",
+        "blocklist"
       ]
     },
     "test_target": {
diff --git a/dts/tests/TestSuite_blocklist.py b/dts/tests/TestSuite_blocklist.py
new file mode 100644
index 0000000000..b9e9cd1d1a
--- /dev/null
+++ b/dts/tests/TestSuite_blocklist.py
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2024 Arm Limited
+
+"""The DPDK device blocklisting test suite.
+
+This testing suite ensures tests the port blocklisting functionality of testpmd.
+"""
+
+from framework.remote_session.testpmd_shell import TestPmdShell
+from framework.test_suite import TestSuite, func_test
+from framework.testbed_model.capability import TopologyType, requires
+from framework.testbed_model.port import Port
+
+
+@requires(topology_type=TopologyType.two_links)
+class TestBlocklist(TestSuite):
+    """DPDK device blocklisting test suite."""
+
+    def verify_blocklisted_ports(self, ports_to_block: list[Port]):
+        """Runs testpmd with the given ports blocklisted and verifies the ports."""
+        with TestPmdShell(self.sut_node, allowed_ports=[], blocked_ports=ports_to_block) as testpmd:
+            allowlisted_ports = {port.device_name for port in testpmd.show_port_info_all()}
+            blocklisted_ports = {port.pci for port in ports_to_block}
+
+            # sanity check
+            allowed_len = len(allowlisted_ports - blocklisted_ports)
+            self.verify(allowed_len > 0, "At least one port should have been allowed")
+
+            blocked = not allowlisted_ports & blocklisted_ports
+            self.verify(blocked, "At least one port was not blocklisted")
+
+    @func_test
+    def no_blocklisted(self):
+        """Run testpmd with no blocklisted device.
+
+        Steps:
+            Run testpmd without specifying allowed or blocked ports.
+        Verify:
+            That no ports were blocked.
+        """
+        self.verify_blocklisted_ports([])
+
+    @func_test
+    def one_port_blocklisted(self):
+        """Run testpmd with one blocklisted port.
+
+        Steps:
+            Run testpmd with one only one blocklisted port and allowing all the other ones.
+        Verify:
+            That the port was successfully blocklisted.
+        """
+        self.verify_blocklisted_ports(self.sut_node.ports[:1])
+
+    @func_test
+    def all_but_one_port_blocklisted(self):
+        """Run testpmd with all but one blocklisted port.
+
+        Steps:
+            Run testpmd with only one allowed port, blocking all the other ones.
+        Verify:
+            That all specified ports were successfully blocklisted.
+        """
+        self.verify_blocklisted_ports(self.sut_node.ports[:-1])
-- 
2.43.0


  parent reply	other threads:[~2024-11-07 14:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25 12:36 [PATCH 0/2] " Luca Vizzarro
2024-06-25 12:36 ` [PATCH 1/2] dts: add blocked ports to EalParams Luca Vizzarro
2024-09-09 19:17   ` Dean Marx
2024-09-11  0:13   ` Patrick Robb
2024-06-25 12:36 ` [PATCH 2/2] dts: add blocklist test suite Luca Vizzarro
2024-09-09 19:16   ` Dean Marx
2024-09-11  0:12   ` Patrick Robb
2024-11-07 13:56 ` [PATCH v2 0/2] " Luca Vizzarro
2024-11-07 13:56   ` [PATCH v2 1/2] dts: add blocked ports to EalParams Luca Vizzarro
2024-11-07 19:04     ` Nicholas Pratte
2024-11-08 14:36       ` Luca Vizzarro
2024-11-07 13:56   ` Luca Vizzarro [this message]
2024-11-07 20:33     ` [PATCH v2 2/2] dts: add blocklist test suite Nicholas Pratte
2024-11-08 14:38       ` Luca Vizzarro

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=20241107135654.4121761-3-luca.vizzarro@arm.com \
    --to=luca.vizzarro@arm.com \
    --cc=dev@dpdk.org \
    --cc=paul.szczepanek@arm.com \
    --cc=probb@iol.unh.edu \
    /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).