@@ -9,7 +9,7 @@
from framework.config import CPU, Architecture, NodeConfiguration
from framework.logger import DTSLOG
from framework.remote_session.factory import create_remote_session
-from framework.remote_session.remote_session import RemoteSession
+from framework.remote_session.remote_session import CommandResult, RemoteSession
from framework.settings import SETTINGS
from framework.utils import EnvVarsDict
@@ -49,6 +49,20 @@ def is_alive(self) -> bool:
"""
return self.remote_session.is_alive()
+ def send_command(
+ self,
+ command: str,
+ timeout: float,
+ verify: bool = False,
+ env: EnvVarsDict | None = None,
+ ) -> CommandResult:
+ """
+ An all-purpose API in case the command to be executed is already
+ OS-agnostic, such as when the path to the executed command has been
+ constructed beforehand.
+ """
+ return self.remote_session.send_command(command, timeout, verify, env)
+
@abstractmethod
def guess_dpdk_remote_dir(self, remote_dir) -> PurePath:
"""
@@ -8,4 +8,5 @@
# pylama:ignore=W0611
+from .hw import CPUAmount, CPUAmountFilter, CPUListFilter, CPUList
from .node import Node, SutNode
@@ -9,6 +9,7 @@
from framework.config import CPU, BuildTargetConfiguration, CPUList, NodeConfiguration
from framework.remote_session import OSSession
+from framework.remote_session.remote_session import CommandResult
from framework.settings import SETTINGS
from framework.testbed_model.hw import CPUAmount, CPUListFilter
from framework.utils import EnvVarsDict, skip_setup
@@ -224,6 +225,16 @@ def create_eal_parameters(
return eal_str
+ def run_dpdk_app(
+ self, app_path: PurePath, eal_args: str, timeout: float = 30
+ ) -> CommandResult:
+ """
+ Run DPDK application on the remote node.
+ """
+ return self.main_session.send_command(
+ f"{app_path} {eal_args}", timeout, verify=True
+ )
+
class _EalParameter(object):
def __init__(
new file mode 100644
@@ -0,0 +1,53 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2010-2014 Intel Corporation
+
+"""
+DPDK Test suite.
+Test HelloWorld example.
+"""
+
+from framework.test_case import TestCase
+from framework.testbed_model import CPUAmount, CPUAmountFilter, CPUList
+
+
+class TestHelloWorld(TestCase):
+ def set_up_all(self):
+ """
+ Run at the start of each test suite.
+ hello_world Prerequisites:
+ helloworld build pass
+ """
+ self.app_helloworld_path = self.sut_node.build_dpdk_app("helloworld")
+
+ def test_hello_world_single_core(self):
+ """
+ Run hello world on single lcores
+ Only received hello message from core0
+ """
+
+ # get the mask for the first core
+ cpu_amount = CPUAmount(1, 1, 1)
+ cores = CPUAmountFilter(self.sut_node.cpus, cpu_amount).filter()
+ eal_para = self.sut_node.create_eal_parameters(core_filter_specifier=cpu_amount)
+ result = self.sut_node.run_dpdk_app(self.app_helloworld_path, eal_para)
+ self.verify(
+ f"hello from core {str(cores[0]) in result.stdout}",
+ f"EAL not started on core{cores[0]}",
+ )
+
+ def test_hello_world_all_cores(self):
+ """
+ Run hello world on all lcores
+ Received hello message from all lcores
+ """
+
+ # get the maximum logical core number
+ eal_para = self.sut_node.create_eal_parameters(
+ core_filter_specifier=CPUList(self.sut_node.cpus)
+ )
+ result = self.sut_node.run_dpdk_app(self.app_helloworld_path, eal_para, 50)
+ for core in self.sut_node.cpus:
+ self.verify(
+ f"hello from core {str(core) in result.stdout}",
+ f"EAL not started on core{core}",
+ )