DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/6] dts: add build-less driver binding
@ 2025-02-24 13:28 Luca Vizzarro
  2025-02-24 13:28 ` [PATCH 1/6] dts: ensure runtime working directory Luca Vizzarro
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Luca Vizzarro @ 2025-02-24 13:28 UTC (permalink / raw)
  To: dev; +Cc: Luca Vizzarro, Patrick Robb, Paul Szczepanek

Hi there,

sending in a solution that could enable DTS to bind drivers for
DPDK-based apps, like traffic generators, that lack the DPDK build to
gather dpdk-devbind.py from.

Best,
Luca

Luca Vizzarro (6):
  dts: ensure runtime working directory
  dts: use topology in smoke tests
  dts: add tmp directory facility
  dts: decouple DPDK runtime from build
  dts: enable build-less DPDK driver binding
  dts: restore TG setup and teardown

 dts/framework/context.py                      |  3 +-
 dts/framework/remote_session/dpdk.py          | 49 +++++++++++++++----
 dts/framework/remote_session/dpdk_shell.py    |  2 +-
 dts/framework/test_run.py                     | 12 ++++-
 dts/framework/testbed_model/node.py           | 31 +++++++++++-
 dts/framework/testbed_model/os_session.py     | 12 +++++
 dts/framework/testbed_model/posix_session.py  |  5 ++
 .../traffic_generator/traffic_generator.py    |  2 +-
 dts/main.py                                   |  6 +++
 dts/tests/TestSuite_smoke_tests.py            |  4 +-
 dts/tests/TestSuite_softnic.py                |  2 +-
 11 files changed, 109 insertions(+), 19 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/6] dts: ensure runtime working directory
  2025-02-24 13:28 [PATCH 0/6] dts: add build-less driver binding Luca Vizzarro
@ 2025-02-24 13:28 ` Luca Vizzarro
  2025-02-24 13:28 ` [PATCH 2/6] dts: use topology in smoke tests Luca Vizzarro
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Luca Vizzarro @ 2025-02-24 13:28 UTC (permalink / raw)
  To: dev; +Cc: Luca Vizzarro, Paul Szczepanek, Patrick Robb

After loading the user's settings and supplied configuration files, make
the dts folder the working directory for the runner.

This allows DTS to easily access the local DPDK tree.

Signed-off-by: Luca Vizzarro <luca.vizzarro@arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
---
 dts/main.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/dts/main.py b/dts/main.py
index fa878cc16e..5de65c8a50 100755
--- a/dts/main.py
+++ b/dts/main.py
@@ -3,9 +3,12 @@
 # Copyright(c) 2010-2014 Intel Corporation
 # Copyright(c) 2022 PANTHEON.tech s.r.o.
 # Copyright(c) 2022 University of New Hampshire
+# Copyright(c) 2025 Arm Limited
 
 """The DTS executable."""
 
+import os
+
 from framework import settings
 
 
@@ -23,6 +26,9 @@ def main() -> None:
     from framework.runner import DTSRunner
 
     dts = DTSRunner()
+
+    # After loading up, make the dts folder the current working directory.
+    os.chdir(os.path.dirname(os.path.abspath(__file__)))
     dts.run()
 
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/6] dts: use topology in smoke tests
  2025-02-24 13:28 [PATCH 0/6] dts: add build-less driver binding Luca Vizzarro
  2025-02-24 13:28 ` [PATCH 1/6] dts: ensure runtime working directory Luca Vizzarro
@ 2025-02-24 13:28 ` Luca Vizzarro
  2025-02-24 13:28 ` [PATCH 3/6] dts: add tmp directory facility Luca Vizzarro
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Luca Vizzarro @ 2025-02-24 13:28 UTC (permalink / raw)
  To: dev; +Cc: Luca Vizzarro, Paul Szczepanek, Patrick Robb

The smoke tests where wrongly using all the node's ports for the smoke
tests. Ensure only the ports specified in the current topology are used.

