[v6] dts: reform hello world test suite

Message ID 20250115155153.27776-1-dmarx@iol.unh.edu (mailing list archive)
State Accepted
Delegated to: Paul Szczepanek
Headers
Series [v6] dts: reform hello world test suite |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-unit-amd64-testing fail Testing issues
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS

Commit Message

Dean Marx Jan. 15, 2025, 3:51 p.m. UTC
Add a test suite to replace hello_world which simply
starts and stops a testpmd session. The user can use
this as a confidence check to verify their configuration.

Signed-off-by: Dean Marx <dmarx@iol.unh.edu>
Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
Reviewed-by: Luca Vizzarro <luca.vizzarro@arm.com>
---
 dts/framework/test_suite.py        | 10 +++++
 dts/tests/TestSuite_hello_world.py | 69 ++++++------------------------
 2 files changed, 23 insertions(+), 56 deletions(-)
  

Patch

diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py
index 16012bfc79..de9f871b3f 100644
--- a/dts/framework/test_suite.py
+++ b/dts/framework/test_suite.py
@@ -300,6 +300,16 @@  def get_expected_packet(self, packet: Packet) -> Packet:
         """
         return self.get_expected_packets([packet])[0]
 
+    def log(self, message: str) -> None:
+        """Call the private instance of logger within the TestSuite class.
+
+        Log the given message with the level 'INFO'.
+
+        Args:
+            message: String representing the message to log.
+        """
+        self._logger.info(message)
+
     def _adjust_addresses(self, packets: list[Packet], expected: bool = False) -> list[Packet]:
         """L2 and L3 address additions in both directions.
 
diff --git a/dts/tests/TestSuite_hello_world.py b/dts/tests/TestSuite_hello_world.py
index 734f006026..031b94de4d 100644
--- a/dts/tests/TestSuite_hello_world.py
+++ b/dts/tests/TestSuite_hello_world.py
@@ -1,71 +1,28 @@ 
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2010-2014 Intel Corporation
+# Copyright(c) 2024 University of New Hampshire
 
-"""The DPDK hello world app test suite.
+"""DPDK Hello World test suite.
 
-Run the helloworld example app and verify it prints a message for each used core.
-No other EAL parameters apart from cores are used.
+Starts and stops a testpmd session to verify EAL parameters
+are properly configured.
 """
 
-from framework.remote_session.dpdk_shell import compute_eal_params
+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.cpu import (
-    LogicalCoreCount,
-    LogicalCoreCountFilter,
-    LogicalCoreList,
-)
 
 
-@requires(topology_type=TopologyType.no_link)
 class TestHelloWorld(TestSuite):
-    """DPDK hello world app test suite."""
-
-    def set_up_suite(self) -> None:
-        """Set up the test suite.
-
-        Setup:
-            Build the app we're about to test - helloworld.
-        """
-        self.app_helloworld_path = self.sut_node.build_dpdk_app("helloworld")
-
-    @func_test
-    def hello_world_single_core(self) -> None:
-        """Single core test case.
-
-        Steps:
-            Run the helloworld app on the first usable logical core.
-        Verify:
-            The app prints a message from the used core:
-            "hello from core <core_id>"
-        """
-        # get the first usable core
-        lcore_amount = LogicalCoreCount(1, 1, 1)
-        lcores = LogicalCoreCountFilter(self.sut_node.lcores, lcore_amount).filter()
-        eal_para = compute_eal_params(self.sut_node, lcore_filter_specifier=lcore_amount)
-        result = self.sut_node.run_dpdk_app(self.app_helloworld_path, eal_para)
-        self.verify(
-            f"hello from core {int(lcores[0])}" in result.stdout,
-            f"helloworld didn't start on lcore{lcores[0]}",
-        )
+    """Hello World test suite. One test case, which starts and stops a testpmd session."""
 
     @func_test
-    def hello_world_all_cores(self) -> None:
-        """All cores test case.
+    def test_hello_world(self) -> None:
+        """EAL confidence test.
 
         Steps:
-            Run the helloworld app on all usable logical cores.
+            Start testpmd session and check status.
         Verify:
-            The app prints a message from all used cores:
-            "hello from core <core_id>"
+            The testpmd session throws no errors.
         """
-        # get the maximum logical core number
-        eal_para = compute_eal_params(
-            self.sut_node, lcore_filter_specifier=LogicalCoreList(self.sut_node.lcores)
-        )
-        result = self.sut_node.run_dpdk_app(self.app_helloworld_path, eal_para, 50)
-        for lcore in self.sut_node.lcores:
-            self.verify(
-                f"hello from core {int(lcore)}" in result.stdout,
-                f"helloworld didn't start on lcore{lcore}",
-            )
+        with TestPmdShell(node=self.sut_node) as testpmd:
+            testpmd.start()
+        self.log("Hello World!")