Signed-off-by: Luca Vizzarro <luca.vizzarro@arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
---
 dts/tests/TestSuite_smoke_tests.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dts/tests/TestSuite_smoke_tests.py b/dts/tests/TestSuite_smoke_tests.py
index a8ea07595f..cc24dd01f4 100644
--- a/dts/tests/TestSuite_smoke_tests.py
+++ b/dts/tests/TestSuite_smoke_tests.py
@@ -48,7 +48,7 @@ def set_up_suite(self) -> None:
         """
         self.sut_node = self._ctx.sut_node  # FIXME: accessing the context should be forbidden
         self.dpdk_build_dir_path = self._ctx.dpdk.build.remote_dpdk_build_dir
-        self.nics_in_node = self.sut_node.config.ports
+        self.nics_in_node = [p.config for p in self.topology.sut_ports]
 
     @func_test
     def test_unit_tests(self) -> None:
-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/6] dts: add tmp directory facility
  2025-02-24 13:28 [PATCH 0/6] dts: add build-less driver binding Luca Vizzarro
  2025-02-24 13:28 ` [PATCH 1/6] dts: ensure runtime working directory Luca Vizzarro
  2025-02-24 13:28 ` [PATCH 2/6] dts: use topology in smoke tests Luca Vizzarro
@ 2025-02-24 13:28 ` Luca Vizzarro
  2025-02-24 13:28 ` [PATCH 4/6] dts: decouple DPDK runtime from build Luca Vizzarro
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Luca Vizzarro @ 2025-02-24 13:28 UTC (permalink / raw)
  To: dev; +Cc: Luca Vizzarro, Paul Szczepanek, Patrick Robb

Add a facility to create and ues a temporary runtime directory on the
remote nodes for each test run.

This requires adding setup and teardown steps for Node. To ensure that
setup is not performed twice in case of a loopback setup where the same
node is used both as SUT and TG, an internal state about the setup is
held.

Signed-off-by: Luca Vizzarro <luca.vizzarro@arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
---
 dts/framework/test_run.py                    |  4 +++
 dts/framework/testbed_model/node.py          | 31 +++++++++++++++++++-
 dts/framework/testbed_model/os_session.py    | 12 ++++++++
 dts/framework/testbed_model/posix_session.py |  5 ++++
 4 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/dts/framework/test_run.py b/dts/framework/test_run.py
index 9f37c4bb6c..69cc76bc25 100644
--- a/dts/framework/test_run.py
+++ b/dts/framework/test_run.py
@@ -333,6 +333,8 @@ def next(self) -> State | None:
         test_run.init_random_seed()
         test_run.remaining_tests = deque(test_run.selected_tests)
 
+        test_run.ctx.sut_node.setup()
+        test_run.ctx.tg_node.setup()
         test_run.ctx.dpdk.setup(test_run.ctx.topology.sut_ports)
 
         self.result.ports = test_run.ctx.topology.sut_ports + test_run.ctx.topology.tg_ports
@@ -417,6 +419,8 @@ def description(self) -> str:
     def next(self) -> State | None:
         """Next state."""
         self.test_run.ctx.dpdk.teardown(self.test_run.ctx.topology.sut_ports)
+        self.test_run.ctx.tg_node.teardown()
+        self.test_run.ctx.sut_node.teardown()
         self.result.update_teardown(Result.PASS)
         return None
 
diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py
index be1b4ac2ac..e6737cd173 100644
--- a/dts/framework/testbed_model/node.py
+++ b/dts/framework/testbed_model/node.py
@@ -14,12 +14,13 @@
 """
 
 from functools import cached_property
+from pathlib import PurePath
 
 from framework.config.node import (
     OS,
     NodeConfiguration,
 )
-from framework.exception import ConfigurationError
+from framework.exception import ConfigurationError, InternalError
 from framework.logger import DTSLogger, get_dts_logger
 
 from .cpu import Architecture, LogicalCore
@@ -56,6 +57,7 @@ class Node:
     _other_sessions: list[OSSession]
     _node_info: OSSessionInfo | None
     _compiler_version: str | None
+    _setup: bool
 
     def __init__(self, node_config: NodeConfiguration):
         """Connect to the node and gather info during initialization.
@@ -77,9 +79,36 @@ def __init__(self, node_config: NodeConfiguration):
         self._logger.info(f"Connected to node: {self.name}")
         self._get_remote_cpus()
         self._other_sessions = []
+        self._setup = False
         self.ports = [Port(self, port_config) for port_config in self.config.ports]
         self._logger.info(f"Created node: {self.name}")
 
+    def setup(self) -> None:
+        """Node setup."""
+        if self._setup:
+            return
+
+        self.tmp_dir = self.main_session.create_tmp_dir()
+        self._setup = True
+
+    def teardown(self) -> None:
+        """Node teardown."""
+        if not self._setup:
+            return
+
+        self.main_session.remove_remote_dir(self.tmp_dir)
+        del self.tmp_dir
+        self._setup = False
+
+    @cached_property
+    def tmp_dir(self) -> PurePath:
+        """Path to the temporary directory.
+
+        Raises:
+            InternalError: If called before the node has been setup.
+        """
+        raise InternalError("Temporary directory requested before setup.")
+
     @cached_property
     def ports_by_name(self) -> dict[str, Port]:
         """Ports mapped by the name assigned at configuration."""
diff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py
index 3c7b2a4f47..354c607357 100644
--- a/dts/framework/testbed_model/os_session.py
+++ b/dts/framework/testbed_model/os_session.py
@@ -195,6 +195,18 @@ def remote_path_exists(self, remote_path: str | PurePath) -> bool:
             :data:`True` if the path exists, :data:`False` otherwise.
         """
 
+    @abstractmethod
+    def create_tmp_dir(self, template: str = "dts.XXXXX") -> PurePath:
+        """Create a temporary directory on the remote node.
+
+        Args:
+            template: The template to use for the name of the directory. "X"s are treated
+                as placeholder.
+
+        Returns:
+            The path to the created directory.
+        """
+
     @abstractmethod
     def copy_from(self, source_file: str | PurePath, destination_dir: str | Path) -> None:
         """Copy a file from the remote node to the local filesystem.
diff --git a/dts/framework/testbed_model/posix_session.py b/dts/framework/testbed_model/posix_session.py
index eab08a90ce..2d2701e1cf 100644
--- a/dts/framework/testbed_model/posix_session.py
+++ b/dts/framework/testbed_model/posix_session.py
@@ -96,6 +96,11 @@ def remote_path_exists(self, remote_path: str | PurePath) -> bool:
         result = self.send_command(f"test -e {remote_path}")
         return not result.return_code
 
+    def create_tmp_dir(self, template: str = "dts.XXXXX") -> PurePath:
+        """Overrides :meth:`~.os_session.OSSession.create_tmp_dir`."""
+        result = self.send_command(f'mktemp -dp "" {template}')
+        return PurePath(result.stdout)
+
     def copy_from(self, source_file: str | PurePath, destination_dir: str | Path) -> None:
         """Overrides :meth:`~.os_session.OSSession.copy_from`."""
         self.remote_session.copy_from(source_file, destination_dir)
-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 4/6] dts: decouple DPDK runtime from build
  2025-02-24 13:28 [PATCH 0/6] dts: add build-less driver binding Luca Vizzarro
                   ` (2 preceding siblings ...)
  2025-02-24 13:28 ` [PATCH 3/6] dts: add tmp directory facility Luca Vizzarro
@ 2025-02-24 13:28 ` Luca Vizzarro
  2025-02-24 13:28 ` [PATCH 5/6] dts: enable build-less DPDK driver binding Luca Vizzarro
  2025-02-24 13:28 ` [PATCH 6/6] dts: restore TG setup and teardown Luca Vizzarro
  5 siblings, 0 replies; 7+ messages in thread
From: Luca Vizzarro @ 2025-02-24 13:28 UTC (permalink / raw)
  To: dev; +Cc: Luca Vizzarro, Paul Szczepanek, Patrick Robb

Allow the DPDKRuntimeEnvironment to work without an associated DPDK
build. This is useful when executing any program that is based on DPDK,
so that the common runtime functionality can be shared.

Signed-off-by: Luca Vizzarro <luca.vizzarro@arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
---
 dts/framework/context.py                   |  3 ++-
 dts/framework/remote_session/dpdk.py       | 29 +++++++++++++++-------
 dts/framework/remote_session/dpdk_shell.py |  2 +-
 dts/framework/test_run.py                  |  6 +++--
 dts/tests/TestSuite_smoke_tests.py         |  2 +-
 dts/tests/TestSuite_softnic.py             |  2 +-
 6 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/dts/framework/context.py b/dts/framework/context.py
index 8adffff57f..ddd7ed4d36 100644
--- a/dts/framework/context.py
+++ b/dts/framework/context.py
@@ -14,7 +14,7 @@
 from framework.testbed_model.topology import Topology
 
 if TYPE_CHECKING:
-    from framework.remote_session.dpdk import DPDKRuntimeEnvironment
+    from framework.remote_session.dpdk import DPDKBuildEnvironment, DPDKRuntimeEnvironment
     from framework.testbed_model.traffic_generator.traffic_generator import TrafficGenerator
 
 P = ParamSpec("P")
@@ -66,6 +66,7 @@ class Context:
     sut_node: Node
     tg_node: Node
     topology: Topology
+    dpdk_build: "DPDKBuildEnvironment"
     dpdk: "DPDKRuntimeEnvironment"
     tg: "TrafficGenerator"
     local: LocalContext = field(default_factory=LocalContext)
diff --git a/dts/framework/remote_session/dpdk.py b/dts/framework/remote_session/dpdk.py
index f75ec353ed..50c22769c1 100644
--- a/dts/framework/remote_session/dpdk.py
+++ b/dts/framework/remote_session/dpdk.py
@@ -24,7 +24,7 @@
     RemoteDPDKTarballLocation,
     RemoteDPDKTreeLocation,
 )
-from framework.exception import ConfigurationError, RemoteFileNotFoundError
+from framework.exception import ConfigurationError, InternalError, RemoteFileNotFoundError
 from framework.logger import DTSLogger, get_dts_logger
 from framework.params.eal import EalParams
 from framework.remote_session.remote_session import CommandResult
@@ -367,7 +367,7 @@ class DPDKRuntimeEnvironment:
     """Class handling a DPDK runtime environment."""
 
     config: Final[DPDKRuntimeConfiguration]
-    build: Final[DPDKBuildEnvironment]
+    build: Final[DPDKBuildEnvironment | None]
     _node: Final[Node]
     _logger: Final[DTSLogger]
 
@@ -383,14 +383,14 @@ def __init__(
         self,
         config: DPDKRuntimeConfiguration,
         node: Node,
-        build_env: DPDKBuildEnvironment,
+        build_env: DPDKBuildEnvironment | None = None,
     ):
         """DPDK environment constructor.
 
         Args:
             config: The configuration of DPDK.
             node: The target node to manage a DPDK environment.
-            build_env: The DPDK build environment.
+            build_env: The DPDK build environment, if any.
         """
         self.config = config
         self.build = build_env
@@ -417,13 +417,15 @@ def __init__(
 
     def setup(self, ports: Iterable[Port]):
         """Set up the DPDK runtime on the target node."""
-        self.build.setup()
+        if self.build:
+            self.build.setup()
         self.bind_ports_to_driver(ports)
 
     def teardown(self, ports: Iterable[Port]) -> None:
         """Reset DPDK variables and bind port driver to the OS driver."""
         self.bind_ports_to_driver(ports, for_dpdk=False)
-        self.build.teardown()
+        if self.build:
+            self.build.teardown()
 
     def run_dpdk_app(
         self, app_path: PurePath, eal_params: EalParams, timeout: float = 30
@@ -467,9 +469,18 @@ def bind_ports_to_driver(self, ports: Iterable[Port], for_dpdk: bool = True) ->
 
     @cached_property
     def devbind_script_path(self) -> PurePath:
-        """The path to the dpdk-devbind.py script on the node."""
-        return self._node.main_session.join_remote_path(
-            self.build.remote_dpdk_tree_path, "usertools", "dpdk-devbind.py"
+        """The path to the dpdk-devbind.py script on the node.
+
+        Raises:
+            InternalError: If attempting to retrieve the devbind script in a build-less runtime.
+        """
+        if self.build:
+            return self._node.main_session.join_remote_path(
+                self.build.remote_dpdk_tree_path, "usertools", "dpdk-devbind.py"
+            )
+
+        raise InternalError(
+            "DPDK runtime is not associated with any DPDK build. Can't retrieve dpdk-devbind.py."
         )
 
     def filter_lcores(
diff --git a/dts/framework/remote_session/dpdk_shell.py b/dts/framework/remote_session/dpdk_shell.py
index fc43448e06..0962414876 100644
--- a/dts/framework/remote_session/dpdk_shell.py
+++ b/dts/framework/remote_session/dpdk_shell.py
@@ -79,5 +79,5 @@ def _update_real_path(self, path: PurePath) -> None:
         Adds the remote DPDK build directory to the path.
         """
         super()._update_real_path(
-            PurePath(get_ctx().dpdk.build.remote_dpdk_build_dir).joinpath(path)
+            PurePath(get_ctx().dpdk_build.remote_dpdk_build_dir).joinpath(path)
         )
diff --git a/dts/framework/test_run.py b/dts/framework/test_run.py
index 69cc76bc25..84d8fb26ac 100644
--- a/dts/framework/test_run.py
+++ b/dts/framework/test_run.py
@@ -199,7 +199,9 @@ def __init__(self, config: TestRunConfiguration, nodes: Iterable[Node], result:
         dpdk_runtime_env = DPDKRuntimeEnvironment(config.dpdk, sut_node, dpdk_build_env)
         traffic_generator = create_traffic_generator(config.traffic_generator, tg_node)
 
-        self.ctx = Context(sut_node, tg_node, topology, dpdk_runtime_env, traffic_generator)
+        self.ctx = Context(
+            sut_node, tg_node, topology, dpdk_build_env, dpdk_runtime_env, traffic_generator
+        )
         self.result = result
         self.selected_tests = list(self.config.filter_tests())
         self.blocked = False
@@ -339,7 +341,7 @@ def next(self) -> State | None:
 
         self.result.ports = test_run.ctx.topology.sut_ports + test_run.ctx.topology.tg_ports
         self.result.sut_info = test_run.ctx.sut_node.node_info
-        self.result.dpdk_build_info = test_run.ctx.dpdk.build.get_dpdk_build_info()
+        self.result.dpdk_build_info = test_run.ctx.dpdk_build.get_dpdk_build_info()
 
         self.logger.debug(f"Found capabilities to check: {test_run.required_capabilities}")
         test_run.supported_capabilities = get_supported_capabilities(
diff --git a/dts/tests/TestSuite_smoke_tests.py b/dts/tests/TestSuite_smoke_tests.py
index cc24dd01f4..274ada0202 100644
--- a/dts/tests/TestSuite_smoke_tests.py
+++ b/dts/tests/TestSuite_smoke_tests.py
@@ -47,7 +47,7 @@ def set_up_suite(self) -> None:
             Set the build directory path and a list of NICs in the SUT node.
         """
         self.sut_node = self._ctx.sut_node  # FIXME: accessing the context should be forbidden
-        self.dpdk_build_dir_path = self._ctx.dpdk.build.remote_dpdk_build_dir
+        self.dpdk_build_dir_path = self._ctx.dpdk_build.remote_dpdk_build_dir
         self.nics_in_node = [p.config for p in self.topology.sut_ports]
 
     @func_test
diff --git a/dts/tests/TestSuite_softnic.py b/dts/tests/TestSuite_softnic.py
index eefd6d3273..9cd4e37746 100644
--- a/dts/tests/TestSuite_softnic.py
+++ b/dts/tests/TestSuite_softnic.py
@@ -46,7 +46,7 @@ def prepare_softnic_files(self) -> PurePath:
         spec_file = Path("rx_tx.spec")
         rx_tx_1_file = Path("rx_tx_1.io")
         rx_tx_2_file = Path("rx_tx_2.io")
-        path_sut = self._ctx.dpdk.build.remote_dpdk_build_dir
+        path_sut = self._ctx.dpdk_build.remote_dpdk_build_dir
         cli_file_sut = self.sut_node.main_session.join_remote_path(path_sut, cli_file)
         spec_file_sut = self.sut_node.main_session.join_remote_path(path_sut, spec_file)
         rx_tx_1_file_sut = self.sut_node.main_session.join_remote_path(path_sut, rx_tx_1_file)
-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 5/6] dts: enable build-less DPDK driver binding
  2025-02-24 13:28 [PATCH 0/6] dts: add build-less driver binding Luca Vizzarro
                   ` (3 preceding siblings ...)
  2025-02-24 13:28 ` [PATCH 4/6] dts: decouple DPDK runtime from build Luca Vizzarro
@ 2025-02-24 13:28 ` Luca Vizzarro
  2025-02-24 13:28 ` [PATCH 6/6] dts: restore TG setup and teardown Luca Vizzarro
  5 siblings, 0 replies; 7+ messages in thread
From: Luca Vizzarro @ 2025-02-24 13:28 UTC (permalink / raw)
  To: dev; +Cc: Luca Vizzarro, Paul Szczepanek, Patrick Robb

Add a facility to bind drivers for DPDK on runtimes where the DPDK build
is lacking. This is needed to execute any program that is based on DPDK,
but is unrelated to the testing.

Bugzilla ID: 1420

Signed-off-by: Luca Vizzarro <luca.vizzarro@arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
---
 dts/framework/remote_session/dpdk.py | 34 +++++++++++++++++++++-------
 1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/dts/framework/remote_session/dpdk.py b/dts/framework/remote_session/dpdk.py
index 50c22769c1..8d9f3b8948 100644
--- a/dts/framework/remote_session/dpdk.py
+++ b/dts/framework/remote_session/dpdk.py
@@ -419,6 +419,7 @@ def setup(self, ports: Iterable[Port]):
         """Set up the DPDK runtime on the target node."""
         if self.build:
             self.build.setup()
+        self._prepare_devbind_script()
         self.bind_ports_to_driver(ports)
 
     def teardown(self, ports: Iterable[Port]) -> None:
@@ -467,21 +468,38 @@ def bind_ports_to_driver(self, ports: Iterable[Port], for_dpdk: bool = True) ->
             )
             port.bound_for_dpdk = for_dpdk
 
-    @cached_property
-    def devbind_script_path(self) -> PurePath:
-        """The path to the dpdk-devbind.py script on the node.
+    def _prepare_devbind_script(self) -> None:
+        """Prepare the devbind script.
+
+        If the environment has a build associated with it, then use the script within that build's
+        tree. Otherwise, copy the script from the local repository.
 
         Raises:
-            InternalError: If attempting to retrieve the devbind script in a build-less runtime.
+            InternalError: If dpdk-devbind.py could not be found.
         """
         if self.build:
-            return self._node.main_session.join_remote_path(
+            self.devbind_script_path = self._node.main_session.join_remote_path(
                 self.build.remote_dpdk_tree_path, "usertools", "dpdk-devbind.py"
             )
+        else:
+            local_script_path = Path("..", "usertools", "dpdk-devbind.py").resolve()
+            if not local_script_path.exists():
+                raise InternalError("Could not find dpdk-devbind.py locally.")
 
-        raise InternalError(
-            "DPDK runtime is not associated with any DPDK build. Can't retrieve dpdk-devbind.py."
-        )
+            self.devbind_script_path = self._node.main_session.join_remote_path(
+                self._node.tmp_dir, local_script_path.name
+            )
+
+            self._node.main_session.copy_to(local_script_path, self.devbind_script_path)
+
+    @cached_property
+    def devbind_script_path(self) -> PurePath:
+        """The path to the dpdk-devbind.py script on the node.
+
+        Raises:
+            InternalError: If accessed before environment setup.
+        """
+        raise InternalError("Accessed devbind script path before setup.")
 
     def filter_lcores(
         self,
-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 6/6] dts: restore TG setup and teardown
  2025-02-24 13:28 [PATCH 0/6] dts: add build-less driver binding Luca Vizzarro
                   ` (4 preceding siblings ...)
  2025-02-24 13:28 ` [PATCH 5/6] dts: enable build-less DPDK driver binding Luca Vizzarro
@ 2025-02-24 13:28 ` Luca Vizzarro
  5 siblings, 0 replies; 7+ messages in thread
From: Luca Vizzarro @ 2025-02-24 13:28 UTC (permalink / raw)
  To: dev; +Cc: Luca Vizzarro, Paul Szczepanek, Patrick Robb

The setup and teardown was previously missed when reworking the
execution internals into states. Add back the traffic generator setup
and teardown respectively in TestRunSetup and TestRunTeardown.

Signed-off-by: Luca Vizzarro <luca.vizzarro@arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
---
 dts/framework/test_run.py                                       | 2 ++
 .../testbed_model/traffic_generator/traffic_generator.py        | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/dts/framework/test_run.py b/dts/framework/test_run.py
index 84d8fb26ac..774036571b 100644
--- a/dts/framework/test_run.py
+++ b/dts/framework/test_run.py
@@ -338,6 +338,7 @@ def next(self) -> State | None:
         test_run.ctx.sut_node.setup()
         test_run.ctx.tg_node.setup()
         test_run.ctx.dpdk.setup(test_run.ctx.topology.sut_ports)
+        test_run.ctx.tg.setup(test_run.ctx.topology.tg_ports)
 
         self.result.ports = test_run.ctx.topology.sut_ports + test_run.ctx.topology.tg_ports
         self.result.sut_info = test_run.ctx.sut_node.node_info
@@ -420,6 +421,7 @@ def description(self) -> str:
 
     def next(self) -> State | None:
         """Next state."""
+        self.test_run.ctx.tg.teardown(self.test_run.ctx.topology.tg_ports)
         self.test_run.ctx.dpdk.teardown(self.test_run.ctx.topology.sut_ports)
         self.test_run.ctx.tg_node.teardown()
         self.test_run.ctx.sut_node.teardown()
diff --git a/dts/framework/testbed_model/traffic_generator/traffic_generator.py b/dts/framework/testbed_model/traffic_generator/traffic_generator.py
index 4469273e36..804662e114 100644
--- a/dts/framework/testbed_model/traffic_generator/traffic_generator.py
+++ b/dts/framework/testbed_model/traffic_generator/traffic_generator.py
@@ -53,7 +53,7 @@ def __init__(self, tg_node: Node, config: TrafficGeneratorConfig, **kwargs):
     def setup(self, ports: Iterable[Port]):
         """Setup the traffic generator."""
 
-    def teardown(self):
+    def teardown(self, ports: Iterable[Port]):
         """Teardown the traffic generator."""
 
     def send_packet(self, packet: Packet, port: Port) -> None:
-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-02-24 13:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-24 13:28 [PATCH 0/6] dts: add build-less driver binding Luca Vizzarro
2025-02-24 13:28 ` [PATCH 1/6] dts: ensure runtime working directory Luca Vizzarro
2025-02-24 13:28 ` [PATCH 2/6] dts: use topology in smoke tests Luca Vizzarro
2025-02-24 13:28 ` [PATCH 3/6] dts: add tmp directory facility Luca Vizzarro
2025-02-24 13:28 ` [PATCH 4/6] dts: decouple DPDK runtime from build Luca Vizzarro
2025-02-24 13:28 ` [PATCH 5/6] dts: enable build-less DPDK driver binding Luca Vizzarro
2025-02-24 13:28 ` [PATCH 6/6] dts: restore TG setup and teardown Luca Vizzarro

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).