Skip to contentSkip to conversation

DTS external DPDK build

PATCH New Tomáš Ďurovec 5 participants 52 messages Oct 2, 2024 – Oct 29, 2024

lore
Share & tools
lore
#0 lore raw

cover DTS external DPDK build

This patch series adds ability to use pre-build DPDK in various options of usage. User can specify this option from config file or cmd arguments/environment variables:
* The source of DPDK (tarball or tree),
* The build dir witch will be located in a subdirectory of DPDK tree root directory, otherwise will be used build configuration from config file,
* Location where the DPDK source will be stored either in SUT node or local filesystem.

Tomáš Ďurovec (7):
dts: rename build target to DPDK build
dts: one dpdk build per test run
dts: fix remote session file transfer vars
dts: add the ability to copy directories via remote
dts: add support for externally compiled DPDK
doc: update argument options for external DPDK build
dts: remove git ref option

 doc/guides/tools/dts.rst                      |  18 +-
 dts/conf.yaml                                 |  17 +-
 dts/framework/config/__init__.py              | 140 ++++++-
 dts/framework/config/conf_yaml_schema.json    |  72 +++-
 dts/framework/config/types.py                 |  19 +-
 dts/framework/exception.py                    |   4 +-
 dts/framework/logger.py                       |   4 -
 dts/framework/remote_session/dpdk_shell.py    |   2 +-
 .../remote_session/remote_session.py          |  24 +-
 dts/framework/remote_session/ssh_session.py   |  18 +-
 dts/framework/runner.py                       | 139 ++-----
 dts/framework/settings.py                     | 200 +++++++---
 dts/framework/test_result.py                  | 124 ++----
 dts/framework/test_suite.py                   |   2 +-
 dts/framework/testbed_model/node.py           |  22 +-
 dts/framework/testbed_model/os_session.py     | 209 ++++++++--
 dts/framework/testbed_model/posix_session.py  | 141 ++++++-
 dts/framework/testbed_model/sut_node.py       | 366 ++++++++++++------
 dts/framework/utils.py                        | 164 ++++----
 dts/tests/TestSuite_smoke_tests.py            |   2 +-
 20 files changed, 1078 insertions(+), 609 deletions(-)
Signature · 1 line
2.46.1
#1 lore raw

PATCH 1/7 dts: rename build target to DPDK build

Since the DPDK may already be built, some more general name is needed that includes both the DPDK location and the build config (if we are going to build).

---
 dts/conf.yaml                              |   2 +-
 dts/framework/config/__init__.py           |  26 ++---
 dts/framework/config/conf_yaml_schema.json |  10 +-
 dts/framework/config/types.py              |   4 +-
 dts/framework/logger.py                    |   4 +-
 dts/framework/runner.py                    | 112 ++++++++++-----------
 dts/framework/settings.py                  |   2 +-
 dts/framework/test_result.py               |  72 +++++++------
 dts/framework/test_suite.py                |   2 +-
 dts/framework/testbed_model/sut_node.py    |  55 +++++-----
 dts/tests/TestSuite_smoke_tests.py         |   2 +-
 11 files changed, 142 insertions(+), 149 deletions(-)
dts/conf.yaml +1 -1
index ca5e87636e..1363e93580 100644
@@ -4,7 +4,7 @@
 
 test_runs:
   # define one test run environment
-  - build_targets:
+  - dpdk_builds:
       - arch: x86_64
         os: linux
         cpu: native
dts/framework/config/__init__.py +13 -13
index 269d9ec318..c243716010 100644
@@ -45,8 +45,8 @@
 from typing_extensions import Self
 
 from framework.config.types import (
-    BuildTargetConfigDict,
     ConfigurationDict,
+    DPDKBuildConfigDict,
     NodeConfigDict,
     PortConfigDict,
     TestRunConfigDict,
@@ -335,7 +335,7 @@ class NodeInfo:
 
 
 @dataclass(slots=True, frozen=True)
-class BuildTargetConfiguration:
+class DPDKBuildConfiguration:
     """DPDK build configuration.
 
     The configuration used for building DPDK.
@@ -358,7 +358,7 @@ class BuildTargetConfiguration:
     name: str
 
     @classmethod
-    def from_dict(cls, d: BuildTargetConfigDict) -> Self:
+    def from_dict(cls, d: DPDKBuildConfigDict) -> Self:
         r"""A convenience method that processes the inputs before creating an instance.
 
         `arch`, `os`, `cpu` and `compiler` are converted to :class:`Enum`\s and
@@ -368,7 +368,7 @@ def from_dict(cls, d: BuildTargetConfigDict) -> Self:
             d: The configuration dictionary.
 
         Returns:
-            The build target configuration instance.
+            The DPDK build configuration instance.
         """
         return cls(
             arch=Architecture(d["arch"]),
@@ -381,8 +381,8 @@ def from_dict(cls, d: BuildTargetConfigDict) -> Self:
 
 
 @dataclass(slots=True, frozen=True)
-class BuildTargetInfo:
-    """Various versions and other information about a build target.
+class DPDKBuildInfo:
+    """Various versions and other information about a DPDK build.
 
     Attributes:
         dpdk_version: The DPDK version that was built.
@@ -437,7 +437,7 @@ class TestRunConfiguration:
     and with what DPDK build.
 
     Attributes:
-        build_targets: A list of DPDK builds to test.
+        dpdk_builds: A list of DPDK builds to test.
         perf: Whether to run performance tests.
         func: Whether to run functional tests.
         skip_smoke_tests: Whether to skip smoke tests.
@@ -448,7 +448,7 @@ class TestRunConfiguration:
         random_seed: The seed to use for pseudo-random generation.
     """
 
-    build_targets: list[BuildTargetConfiguration]
+    dpdk_builds: list[DPDKBuildConfiguration]
     perf: bool
     func: bool
     skip_smoke_tests: bool
@@ -466,7 +466,7 @@ def from_dict(
     ) -> Self:
         """A convenience method that processes the inputs before creating an instance.
 
-        The build target and the test suite config are transformed into their respective objects.
+        The DPDK build and the test suite config are transformed into their respective objects.
         SUT and TG configurations are taken from `node_map`. The other (:class:`bool`) attributes
         are just stored.
 
@@ -477,8 +477,8 @@ def from_dict(
         Returns:
             The test run configuration instance.
         """
-        build_targets: list[BuildTargetConfiguration] = list(
-            map(BuildTargetConfiguration.from_dict, d["build_targets"])
+        dpdk_builds: list[DPDKBuildConfiguration] = list(
+            map(DPDKBuildConfiguration.from_dict, d["dpdk_builds"])
         )
         test_suites: list[TestSuiteConfig] = list(map(TestSuiteConfig.from_dict, d["test_suites"]))
         sut_name = d["system_under_test_node"]["node_name"]
@@ -501,7 +501,7 @@ def from_dict(
         )
         random_seed = d.get("random_seed", None)
         return cls(
-            build_targets=build_targets,
+            dpdk_builds=dpdk_builds,
             perf=d["perf"],
             func=d["func"],
             skip_smoke_tests=skip_smoke_tests,
@@ -552,7 +552,7 @@ class Configuration:
     def from_dict(cls, d: ConfigurationDict) -> Self:
         """A convenience method that processes the inputs before creating an instance.
 
-        Build target and test suite config are transformed into their respective objects.
+        DPDK build and test suite config are transformed into their respective objects.
         SUT and TG configurations are taken from `node_map`. The other (:class:`bool`) attributes
         are just stored.
 
dts/framework/config/conf_yaml_schema.json +5 -5
index df390e8ae2..927a73ac6c 100644
@@ -110,9 +110,9 @@
         "mscv"
       ]
     },
-    "build_target": {
+    "dpdk_build": {
       "type": "object",
-      "description": "Targets supported by DTS",
+      "description": "DPDK build configuration supported by DTS.",
       "properties": {
         "arch": {
           "type": "string",
@@ -327,10 +327,10 @@
       "items": {
         "type": "object",
         "properties": {
-          "build_targets": {
+          "dpdk_builds": {
             "type": "array",
             "items": {
-              "$ref": "#/definitions/build_target"
+              "$ref": "#/definitions/dpdk_build"
             },
             "minimum": 1
           },
@@ -387,7 +387,7 @@
         },
         "additionalProperties": false,
         "required": [
-          "build_targets",
+          "dpdk_builds",
           "perf",
           "func",
           "test_suites",
dts/framework/config/types.py +2 -2
index ce7b784ac8..4f450267d1 100644
@@ -71,7 +71,7 @@ class NodeConfigDict(TypedDict):
     traffic_generator: TrafficGeneratorConfigDict
 
 
-class BuildTargetConfigDict(TypedDict):
+class DPDKBuildConfigDict(TypedDict):
     """Allowed keys and values."""
 
     #:
@@ -108,7 +108,7 @@ class TestRunConfigDict(TypedDict):
     """Allowed keys and values."""
 
     #:
-    build_targets: list[BuildTargetConfigDict]
+    dpdk_builds: list[DPDKBuildConfigDict]
     #:
     perf: bool
     #:
dts/framework/logger.py +2 -2
index 9420323d38..3fbe618219 100644
@@ -33,7 +33,7 @@ class DtsStage(StrEnum):
     #:
     test_run_setup = auto()
     #:
-    build_target_setup = auto()
+    dpdk_build_setup = auto()
     #:
     test_suite_setup = auto()
     #:
@@ -41,7 +41,7 @@ class DtsStage(StrEnum):
     #:
     test_suite_teardown = auto()
     #:
-    build_target_teardown = auto()
+    dpdk_build_teardown = auto()
     #:
     test_run_teardown = auto()
     #:
dts/framework/runner.py +55 -57

236 lines not on this page · raw message

dts/framework/settings.py +1 -1
index 7744e37f54..52a1582d5c 100644
@@ -278,7 +278,7 @@ def _get_parser() -> _DTSArgumentParser:
         "--config-file",
         default=SETTINGS.config_file_path,
         type=Path,
-        help="The configuration file that describes the test cases, SUTs and targets.",
+        help="The configuration file that describes the test cases, SUTs and DPDK build configs.",
         metavar="FILE_PATH",
         dest="config_file_path",
     )
dts/framework/test_result.py +35 -37

158 lines not on this page · raw message

dts/framework/test_suite.py +1 -1
index 051509fb86..dbf33c3bcf 100644
@@ -66,7 +66,7 @@ class TestSuite:
     sut_node: SutNode
     tg_node: TGNode
     #: Whether the test suite is blocking. A failure of a blocking test suite
-    #: will block the execution of all subsequent test suites in the current build target.
+    #: will block the execution of all subsequent test suites in the current DPDK build.
     is_blocking: ClassVar[bool] = False
     _logger: DTSLogger
     _port_links: list[PortLink]
dts/framework/testbed_model/sut_node.py +26 -29

125 lines not on this page · raw message

dts/tests/TestSuite_smoke_tests.py +1 -1
index c0b0e6bb00..ac661472b9 100644
@@ -29,7 +29,7 @@ class TestSmokeTests(TestSuite):
 
     Attributes:
         is_blocking: This test suite will block the execution of all other test suites
-            in the build target after it.
+            in the DPDK build after it.
         nics_in_node: The NICs present on the SUT node.
     """
 
Signature · 1 line
2.46.1
#2 lore raw

PATCH 2/7 dts: one dpdk build per test run

In reply to Tomáš Ďurovec

When the DPDK build can be already pre-build, there is not a need for defining multiple build targets. To make it cleaner we decide to use one DPDK build wheater can be pre-build or DTS will build it.

---
 dts/conf.yaml                              |  14 +--
 dts/framework/config/__init__.py           |   9 +-
 dts/framework/config/conf_yaml_schema.json |  10 +-
 dts/framework/config/types.py              |   2 +-
 dts/framework/logger.py                    |   4 -
 dts/framework/runner.py                    | 117 +++++---------------
 dts/framework/test_result.py               | 119 ++++++---------------
 dts/framework/test_suite.py                |   2 +-
 dts/framework/testbed_model/sut_node.py    |   6 +-
 dts/tests/TestSuite_smoke_tests.py         |   2 +-
 10 files changed, 80 insertions(+), 205 deletions(-)
dts/conf.yaml +7 -7
index 1363e93580..814744a1fc 100644
@@ -4,13 +4,13 @@
 
 test_runs:
   # define one test run environment
-  - dpdk_builds:
-      - arch: x86_64
-        os: linux
-        cpu: native
-        # the combination of the following two makes CC="ccache gcc"
-        compiler: gcc
-        compiler_wrapper: ccache
+  - dpdk_build:
+      arch: x86_64
+      os: linux
+      cpu: native
+      # the combination of the following two makes CC="ccache gcc"
+      compiler: gcc
+      compiler_wrapper: ccache
     perf: false # disable performance testing
     func: true # enable functional testing
     skip_smoke_tests: false # optional
dts/framework/config/__init__.py +3 -6
index c243716010..49b2e8d016 100644
@@ -437,7 +437,7 @@ class TestRunConfiguration:
     and with what DPDK build.
 
     Attributes:
-        dpdk_builds: A list of DPDK builds to test.
+        dpdk_build: A DPDK build to test.
         perf: Whether to run performance tests.
         func: Whether to run functional tests.
         skip_smoke_tests: Whether to skip smoke tests.
@@ -448,7 +448,7 @@ class TestRunConfiguration:
         random_seed: The seed to use for pseudo-random generation.
     """
 
-    dpdk_builds: list[DPDKBuildConfiguration]
+    dpdk_build: DPDKBuildConfiguration
     perf: bool
     func: bool
     skip_smoke_tests: bool
@@ -477,9 +477,6 @@ def from_dict(
         Returns:
             The test run configuration instance.
         """
-        dpdk_builds: list[DPDKBuildConfiguration] = list(
-            map(DPDKBuildConfiguration.from_dict, d["dpdk_builds"])
-        )
         test_suites: list[TestSuiteConfig] = list(map(TestSuiteConfig.from_dict, d["test_suites"]))
         sut_name = d["system_under_test_node"]["node_name"]
         skip_smoke_tests = d.get("skip_smoke_tests", False)
@@ -501,7 +498,7 @@ def from_dict(
         )
         random_seed = d.get("random_seed", None)
         return cls(
-            dpdk_builds=dpdk_builds,
+            dpdk_build=DPDKBuildConfiguration.from_dict(d["dpdk_build"]),
             perf=d["perf"],
             func=d["func"],
             skip_smoke_tests=skip_smoke_tests,
dts/framework/config/conf_yaml_schema.json +3 -7
index 927a73ac6c..94d7efa5f5 100644
@@ -327,12 +327,8 @@
       "items": {
         "type": "object",
         "properties": {
-          "dpdk_builds": {
-            "type": "array",
-            "items": {
-              "$ref": "#/definitions/dpdk_build"
-            },
-            "minimum": 1
+          "dpdk_build": {
+            "$ref": "#/definitions/dpdk_build"
           },
           "perf": {
             "type": "boolean",
@@ -387,7 +383,7 @@
         },
         "additionalProperties": false,
         "required": [
-          "dpdk_builds",
+          "dpdk_build",
           "perf",
           "func",
           "test_suites",
dts/framework/config/types.py +1 -1
index 4f450267d1..a710c20d6a 100644
@@ -108,7 +108,7 @@ class TestRunConfigDict(TypedDict):
     """Allowed keys and values."""
 
     #:
-    dpdk_builds: list[DPDKBuildConfigDict]
+    dpdk_build: DPDKBuildConfigDict
     #:
     perf: bool
     #:
dts/framework/logger.py +0 -4
index 3fbe618219..d2b8e37da4 100644
@@ -33,16 +33,12 @@ class DtsStage(StrEnum):
     #:
     test_run_setup = auto()
     #:
-    dpdk_build_setup = auto()
-    #:
     test_suite_setup = auto()
     #:
     test_suite = auto()
     #:
     test_suite_teardown = auto()
     #:
-    dpdk_build_teardown = auto()
-    #:
     test_run_teardown = auto()
     #:
     post_run = auto()
dts/framework/runner.py +26 -91

205 lines not on this page · raw message

dts/framework/test_result.py +34 -85

201 lines not on this page · raw message

dts/framework/test_suite.py +1 -1
index dbf33c3bcf..6e14d47ae6 100644
@@ -66,7 +66,7 @@ class TestSuite:
     sut_node: SutNode
     tg_node: TGNode
     #: Whether the test suite is blocking. A failure of a blocking test suite
-    #: will block the execution of all subsequent test suites in the current DPDK build.
+    #: will block the execution of all subsequent test suites in the current test run.
     is_blocking: ClassVar[bool] = False
     _logger: DTSLogger
     _port_links: list[PortLink]
dts/framework/testbed_model/sut_node.py +4 -2
index 6b6fb894ca..9bfb91816e 100644
@@ -181,13 +181,15 @@ def set_up_test_run(self, test_run_config: TestRunConfiguration) -> None:
         super().set_up_test_run(test_run_config)
         for vdev in test_run_config.vdevs:
             self.virtual_devices.append(VirtualDevice(vdev))
+        self._set_up_dpdk(test_run_config.dpdk_build)
 
     def tear_down_test_run(self) -> None:
         """Extend the test run teardown with virtual device teardown."""
         super().tear_down_test_run()
         self.virtual_devices = []
+        self._tear_down_dpdk()
 
-    def set_up_dpdk(self, dpdk_build_config: DPDKBuildConfiguration) -> None:
+    def _set_up_dpdk(self, dpdk_build_config: DPDKBuildConfiguration) -> None:
         """Set up DPDK the SUT node and bind ports.
 
         DPDK setup includes setting all internals needed for the build, the copying of DPDK tarball
@@ -202,7 +204,7 @@ def set_up_dpdk(self, dpdk_build_config: DPDKBuildConfiguration) -> None:
         self._build_dpdk()
         self.bind_ports_to_driver()
 
-    def tear_down_dpdk(self) -> None:
+    def _tear_down_dpdk(self) -> None:
         """Reset DPDK variables and bind port driver to the OS driver."""
         self._env_vars = {}
         self._dpdk_build_config = None
dts/tests/TestSuite_smoke_tests.py +1 -1
index ac661472b9..99fa8d19c7 100644
@@ -29,7 +29,7 @@ class TestSmokeTests(TestSuite):
 
     Attributes:
         is_blocking: This test suite will block the execution of all other test suites
-            in the DPDK build after it.
+            in the test run after it.
         nics_in_node: The NICs present on the SUT node.
     """
 
Signature · 1 line
2.46.1
#3 lore raw

PATCH 3/7 dts: fix remote session file transfer vars

In reply to Tomáš Ďurovec

The OSSession (and its subclasses) should accept PurePaths for remote paths to translate from OS-unaware (PurePath) to OS-aware (Path) only on the remote side. For local paths, they should accept Paths, as Python is OS-aware locally.

---
 .../remote_session/remote_session.py          | 24 ++++++----------
 dts/framework/remote_session/ssh_session.py   | 18 ++++--------
 dts/framework/testbed_model/os_session.py     | 28 ++++++++-----------
 dts/framework/testbed_model/posix_session.py  | 18 ++++--------
 4 files changed, 30 insertions(+), 58 deletions(-)
dts/framework/remote_session/remote_session.py +9 -15
index 8c580b070f..ab83f5b266 100644
@@ -12,7 +12,7 @@
 
 from abc import ABC, abstractmethod
 from dataclasses import InitVar, dataclass, field
-from pathlib import PurePath
+from pathlib import Path, PurePath
 
 from framework.config import NodeConfiguration
 from framework.exception import RemoteCommandExecutionError
@@ -196,35 +196,29 @@ def is_alive(self) -> bool:
         """Check whether the remote session is still responding."""
 
     @abstractmethod
-    def copy_from(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_from(self, source_file: str | PurePath, destination_dir: str | Path) -> None:
         """Copy a file from the remote Node to the local filesystem.
 
         Copy `source_file` from the remote Node associated with this remote session
-        to `destination_file` on the local filesystem.
+        to `destination_dir` on the local filesystem.
 
         Args:
             source_file: The file on the remote Node.
-            destination_file: A file or directory path on the local filesystem.
+            destination_dir: The directory path on the local filesystem where the `source_file`
+                will be saved.
         """
 
     @abstractmethod
-    def copy_to(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_to(self, source_file: str | Path, destination_dir: str | PurePath) -> None:
         """Copy a file from local filesystem to the remote Node.
 
-        Copy `source_file` from local filesystem to `destination_file` on the remote Node
+        Copy `source_file` from local filesystem to `destination_dir` on the remote Node
         associated with this remote session.
 
         Args:
             source_file: The file on the local filesystem.
-            destination_file: A file or directory path on the remote Node.
+            destination_dir: The directory path on the remote Node where the `source_file`
+                will be saved.
         """
 
     @abstractmethod
dts/framework/remote_session/ssh_session.py +5 -13
index 66f8176833..329121913f 100644
@@ -5,7 +5,7 @@
 
 import socket
 import traceback
-from pathlib import PurePath
+from pathlib import Path, PurePath
 
 from fabric import Connection  # type: ignore[import-untyped]
 from invoke.exceptions import (  # type: ignore[import-untyped]
@@ -103,21 +103,13 @@ def is_alive(self) -> bool:
         """Overrides :meth:`~.remote_session.RemoteSession.is_alive`."""
         return self.session.is_connected
 
-    def copy_from(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_from(self, source_file: str | PurePath, destination_dir: str | Path) -> None:
         """Overrides :meth:`~.remote_session.RemoteSession.copy_from`."""
-        self.session.get(str(destination_file), str(source_file))
+        self.session.get(str(source_file), str(destination_dir))
 
-    def copy_to(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_to(self, source_file: str | Path, destination_dir: str | PurePath) -> None:
         """Overrides :meth:`~.remote_session.RemoteSession.copy_to`."""
-        self.session.put(str(source_file), str(destination_file))
+        self.session.put(str(source_file), str(destination_dir))
 
     def close(self) -> None:
         """Overrides :meth:`~.remote_session.RemoteSession.close`."""
dts/framework/testbed_model/os_session.py +11 -17
index 79f56b289b..1aac3659bf 100644
@@ -25,7 +25,7 @@
 from abc import ABC, abstractmethod
 from collections.abc import Iterable
 from ipaddress import IPv4Interface, IPv6Interface
-from pathlib import PurePath
+from pathlib import Path, PurePath
 from typing import Union
 
 from framework.config import Architecture, NodeConfiguration, NodeInfo
@@ -178,35 +178,29 @@ def join_remote_path(self, *args: str | PurePath) -> PurePath:
         """
 
     @abstractmethod
-    def copy_from(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_from(self, source_file: str | PurePath, destination_dir: str | Path) -> None:
         """Copy a file from the remote node to the local filesystem.
 
         Copy `source_file` from the remote node associated with this remote
-        session to `destination_file` on the local filesystem.
+        session to `destination_dir` on the local filesystem.
 
         Args:
-            source_file: the file on the remote node.
-            destination_file: a file or directory path on the local filesystem.
+            source_file: The file on the remote node.
+            destination_dir: The directory path on the local filesystem where the `source_file`
+                will be saved.
         """
 
     @abstractmethod
-    def copy_to(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_to(self, source_file: str | Path, destination_dir: str | PurePath) -> None:
         """Copy a file from local filesystem to the remote node.
 
-        Copy `source_file` from local filesystem to `destination_file`
+        Copy `source_file` from local filesystem to `destination_dir`
         on the remote node associated with this remote session.
 
         Args:
-            source_file: the file on the local filesystem.
-            destination_file: a file or directory path on the remote node.
+            source_file: The file on the local filesystem.
+            destination_dir: The directory path on the remote Node where the `source_file`
+                will be saved.
         """
 
     @abstractmethod
dts/framework/testbed_model/posix_session.py +5 -13
index d279bb8b53..2449c0ab35 100644
@@ -13,7 +13,7 @@
 
 import re
 from collections.abc import Iterable
-from pathlib import PurePath, PurePosixPath
+from pathlib import Path, PurePath, PurePosixPath
 
 from framework.config import Architecture, NodeInfo
 from framework.exception import DPDKBuildError, RemoteCommandExecutionError
@@ -85,21 +85,13 @@ def join_remote_path(self, *args: str | PurePath) -> PurePosixPath:
         """Overrides :meth:`~.os_session.OSSession.join_remote_path`."""
         return PurePosixPath(*args)
 
-    def copy_from(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    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_file)
+        self.remote_session.copy_from(source_file, destination_dir)
 
-    def copy_to(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_to(self, source_file: str | Path, destination_dir: str | PurePath) -> None:
         """Overrides :meth:`~.os_session.OSSession.copy_to`."""
-        self.remote_session.copy_to(source_file, destination_file)
+        self.remote_session.copy_to(source_file, destination_dir)
 
     def remove_remote_dir(
         self,
Signature · 1 line
2.46.1
#4 lore raw

PATCH 4/7 dts: add the ability to copy directories via remote

In reply to Tomáš Ďurovec

Before, the remote session did't allows to copy directories, only files. This feature will be used in future commit.

---
 dts/framework/testbed_model/os_session.py    | 120 ++++++++++++++++++-
 dts/framework/testbed_model/posix_session.py |  88 +++++++++++++-
 dts/framework/utils.py                       |  91 +++++++++++++-
 3 files changed, 287 insertions(+), 12 deletions(-)
dts/framework/testbed_model/os_session.py +116 -4
index 1aac3659bf..6c3f84dec1 100644
@@ -25,7 +25,7 @@
 from abc import ABC, abstractmethod
 from collections.abc import Iterable
 from ipaddress import IPv4Interface, IPv6Interface
-from pathlib import Path, PurePath
+from pathlib import Path, PurePath, PurePosixPath
 from typing import Union
 
 from framework.config import Architecture, NodeConfiguration, NodeInfo
@@ -38,7 +38,7 @@
 )
 from framework.remote_session.remote_session import CommandResult
 from framework.settings import SETTINGS
-from framework.utils import MesonArgs
+from framework.utils import MesonArgs, TarCompressionFormat
 
 from .cpu import LogicalCore
 from .port import Port
@@ -203,6 +203,95 @@ def copy_to(self, source_file: str | Path, destination_dir: str | PurePath) -> N
                 will be saved.
         """
 
+    @abstractmethod
+    def copy_dir_from(
+        self,
+        source_dir: str | PurePath,
+        destination_dir: str | Path,
+        compress_format: TarCompressionFormat = TarCompressionFormat.none,
+        exclude: str | list[str] | None = None,
+    ) -> None:
+        """Copy a directory from the remote node to the local filesystem.
+
+        Copy `source_dir` from the remote node associated with this remote session to
+        `destination_dir` on the local filesystem. The new local directory will be created
+        at `destination_dir` path.
+
+        Example:
+            source_dir = '/remote/path/to/source'
+            destination_dir = '/local/path/to/destination'
+            compress_format = TarCompressionFormat.xz
+
+            The method will:
+                1. Create a tarball from `source_dir`, resulting in:
+                    '/remote/path/to/source.tar.xz',
+                2. Copy '/remote/path/to/source.tar.xz' to
+                    '/local/path/to/destination/source.tar.xz',
+                3. Extract the contents of the tarball, resulting in:
+                    '/local/path/to/destination/source/',
+                4. Remove the tarball after extraction
+                    ('/local/path/to/destination/source.tar.xz').
+
+            Final Path Structure:
+                '/local/path/to/destination/source/'
+
+        Args:
+            source_dir: The directory on the remote node.
+            destination_dir: The directory path on the local filesystem.
+            compress_format: The compression format to use. Defaults to no compression.
+            exclude: Patterns for files or directories to exclude from the tarball.
+                These patterns are used with `tar`'s `--exclude` option.
+        """
+
+    @abstractmethod
+    def copy_dir_to(
+        self,
+        source_dir: str | Path,
+        destination_dir: str | PurePath,
+        compress_format: TarCompressionFormat = TarCompressionFormat.none,
+        exclude: str | list[str] | None = None,
+    ) -> None:
+        """Copy a directory from the local filesystem to the remote node.
+
+        Copy `source_dir` from the local filesystem to `destination_dir` on the remote node
+        associated with this remote session. The new remote directory will be created at
+        `destination_dir` path.
+
+        Example:
+            source_dir = '/local/path/to/source'
+            destination_dir = '/remote/path/to/destination'
+            compress_format = TarCompressionFormat.xz
+
+            The method will:
+                1. Create a tarball from `source_dir`, resulting in:
+                    '/local/path/to/source.tar.xz',
+                2. Copy '/local/path/to/source.tar.xz' to
+                    '/remote/path/to/destination/source.tar.xz',
+                3. Extract the contents of the tarball, resulting in:
+                    '/remote/path/to/destination/source/',
+                4. Remove the tarball after extraction
+                    ('/remote/path/to/destination/source.tar.xz').
+
+            Final Path Structure:
+                '/remote/path/to/destination/source/'
+
+        Args:
+            source_dir: The directory on the local filesystem.
+            destination_dir: The directory path on the remote node.
+            compress_format: The compression format to use. Defaults to no compression.
+            exclude: Patterns for files or directories to exclude from the tarball.
+                These patterns are used with `fnmatch.fnmatch` to filter out files.
+        """
+
+    @abstractmethod
+    def remove_remote_file(self, remote_file_path: str | PurePath, force: bool = True) -> None:
+        """Remove remote file, by default remove forcefully.
+
+        Args:
+            remote_file_path: The file path to remove.
+            force: If :data:`True`, ignore all warnings and try to remove at all costs.
+        """
+
     @abstractmethod
     def remove_remote_dir(
         self,
@@ -213,11 +302,34 @@ def remove_remote_dir(
         """Remove remote directory, by default remove recursively and forcefully.
 
         Args:
-            remote_dir_path: The path of the directory to remove.
+            remote_dir_path: The directory path to remove.
             recursive: If :data:`True`, also remove all contents inside the directory.
             force: If :data:`True`, ignore all warnings and try to remove at all costs.
         """
 
+    @abstractmethod
+    def create_remote_tarball(
+        self,
+        remote_dir_path: str | PurePath,
+        compress_format: TarCompressionFormat = TarCompressionFormat.none,
+        exclude: str | list[str] | None = None,
+    ) -> PurePosixPath:
+        """Create a tarball from the contents of the specified remote directory.
+
+        This method creates a tarball containing all files and directories
+        within `remote_dir_path`. The tarball will be saved in the directory of
+        `remote_dir_path` and will be named based on `remote_dir_path`.
+
+        Args:
+            remote_dir_path: The directory path on the remote node.
+            compress_format: The compression format to use. Defaults to no compression.
+            exclude: Patterns for files or directories to exclude from the tarball.
+                These patterns are used with `tar`'s `--exclude` option.
+
+        Returns:
+            The path to the created tarball on the remote node.
+        """
+
     @abstractmethod
     def extract_remote_tarball(
         self,
@@ -227,7 +339,7 @@ def extract_remote_tarball(
         """Extract remote tarball in its remote directory.
 
         Args:
-            remote_tarball_path: The path of the tarball on the remote node.
+            remote_tarball_path: The tarball path on the remote node.
             expected_dir: If non-empty, check whether `expected_dir` exists after extracting
                 the archive.
         """
dts/framework/testbed_model/posix_session.py +84 -4

107 lines not on this page · raw message

dts/framework/utils.py +87 -4

146 lines not on this page · raw message

Signature · 1 line
2.46.1
#5 lore raw

PATCH 5/7 dts: add support for externally compiled DPDK

In reply to Tomáš Ďurovec

Add support for using DPDK source tree directory as well as DPDK tarball with the pre-build directory that can user specify and type of location, it can be stored in the local filesystem or SUT node. Additionally, this can be set up with the config file or cmd arguments/environment variables.

---
 dts/conf.yaml                                |  23 +-
 dts/framework/config/__init__.py             | 121 ++++++-
 dts/framework/config/conf_yaml_schema.json   |  62 +++-
 dts/framework/config/types.py                |  17 +-
 dts/framework/exception.py                   |   4 +-
 dts/framework/remote_session/dpdk_shell.py   |   2 +-
 dts/framework/runner.py                      |   8 +-
 dts/framework/settings.py                    | 193 +++++++++--
 dts/framework/test_result.py                 |  23 +-
 dts/framework/testbed_model/node.py          |  22 +-
 dts/framework/testbed_model/os_session.py    |  63 +++-
 dts/framework/testbed_model/posix_session.py |  39 ++-
 dts/framework/testbed_model/sut_node.py      | 345 +++++++++++++------
 13 files changed, 718 insertions(+), 204 deletions(-)
dts/conf.yaml +17 -6
index 814744a1fc..2f3010204d 100644
@@ -5,12 +5,23 @@
 test_runs:
   # define one test run environment
   - dpdk_build:
-      arch: x86_64
-      os: linux
-      cpu: native
-      # the combination of the following two makes CC="ccache gcc"
-      compiler: gcc
-      compiler_wrapper: ccache
+      # dpdk_tree: Commented out because `tarball` is defined.
+      tarball: dpdk-tarball.tar.xz
+      # Either `dpdk_tree` or `tarball` can be defined, but not both.
+      remote: false # Optional, defaults to false. If it's true, the `dpdk_tree` or `tarball`
+                    # is located on the SUT node, instead of the execution host.
+
+      # dir_name: Commented out because `build` is defined.
+      build:
+        arch: x86_64
+        os: linux
+        cpu: native
+        # the combination of the following two makes CC="ccache gcc"
+        compiler: gcc
+        compiler_wrapper: ccache # Optional.
+      # If `dir_name` is defined, DPDK has been pre-built and the build directory is located in a
+      # subdirectory of DPDK tree root directory. Otherwise, will be using a `build` to build the
+      # DPDK from source. Either `dir_name` or `build` can be defined, but not both.
     perf: false # disable performance testing
     func: true # enable functional testing
     skip_smoke_tests: false # optional
dts/framework/config/__init__.py +116 -5

163 lines not on this page · raw message

dts/framework/config/conf_yaml_schema.json +59 -3

81 lines not on this page · raw message

dts/framework/config/types.py +16 -1
index a710c20d6a..24884381cc 100644
@@ -86,6 +86,21 @@ class DPDKBuildConfigDict(TypedDict):
     compiler_wrapper: str
 
 
+class DPDKConfigurationDict(TypedDict):
+    """Allowed keys and values."""
+
+    #:
+    dpdk_tree: str | None
+    #:
+    tarball: str | None
+    #:
+    remote: bool
+    #:
+    dir_name: str | None
+    #:
+    build: DPDKBuildConfigDict
+
+
 class TestSuiteConfigDict(TypedDict):
     """Allowed keys and values."""
 
@@ -108,7 +123,7 @@ class TestRunConfigDict(TypedDict):
     """Allowed keys and values."""
 
     #:
-    dpdk_build: DPDKBuildConfigDict
+    dpdk_build: DPDKConfigurationDict
     #:
     perf: bool
     #:
dts/framework/exception.py +2 -2
index f45f789825..d967ede09b 100644
@@ -184,8 +184,8 @@ class InteractiveCommandExecutionError(DTSError):
     severity: ClassVar[ErrorSeverity] = ErrorSeverity.REMOTE_CMD_EXEC_ERR
 
 
-class RemoteDirectoryExistsError(DTSError):
-    """A directory that exists on a remote node."""
+class RemoteFileNotFoundError(DTSError):
+    """A remote file or directory is requested but doesn’t exist."""
 
     #:
     severity: ClassVar[ErrorSeverity] = ErrorSeverity.REMOTE_CMD_EXEC_ERR
dts/framework/remote_session/dpdk_shell.py +1 -1
index c5f5c2d116..b39132cc42 100644
@@ -104,4 +104,4 @@ def _update_real_path(self, path: PurePath) -> None:
 
         Adds the remote DPDK build directory to the path.
         """
-        super()._update_real_path(self._node.remote_dpdk_build_dir.joinpath(path))
+        super()._update_real_path(PurePath(self._node.remote_dpdk_build_dir).joinpath(path))
dts/framework/runner.py +6 -2
index 100dd75adb..7d463c1fa1 100644
@@ -414,15 +414,19 @@ def _run_test_run(
             test_run_config: A test run configuration.
             test_run_result: The test run's result.
             test_suites_with_cases: The test suites with test cases to run.
+
+        Raises:
+            ConfigurationError: If the DPDK sources or build is not set up from config or settings.
         """
         self._logger.info(
             f"Running test run with SUT '{test_run_config.system_under_test_node.name}'."
         )
         test_run_result.add_sut_info(sut_node.node_info)
         try:
-            sut_node.set_up_test_run(test_run_config)
+            dpdk_location = SETTINGS.dpdk_location or test_run_config.dpdk_config.dpdk_location
+            sut_node.set_up_test_run(test_run_config, dpdk_location)
             test_run_result.add_dpdk_build_info(sut_node.get_dpdk_build_info())
-            tg_node.set_up_test_run(test_run_config)
+            tg_node.set_up_test_run(test_run_config, dpdk_location)
             test_run_result.update_setup(Result.PASS)
         except Exception as e:
             self._logger.exception("Test run setup failed.")
dts/framework/settings.py +166 -27

274 lines not on this page · raw message

dts/framework/test_result.py +1 -22
index 31560f6704..0a10723098 100644
@@ -29,16 +29,7 @@
 from types import FunctionType
 from typing import Union
 
-from .config import (
-    OS,
-    Architecture,
-    Compiler,
-    CPUType,
-    DPDKBuildInfo,
-    NodeInfo,
-    TestRunConfiguration,
-    TestSuiteConfig,
-)
+from .config import DPDKBuildInfo, NodeInfo, TestRunConfiguration, TestSuiteConfig
 from .exception import DTSError, ErrorSeverity
 from .logger import DTSLogger
 from .settings import SETTINGS
@@ -318,10 +309,6 @@ class TestRunResult(BaseResult):
     The internal list stores the results of all test suites in a given test run.
 
     Attributes:
-        arch: The DPDK build architecture.
-        os: The DPDK build operating system.
-        cpu: The DPDK build CPU.
-        compiler: The DPDK build compiler.
         compiler_version: The DPDK build compiler version.
         dpdk_version: The built DPDK version.
         sut_os_name: The operating system of the SUT node.
@@ -329,10 +316,6 @@ class TestRunResult(BaseResult):
         sut_kernel_version: The operating system kernel version of the SUT node.
     """
 
-    arch: Architecture
-    os: OS
-    cpu: CPUType
-    compiler: Compiler
     compiler_version: str | None
     dpdk_version: str | None
     sut_os_name: str
@@ -348,10 +331,6 @@ def __init__(self, test_run_config: TestRunConfiguration):
             test_run_config: A test run configuration.
         """
         super().__init__()
-        self.arch = test_run_config.dpdk_build.arch
-        self.os = test_run_config.dpdk_build.os
-        self.cpu = test_run_config.dpdk_build.cpu
-        self.compiler = test_run_config.dpdk_build.compiler
         self.compiler_version = None
         self.dpdk_version = None
         self._config = test_run_config
dts/framework/testbed_model/node.py +6 -16
index 12a40170ac..f048b57ed5 100644
@@ -15,12 +15,11 @@
 
 from abc import ABC
 from ipaddress import IPv4Interface, IPv6Interface
-from typing import Any, Callable, Union
+from typing import Union
 
-from framework.config import OS, NodeConfiguration, TestRunConfiguration
+from framework.config import OS, DPDKLocation, NodeConfiguration, TestRunConfiguration
 from framework.exception import ConfigurationError
 from framework.logger import DTSLogger, get_dts_logger
-from framework.settings import SETTINGS
 
 from .cpu import (
     LogicalCore,
@@ -95,7 +94,9 @@ def _init_ports(self) -> None:
         for port in self.ports:
             self.configure_port_state(port)
 
-    def set_up_test_run(self, test_run_config: TestRunConfiguration) -> None:
+    def set_up_test_run(
+        self, test_run_config: TestRunConfiguration, dpdk_location: DPDKLocation
+    ) -> None:
         """Test run setup steps.
 
         Configure hugepages on all DTS node types. Additional steps can be added by
@@ -104,6 +105,7 @@ def set_up_test_run(self, test_run_config: TestRunConfiguration) -> None:
         Args:
             test_run_config: A test run configuration according to which
                 the setup steps will be taken.
+            dpdk_location: The target source of the DPDK tree.
         """
         self._setup_hugepages()
 
@@ -216,18 +218,6 @@ def close(self) -> None:
         for session in self._other_sessions:
             session.close()
 
-    @staticmethod
-    def skip_setup(func: Callable[..., Any]) -> Callable[..., Any]:
-        """Skip the decorated function.
-
-        The :option:`--skip-setup` command line argument and the :envvar:`DTS_SKIP_SETUP`
-        environment variable enable the decorator.
-        """
-        if SETTINGS.skip_setup:
-            return lambda *args: None
-        else:
-            return func
-
 
 def create_session(node_config: NodeConfiguration, name: str, logger: DTSLogger) -> OSSession:
     """Factory for OS-aware sessions.
dts/framework/testbed_model/os_session.py +52 -11

81 lines not on this page · raw message

dts/framework/testbed_model/posix_session.py +33 -6
index 94e721da61..5ab7c18fb7 100644
@@ -91,6 +91,11 @@ def join_remote_path(self, *args: str | PurePath) -> PurePosixPath:
         """Overrides :meth:`~.os_session.OSSession.join_remote_path`."""
         return PurePosixPath(*args)
 
+    def remote_path_exists(self, remote_path: str | PurePath) -> bool:
+        """Overrides :meth:`~.os_session.OSSession.remote_path_exists`."""
+        result = self.send_command(f"test -e {remote_path}")
+        return not result.return_code
+
     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)
@@ -196,6 +201,32 @@ def extract_remote_tarball(
         if expected_dir:
             self.send_command(f"ls {expected_dir}", verify=True)
 
+    def is_remote_dir(self, remote_path: str) -> bool:
+        """Overrides :meth:`~.os_session.OSSession.is_remote_dir`."""
+        result = self.send_command(f"test -d {remote_path}")
+        return not result.return_code
+
+    def is_remote_tarfile(self, remote_tarball_path: str) -> bool:
+        """Overrides :meth:`~.os_session.OSSession.is_remote_tarfile`."""
+        result = self.send_command(f"tar -tvf {remote_tarball_path}")
+        return not result.return_code
+
+    def get_tarball_top_dir(
+        self, remote_tarball_path: str | PurePath
+    ) -> str | PurePosixPath | None:
+        """Overrides :meth:`~.os_session.OSSession.get_tarball_top_dir`."""
+        members = self.send_command(f"tar tf {remote_tarball_path}").stdout.split()
+
+        top_dirs = []
+        for member in members:
+            parts_of_member = PurePosixPath(member).parts
+            if parts_of_member:
+                top_dirs.append(parts_of_member[0])
+
+        if len(set(top_dirs)) == 1:
+            return top_dirs[0]
+        return None
+
     def build_dpdk(
         self,
         env_vars: dict,
@@ -301,7 +332,7 @@ def _get_dpdk_pids(self, dpdk_runtime_dirs: Iterable[str | PurePath]) -> list[in
         pid_regex = r"p(\d+)"
         for dpdk_runtime_dir in dpdk_runtime_dirs:
             dpdk_config_file = PurePosixPath(dpdk_runtime_dir, "config")
-            if self._remote_files_exists(dpdk_config_file):
+            if self.remote_path_exists(dpdk_config_file):
                 out = self.send_command(f"lsof -Fp {dpdk_config_file}").stdout
                 if out and "No such file or directory" not in out:
                     for out_line in out.splitlines():
@@ -310,10 +341,6 @@ def _get_dpdk_pids(self, dpdk_runtime_dirs: Iterable[str | PurePath]) -> list[in
                             pids.append(int(match.group(1)))
         return pids
 
-    def _remote_files_exists(self, remote_path: PurePath) -> bool:
-        result = self.send_command(f"test -e {remote_path}")
-        return not result.return_code
-
     def _check_dpdk_hugepages(self, dpdk_runtime_dirs: Iterable[str | PurePath]) -> None:
         """Check there aren't any leftover hugepages.
 
@@ -325,7 +352,7 @@ def _check_dpdk_hugepages(self, dpdk_runtime_dirs: Iterable[str | PurePath]) ->
         """
         for dpdk_runtime_dir in dpdk_runtime_dirs:
             hugepage_info = PurePosixPath(dpdk_runtime_dir, "hugepage_info")
-            if self._remote_files_exists(hugepage_info):
+            if self.remote_path_exists(hugepage_info):
                 out = self.send_command(f"lsof -Fp {hugepage_info}").stdout
                 if out and "No such file or directory" not in out:
                     self._logger.warning("Some DPDK processes did not free hugepages.")
dts/framework/testbed_model/sut_node.py +243 -102

471 lines not on this page · raw message

Signature · 1 line
2.46.1
#6 lore raw

PATCH 6/7 doc: update argument options for external DPDK build

In reply to Tomáš Ďurovec

By adding support for external build, we extend the argument documentation for supported options.

---
 doc/guides/tools/dts.rst | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
doc/guides/tools/dts.rst +6 -3
index 65cce9e5ed..20d4d18b18 100644
@@ -236,12 +236,14 @@ DTS is run with ``main.py`` located in the ``dts`` directory after entering Poet
      -t SECONDS, --timeout SECONDS
                            [DTS_TIMEOUT] The default timeout for all DTS operations except for compiling DPDK. (default: 15)
      -v, --verbose         [DTS_VERBOSE] Specify to enable verbose output, logging all messages to the console. (default: False)
-     -s, --skip-setup      [DTS_SKIP_SETUP] Specify to skip all setup steps on SUT and TG nodes. (default: False)
+     --dpdk-tree DIR_PATH  [DTS_DPDK_TREE] Path to DPDK source code tree to test. (default: None)
      --tarball FILE_PATH, --snapshot FILE_PATH
                            [DTS_DPDK_TARBALL] Path to DPDK source code tarball to test. (default: None)
      --revision ID, --rev ID, --git-ref ID
                            [DTS_DPDK_REVISION_ID] Git revision ID to test. Could be commit, tag, tree ID etc. To test local changes, first
                            commit them, then use their commit ID. (default: None)
+     --remote-source       [DTS_REMOTE_SOURCE] Set when the DPDK source tree or tarball is located on the SUT node. (default: False)
+     --build-dir DIR_NAME  [DTS_BUILD_DIR] A directory name, which would be located in the `dpdk tree` or `tarball`. (default: None)
      --compile-timeout SECONDS
                            [DTS_COMPILE_TIMEOUT] The timeout for compiling DPDK. (default: 1200)
      --test-suite TEST_SUITE [TEST_CASES ...]
@@ -257,8 +259,9 @@ DTS is run with ``main.py`` located in the ``dts`` directory after entering Poet
 
 
 The brackets contain the names of environment variables that set the same thing.
-The minimum DTS needs is a config file and a DPDK tarball or git ref ID.
-You may pass those to DTS using the command line arguments or use the default paths.
+The minimum DTS needs is a config file and a pre-built DPDK or DPDK
+sources location which can be specified in said config file or on the
+command line or environment variables.
 
 Example command for running DTS with the template configuration and DPDK tag v23.11:
 
Signature · 1 line
2.46.1
#7 lore raw

PATCH 7/7 dts: remove git ref option

In reply to Tomáš Ďurovec

In the previous commits we're adding the support for copying the whole local DPDK tree directory and git-ref option was meant to do the same thing.

---
 doc/guides/tools/dts.rst  |   9 ---
 dts/framework/settings.py |  51 +++-------------
 dts/framework/utils.py    | 119 +-------------------------------------
 3 files changed, 8 insertions(+), 171 deletions(-)
doc/guides/tools/dts.rst +0 -9
index 20d4d18b18..d806dce2ae 100644
@@ -239,9 +239,6 @@ DTS is run with ``main.py`` located in the ``dts`` directory after entering Poet
      --dpdk-tree DIR_PATH  [DTS_DPDK_TREE] Path to DPDK source code tree to test. (default: None)
      --tarball FILE_PATH, --snapshot FILE_PATH
                            [DTS_DPDK_TARBALL] Path to DPDK source code tarball to test. (default: None)
-     --revision ID, --rev ID, --git-ref ID
-                           [DTS_DPDK_REVISION_ID] Git revision ID to test. Could be commit, tag, tree ID etc. To test local changes, first
-                           commit them, then use their commit ID. (default: None)
      --remote-source       [DTS_REMOTE_SOURCE] Set when the DPDK source tree or tarball is located on the SUT node. (default: False)
      --build-dir DIR_NAME  [DTS_BUILD_DIR] A directory name, which would be located in the `dpdk tree` or `tarball`. (default: None)
      --compile-timeout SECONDS
@@ -263,12 +260,6 @@ The minimum DTS needs is a config file and a pre-built DPDK or DPDK
 sources location which can be specified in said config file or on the
 command line or environment variables.
 
-Example command for running DTS with the template configuration and DPDK tag v23.11:
-
-.. code-block:: console
-
-   (dts-py3.10) $ ./main.py --git-ref v23.11
-
 
 DTS Results
 ~~~~~~~~~~~
dts/framework/settings.py +7 -44

108 lines not on this page · raw message

dts/framework/utils.py +1 -118

149 lines not on this page · raw message

Signature · 1 line
2.46.1
#8 lore raw

v2 cover DTS external DPDK build

In reply to Tomáš Ďurovec

Hello,

taking over this patchset from Tomáš, who no longer contributes to DTS. Please find in this cover letter the changes I've made.

v2:
- rebased on top of dts-next and resolved conflicts
- fixed bugs
- rephrased some docstrings
- improved settings naming for less ambiguity
- improved commit subjects and bodies

Kind regards,
Luca

Tomáš Ďurovec (7):
dts: rename build target to DPDK build
dts: enforce one dpdk build per test run
dts: fix remote session file transfer vars
dts: enable copying directories to and from nodes
dts: add support for externally compiled DPDK
doc: update argument options for external DPDK build
dts: remove git ref option

 doc/guides/tools/dts.rst                      |  82 ++--
 dts/conf.yaml                                 |  18 +-
 dts/framework/config/__init__.py              | 142 ++++++-
 dts/framework/config/conf_yaml_schema.json    |  72 +++-
 dts/framework/config/types.py                 |  19 +-
 dts/framework/exception.py                    |   4 +-
 dts/framework/logger.py                       |   4 -
 dts/framework/remote_session/dpdk_shell.py    |   2 +-
 .../remote_session/remote_session.py          |  24 +-
 dts/framework/remote_session/ssh_session.py   |  18 +-
 dts/framework/runner.py                       | 139 ++-----
 dts/framework/settings.py                     | 202 +++++++---
 dts/framework/test_result.py                  | 124 ++----
 dts/framework/test_suite.py                   |   2 +-
 dts/framework/testbed_model/node.py           |  22 +-
 dts/framework/testbed_model/os_session.py     | 209 ++++++++--
 dts/framework/testbed_model/posix_session.py  | 141 ++++++-
 dts/framework/testbed_model/sut_node.py       | 376 ++++++++++++------
 dts/framework/utils.py                        | 164 +++-----
 dts/tests/TestSuite_smoke_tests.py            |   2 +-
 20 files changed, 1130 insertions(+), 636 deletions(-)
Signature · 1 line
2.43.0
#9 lore raw

PATCH v2 1/7 dts: rename build target to DPDK build

From: Tomáš Ďurovec <[email protected]>

Since the DPDK may already be built, some more general name is needed that includes both the DPDK location and the build config (if we are going to build).

---
 dts/conf.yaml                              |   2 +-
 dts/framework/config/__init__.py           |  26 ++---
 dts/framework/config/conf_yaml_schema.json |  10 +-
 dts/framework/config/types.py              |   4 +-
 dts/framework/logger.py                    |   4 +-
 dts/framework/runner.py                    | 112 ++++++++++-----------
 dts/framework/settings.py                  |   2 +-
 dts/framework/test_result.py               |  72 +++++++------
 dts/framework/test_suite.py                |   2 +-
 dts/framework/testbed_model/sut_node.py    |  55 +++++-----
 dts/tests/TestSuite_smoke_tests.py         |   2 +-
 11 files changed, 142 insertions(+), 149 deletions(-)
dts/conf.yaml +1 -1
index ca5e87636e..1363e93580 100644
@@ -4,7 +4,7 @@
 
 test_runs:
   # define one test run environment
-  - build_targets:
+  - dpdk_builds:
       - arch: x86_64
         os: linux
         cpu: native
dts/framework/config/__init__.py +13 -13
index 269d9ec318..c243716010 100644
@@ -45,8 +45,8 @@
 from typing_extensions import Self
 
 from framework.config.types import (
-    BuildTargetConfigDict,
     ConfigurationDict,
+    DPDKBuildConfigDict,
     NodeConfigDict,
     PortConfigDict,
     TestRunConfigDict,
@@ -335,7 +335,7 @@ class NodeInfo:
 
 
 @dataclass(slots=True, frozen=True)
-class BuildTargetConfiguration:
+class DPDKBuildConfiguration:
     """DPDK build configuration.
 
     The configuration used for building DPDK.
@@ -358,7 +358,7 @@ class BuildTargetConfiguration:
     name: str
 
     @classmethod
-    def from_dict(cls, d: BuildTargetConfigDict) -> Self:
+    def from_dict(cls, d: DPDKBuildConfigDict) -> Self:
         r"""A convenience method that processes the inputs before creating an instance.
 
         `arch`, `os`, `cpu` and `compiler` are converted to :class:`Enum`\s and
@@ -368,7 +368,7 @@ def from_dict(cls, d: BuildTargetConfigDict) -> Self:
             d: The configuration dictionary.
 
         Returns:
-            The build target configuration instance.
+            The DPDK build configuration instance.
         """
         return cls(
             arch=Architecture(d["arch"]),
@@ -381,8 +381,8 @@ def from_dict(cls, d: BuildTargetConfigDict) -> Self:
 
 
 @dataclass(slots=True, frozen=True)
-class BuildTargetInfo:
-    """Various versions and other information about a build target.
+class DPDKBuildInfo:
+    """Various versions and other information about a DPDK build.
 
     Attributes:
         dpdk_version: The DPDK version that was built.
@@ -437,7 +437,7 @@ class TestRunConfiguration:
     and with what DPDK build.
 
     Attributes:
-        build_targets: A list of DPDK builds to test.
+        dpdk_builds: A list of DPDK builds to test.
         perf: Whether to run performance tests.
         func: Whether to run functional tests.
         skip_smoke_tests: Whether to skip smoke tests.
@@ -448,7 +448,7 @@ class TestRunConfiguration:
         random_seed: The seed to use for pseudo-random generation.
     """
 
-    build_targets: list[BuildTargetConfiguration]
+    dpdk_builds: list[DPDKBuildConfiguration]
     perf: bool
     func: bool
     skip_smoke_tests: bool
@@ -466,7 +466,7 @@ def from_dict(
     ) -> Self:
         """A convenience method that processes the inputs before creating an instance.
 
-        The build target and the test suite config are transformed into their respective objects.
+        The DPDK build and the test suite config are transformed into their respective objects.
         SUT and TG configurations are taken from `node_map`. The other (:class:`bool`) attributes
         are just stored.
 
@@ -477,8 +477,8 @@ def from_dict(
         Returns:
             The test run configuration instance.
         """
-        build_targets: list[BuildTargetConfiguration] = list(
-            map(BuildTargetConfiguration.from_dict, d["build_targets"])
+        dpdk_builds: list[DPDKBuildConfiguration] = list(
+            map(DPDKBuildConfiguration.from_dict, d["dpdk_builds"])
         )
         test_suites: list[TestSuiteConfig] = list(map(TestSuiteConfig.from_dict, d["test_suites"]))
         sut_name = d["system_under_test_node"]["node_name"]
@@ -501,7 +501,7 @@ def from_dict(
         )
         random_seed = d.get("random_seed", None)
         return cls(
-            build_targets=build_targets,
+            dpdk_builds=dpdk_builds,
             perf=d["perf"],
             func=d["func"],
             skip_smoke_tests=skip_smoke_tests,
@@ -552,7 +552,7 @@ class Configuration:
     def from_dict(cls, d: ConfigurationDict) -> Self:
         """A convenience method that processes the inputs before creating an instance.
 
-        Build target and test suite config are transformed into their respective objects.
+        DPDK build and test suite config are transformed into their respective objects.
         SUT and TG configurations are taken from `node_map`. The other (:class:`bool`) attributes
         are just stored.
 
dts/framework/config/conf_yaml_schema.json +5 -5
index df390e8ae2..927a73ac6c 100644
@@ -110,9 +110,9 @@
         "mscv"
       ]
     },
-    "build_target": {
+    "dpdk_build": {
       "type": "object",
-      "description": "Targets supported by DTS",
+      "description": "DPDK build configuration supported by DTS.",
       "properties": {
         "arch": {
           "type": "string",
@@ -327,10 +327,10 @@
       "items": {
         "type": "object",
         "properties": {
-          "build_targets": {
+          "dpdk_builds": {
             "type": "array",
             "items": {
-              "$ref": "#/definitions/build_target"
+              "$ref": "#/definitions/dpdk_build"
             },
             "minimum": 1
           },
@@ -387,7 +387,7 @@
         },
         "additionalProperties": false,
         "required": [
-          "build_targets",
+          "dpdk_builds",
           "perf",
           "func",
           "test_suites",
dts/framework/config/types.py +2 -2
index ce7b784ac8..4f450267d1 100644
@@ -71,7 +71,7 @@ class NodeConfigDict(TypedDict):
     traffic_generator: TrafficGeneratorConfigDict
 
 
-class BuildTargetConfigDict(TypedDict):
+class DPDKBuildConfigDict(TypedDict):
     """Allowed keys and values."""
 
     #:
@@ -108,7 +108,7 @@ class TestRunConfigDict(TypedDict):
     """Allowed keys and values."""
 
     #:
-    build_targets: list[BuildTargetConfigDict]
+    dpdk_builds: list[DPDKBuildConfigDict]
     #:
     perf: bool
     #:
dts/framework/logger.py +2 -2
index 9420323d38..3fbe618219 100644
@@ -33,7 +33,7 @@ class DtsStage(StrEnum):
     #:
     test_run_setup = auto()
     #:
-    build_target_setup = auto()
+    dpdk_build_setup = auto()
     #:
     test_suite_setup = auto()
     #:
@@ -41,7 +41,7 @@ class DtsStage(StrEnum):
     #:
     test_suite_teardown = auto()
     #:
-    build_target_teardown = auto()
+    dpdk_build_teardown = auto()
     #:
     test_run_teardown = auto()
     #:
dts/framework/runner.py +55 -57

247 lines not on this page · raw message

dts/framework/settings.py +1 -1
index 7744e37f54..52a1582d5c 100644
@@ -278,7 +278,7 @@ def _get_parser() -> _DTSArgumentParser:
         "--config-file",
         default=SETTINGS.config_file_path,
         type=Path,
-        help="The configuration file that describes the test cases, SUTs and targets.",
+        help="The configuration file that describes the test cases, SUTs and DPDK build configs.",
         metavar="FILE_PATH",
         dest="config_file_path",
     )
dts/framework/test_result.py +35 -37

158 lines not on this page · raw message

dts/framework/test_suite.py +1 -1
index 6a1d067215..9e08339ada 100644
@@ -71,7 +71,7 @@ class TestSuite(TestProtocol):
     sut_node: SutNode
     tg_node: TGNode
     #: Whether the test suite is blocking. A failure of a blocking test suite
-    #: will block the execution of all subsequent test suites in the current build target.
+    #: will block the execution of all subsequent test suites in the current DPDK build.
     is_blocking: ClassVar[bool] = False
     _logger: DTSLogger
     _sut_port_ingress: Port
dts/framework/testbed_model/sut_node.py +26 -29

125 lines not on this page · raw message

dts/tests/TestSuite_smoke_tests.py +1 -1
index 5f953a190f..9822240b5b 100644
@@ -31,7 +31,7 @@ class TestSmokeTests(TestSuite):
 
     Attributes:
         is_blocking: This test suite will block the execution of all other test suites
-            in the build target after it.
+            in the DPDK build after it.
         nics_in_node: The NICs present on the SUT node.
     """
 
Signature · 1 line
2.43.0
#12 lore raw

PATCH v2 2/7 dts: enforce one dpdk build per test run

In reply to Luca Vizzarro

From: Tomáš Ďurovec <[email protected]>

Given a pre-built DPDK repository can be supplied to DTS, there is no need to define multiple build targets. To simplify the process this change makes each test run use only one DPDK build whether it's pre-built or it needs to be built by DTS.

---
 dts/conf.yaml                              |  14 +--
 dts/framework/config/__init__.py           |   9 +-
 dts/framework/config/conf_yaml_schema.json |  10 +-
 dts/framework/config/types.py              |   2 +-
 dts/framework/logger.py                    |   4 -
 dts/framework/runner.py                    | 117 +++++---------------
 dts/framework/test_result.py               | 119 ++++++---------------
 dts/framework/test_suite.py                |   2 +-
 dts/framework/testbed_model/sut_node.py    |   6 +-
 dts/tests/TestSuite_smoke_tests.py         |   2 +-
 10 files changed, 80 insertions(+), 205 deletions(-)
dts/conf.yaml +7 -7
index 1363e93580..814744a1fc 100644
@@ -4,13 +4,13 @@
 
 test_runs:
   # define one test run environment
-  - dpdk_builds:
-      - arch: x86_64
-        os: linux
-        cpu: native
-        # the combination of the following two makes CC="ccache gcc"
-        compiler: gcc
-        compiler_wrapper: ccache
+  - dpdk_build:
+      arch: x86_64
+      os: linux
+      cpu: native
+      # the combination of the following two makes CC="ccache gcc"
+      compiler: gcc
+      compiler_wrapper: ccache
     perf: false # disable performance testing
     func: true # enable functional testing
     skip_smoke_tests: false # optional
dts/framework/config/__init__.py +3 -6
index c243716010..49b2e8d016 100644
@@ -437,7 +437,7 @@ class TestRunConfiguration:
     and with what DPDK build.
 
     Attributes:
-        dpdk_builds: A list of DPDK builds to test.
+        dpdk_build: A DPDK build to test.
         perf: Whether to run performance tests.
         func: Whether to run functional tests.
         skip_smoke_tests: Whether to skip smoke tests.
@@ -448,7 +448,7 @@ class TestRunConfiguration:
         random_seed: The seed to use for pseudo-random generation.
     """
 
-    dpdk_builds: list[DPDKBuildConfiguration]
+    dpdk_build: DPDKBuildConfiguration
     perf: bool
     func: bool
     skip_smoke_tests: bool
@@ -477,9 +477,6 @@ def from_dict(
         Returns:
             The test run configuration instance.
         """
-        dpdk_builds: list[DPDKBuildConfiguration] = list(
-            map(DPDKBuildConfiguration.from_dict, d["dpdk_builds"])
-        )
         test_suites: list[TestSuiteConfig] = list(map(TestSuiteConfig.from_dict, d["test_suites"]))
         sut_name = d["system_under_test_node"]["node_name"]
         skip_smoke_tests = d.get("skip_smoke_tests", False)
@@ -501,7 +498,7 @@ def from_dict(
         )
         random_seed = d.get("random_seed", None)
         return cls(
-            dpdk_builds=dpdk_builds,
+            dpdk_build=DPDKBuildConfiguration.from_dict(d["dpdk_build"]),
             perf=d["perf"],
             func=d["func"],
             skip_smoke_tests=skip_smoke_tests,
dts/framework/config/conf_yaml_schema.json +3 -7
index 927a73ac6c..94d7efa5f5 100644
@@ -327,12 +327,8 @@
       "items": {
         "type": "object",
         "properties": {
-          "dpdk_builds": {
-            "type": "array",
-            "items": {
-              "$ref": "#/definitions/dpdk_build"
-            },
-            "minimum": 1
+          "dpdk_build": {
+            "$ref": "#/definitions/dpdk_build"
           },
           "perf": {
             "type": "boolean",
@@ -387,7 +383,7 @@
         },
         "additionalProperties": false,
         "required": [
-          "dpdk_builds",
+          "dpdk_build",
           "perf",
           "func",
           "test_suites",
dts/framework/config/types.py +1 -1
index 4f450267d1..a710c20d6a 100644
@@ -108,7 +108,7 @@ class TestRunConfigDict(TypedDict):
     """Allowed keys and values."""
 
     #:
-    dpdk_builds: list[DPDKBuildConfigDict]
+    dpdk_build: DPDKBuildConfigDict
     #:
     perf: bool
     #:
dts/framework/logger.py +0 -4
index 3fbe618219..d2b8e37da4 100644
@@ -33,16 +33,12 @@ class DtsStage(StrEnum):
     #:
     test_run_setup = auto()
     #:
-    dpdk_build_setup = auto()
-    #:
     test_suite_setup = auto()
     #:
     test_suite = auto()
     #:
     test_suite_teardown = auto()
     #:
-    dpdk_build_teardown = auto()
-    #:
     test_run_teardown = auto()
     #:
     post_run = auto()
dts/framework/runner.py +26 -91

212 lines not on this page · raw message

dts/framework/test_result.py +34 -85

201 lines not on this page · raw message

dts/framework/test_suite.py +1 -1
index 9e08339ada..cbe3b30ffc 100644
@@ -71,7 +71,7 @@ class TestSuite(TestProtocol):
     sut_node: SutNode
     tg_node: TGNode
     #: Whether the test suite is blocking. A failure of a blocking test suite
-    #: will block the execution of all subsequent test suites in the current DPDK build.
+    #: will block the execution of all subsequent test suites in the current test run.
     is_blocking: ClassVar[bool] = False
     _logger: DTSLogger
     _sut_port_ingress: Port
dts/framework/testbed_model/sut_node.py +4 -2
index 616da1663d..0eac12098f 100644
@@ -181,13 +181,15 @@ def set_up_test_run(self, test_run_config: TestRunConfiguration) -> None:
         super().set_up_test_run(test_run_config)
         for vdev in test_run_config.vdevs:
             self.virtual_devices.append(VirtualDevice(vdev))
+        self._set_up_dpdk(test_run_config.dpdk_build)
 
     def tear_down_test_run(self) -> None:
         """Extend the test run teardown with virtual device teardown."""
         super().tear_down_test_run()
         self.virtual_devices = []
+        self._tear_down_dpdk()
 
-    def set_up_dpdk(self, dpdk_build_config: DPDKBuildConfiguration) -> None:
+    def _set_up_dpdk(self, dpdk_build_config: DPDKBuildConfiguration) -> None:
         """Set up DPDK the SUT node and bind ports.
 
         DPDK setup includes setting all internals needed for the build, the copying of DPDK tarball
@@ -202,7 +204,7 @@ def set_up_dpdk(self, dpdk_build_config: DPDKBuildConfiguration) -> None:
         self._build_dpdk()
         self.bind_ports_to_driver()
 
-    def tear_down_dpdk(self) -> None:
+    def _tear_down_dpdk(self) -> None:
         """Reset DPDK variables and bind port driver to the OS driver."""
         self._env_vars = {}
         self._dpdk_build_config = None
dts/tests/TestSuite_smoke_tests.py +1 -1
index 9822240b5b..d7870bd40f 100644
@@ -31,7 +31,7 @@ class TestSmokeTests(TestSuite):
 
     Attributes:
         is_blocking: This test suite will block the execution of all other test suites
-            in the DPDK build after it.
+            in the test run after it.
         nics_in_node: The NICs present on the SUT node.
     """
 
Signature · 1 line
2.43.0
Reviewed-by on v2 2/7
#13 lore raw

Re: [PATCH v2 2/7] dts: enforce one dpdk build per test run

Quoted 10 lines · Luca Vizzarro

From: Tomáš Ďurovec <[email protected]>

Given a pre-built DPDK repository can be supplied to DTS, there is no need to define multiple build targets. To simplify the process this change makes each test run use only one DPDK build whether it's pre-built or it needs to be built by DTS.

#15 lore raw

PATCH v2 3/7 dts: fix remote session file transfer vars

In reply to Luca Vizzarro

From: Tomáš Ďurovec <[email protected]>

The OSSession (and its subclasses) should accept PurePaths for remote paths to translate from OS-unaware (PurePath) to OS-aware (Path) only on the remote side. For local paths, they should accept Paths, as Python is OS-aware locally.

---
 .../remote_session/remote_session.py          | 24 ++++++----------
 dts/framework/remote_session/ssh_session.py   | 18 ++++--------
 dts/framework/testbed_model/os_session.py     | 28 ++++++++-----------
 dts/framework/testbed_model/posix_session.py  | 18 ++++--------
 4 files changed, 30 insertions(+), 58 deletions(-)
dts/framework/remote_session/remote_session.py +9 -15
index 8c580b070f..ab83f5b266 100644
@@ -12,7 +12,7 @@
 
 from abc import ABC, abstractmethod
 from dataclasses import InitVar, dataclass, field
-from pathlib import PurePath
+from pathlib import Path, PurePath
 
 from framework.config import NodeConfiguration
 from framework.exception import RemoteCommandExecutionError
@@ -196,35 +196,29 @@ def is_alive(self) -> bool:
         """Check whether the remote session is still responding."""
 
     @abstractmethod
-    def copy_from(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_from(self, source_file: str | PurePath, destination_dir: str | Path) -> None:
         """Copy a file from the remote Node to the local filesystem.
 
         Copy `source_file` from the remote Node associated with this remote session
-        to `destination_file` on the local filesystem.
+        to `destination_dir` on the local filesystem.
 
         Args:
             source_file: The file on the remote Node.
-            destination_file: A file or directory path on the local filesystem.
+            destination_dir: The directory path on the local filesystem where the `source_file`
+                will be saved.
         """
 
     @abstractmethod
-    def copy_to(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_to(self, source_file: str | Path, destination_dir: str | PurePath) -> None:
         """Copy a file from local filesystem to the remote Node.
 
-        Copy `source_file` from local filesystem to `destination_file` on the remote Node
+        Copy `source_file` from local filesystem to `destination_dir` on the remote Node
         associated with this remote session.
 
         Args:
             source_file: The file on the local filesystem.
-            destination_file: A file or directory path on the remote Node.
+            destination_dir: The directory path on the remote Node where the `source_file`
+                will be saved.
         """
 
     @abstractmethod
dts/framework/remote_session/ssh_session.py +5 -13
index 66f8176833..329121913f 100644
@@ -5,7 +5,7 @@
 
 import socket
 import traceback
-from pathlib import PurePath
+from pathlib import Path, PurePath
 
 from fabric import Connection  # type: ignore[import-untyped]
 from invoke.exceptions import (  # type: ignore[import-untyped]
@@ -103,21 +103,13 @@ def is_alive(self) -> bool:
         """Overrides :meth:`~.remote_session.RemoteSession.is_alive`."""
         return self.session.is_connected
 
-    def copy_from(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_from(self, source_file: str | PurePath, destination_dir: str | Path) -> None:
         """Overrides :meth:`~.remote_session.RemoteSession.copy_from`."""
-        self.session.get(str(destination_file), str(source_file))
+        self.session.get(str(source_file), str(destination_dir))
 
-    def copy_to(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_to(self, source_file: str | Path, destination_dir: str | PurePath) -> None:
         """Overrides :meth:`~.remote_session.RemoteSession.copy_to`."""
-        self.session.put(str(source_file), str(destination_file))
+        self.session.put(str(source_file), str(destination_dir))
 
     def close(self) -> None:
         """Overrides :meth:`~.remote_session.RemoteSession.close`."""
dts/framework/testbed_model/os_session.py +11 -17
index 79f56b289b..1aac3659bf 100644
@@ -25,7 +25,7 @@
 from abc import ABC, abstractmethod
 from collections.abc import Iterable
 from ipaddress import IPv4Interface, IPv6Interface
-from pathlib import PurePath
+from pathlib import Path, PurePath
 from typing import Union
 
 from framework.config import Architecture, NodeConfiguration, NodeInfo
@@ -178,35 +178,29 @@ def join_remote_path(self, *args: str | PurePath) -> PurePath:
         """
 
     @abstractmethod
-    def copy_from(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_from(self, source_file: str | PurePath, destination_dir: str | Path) -> None:
         """Copy a file from the remote node to the local filesystem.
 
         Copy `source_file` from the remote node associated with this remote
-        session to `destination_file` on the local filesystem.
+        session to `destination_dir` on the local filesystem.
 
         Args:
-            source_file: the file on the remote node.
-            destination_file: a file or directory path on the local filesystem.
+            source_file: The file on the remote node.
+            destination_dir: The directory path on the local filesystem where the `source_file`
+                will be saved.
         """
 
     @abstractmethod
-    def copy_to(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_to(self, source_file: str | Path, destination_dir: str | PurePath) -> None:
         """Copy a file from local filesystem to the remote node.
 
-        Copy `source_file` from local filesystem to `destination_file`
+        Copy `source_file` from local filesystem to `destination_dir`
         on the remote node associated with this remote session.
 
         Args:
-            source_file: the file on the local filesystem.
-            destination_file: a file or directory path on the remote node.
+            source_file: The file on the local filesystem.
+            destination_dir: The directory path on the remote Node where the `source_file`
+                will be saved.
         """
 
     @abstractmethod
dts/framework/testbed_model/posix_session.py +5 -13
index d279bb8b53..2449c0ab35 100644
@@ -13,7 +13,7 @@
 
 import re
 from collections.abc import Iterable
-from pathlib import PurePath, PurePosixPath
+from pathlib import Path, PurePath, PurePosixPath
 
 from framework.config import Architecture, NodeInfo
 from framework.exception import DPDKBuildError, RemoteCommandExecutionError
@@ -85,21 +85,13 @@ def join_remote_path(self, *args: str | PurePath) -> PurePosixPath:
         """Overrides :meth:`~.os_session.OSSession.join_remote_path`."""
         return PurePosixPath(*args)
 
-    def copy_from(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    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_file)
+        self.remote_session.copy_from(source_file, destination_dir)
 
-    def copy_to(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_to(self, source_file: str | Path, destination_dir: str | PurePath) -> None:
         """Overrides :meth:`~.os_session.OSSession.copy_to`."""
-        self.remote_session.copy_to(source_file, destination_file)
+        self.remote_session.copy_to(source_file, destination_dir)
 
     def remove_remote_dir(
         self,
Signature · 1 line
2.43.0
#16 lore raw

PATCH v2 4/7 dts: enable copying directories to and from nodes

In reply to Luca Vizzarro

From: Tomáš Ďurovec <[email protected]>

Currently there is no support to transfer whole directories between the DTS host and the nodes. This change adds this new feature.

---
 dts/framework/testbed_model/os_session.py    | 120 ++++++++++++++++++-
 dts/framework/testbed_model/posix_session.py |  88 +++++++++++++-
 dts/framework/utils.py                       |  91 +++++++++++++-
 3 files changed, 287 insertions(+), 12 deletions(-)
dts/framework/testbed_model/os_session.py +116 -4
index 1aac3659bf..6c3f84dec1 100644
@@ -25,7 +25,7 @@
 from abc import ABC, abstractmethod
 from collections.abc import Iterable
 from ipaddress import IPv4Interface, IPv6Interface
-from pathlib import Path, PurePath
+from pathlib import Path, PurePath, PurePosixPath
 from typing import Union
 
 from framework.config import Architecture, NodeConfiguration, NodeInfo
@@ -38,7 +38,7 @@
 )
 from framework.remote_session.remote_session import CommandResult
 from framework.settings import SETTINGS
-from framework.utils import MesonArgs
+from framework.utils import MesonArgs, TarCompressionFormat
 
 from .cpu import LogicalCore
 from .port import Port
@@ -203,6 +203,95 @@ def copy_to(self, source_file: str | Path, destination_dir: str | PurePath) -> N
                 will be saved.
         """
 
+    @abstractmethod
+    def copy_dir_from(
+        self,
+        source_dir: str | PurePath,
+        destination_dir: str | Path,
+        compress_format: TarCompressionFormat = TarCompressionFormat.none,
+        exclude: str | list[str] | None = None,
+    ) -> None:
+        """Copy a directory from the remote node to the local filesystem.
+
+        Copy `source_dir` from the remote node associated with this remote session to
+        `destination_dir` on the local filesystem. The new local directory will be created
+        at `destination_dir` path.
+
+        Example:
+            source_dir = '/remote/path/to/source'
+            destination_dir = '/local/path/to/destination'
+            compress_format = TarCompressionFormat.xz
+
+            The method will:
+                1. Create a tarball from `source_dir`, resulting in:
+                    '/remote/path/to/source.tar.xz',
+                2. Copy '/remote/path/to/source.tar.xz' to
+                    '/local/path/to/destination/source.tar.xz',
+                3. Extract the contents of the tarball, resulting in:
+                    '/local/path/to/destination/source/',
+                4. Remove the tarball after extraction
+                    ('/local/path/to/destination/source.tar.xz').
+
+            Final Path Structure:
+                '/local/path/to/destination/source/'
+
+        Args:
+            source_dir: The directory on the remote node.
+            destination_dir: The directory path on the local filesystem.
+            compress_format: The compression format to use. Defaults to no compression.
+            exclude: Patterns for files or directories to exclude from the tarball.
+                These patterns are used with `tar`'s `--exclude` option.
+        """
+
+    @abstractmethod
+    def copy_dir_to(
+        self,
+        source_dir: str | Path,
+        destination_dir: str | PurePath,
+        compress_format: TarCompressionFormat = TarCompressionFormat.none,
+        exclude: str | list[str] | None = None,
+    ) -> None:
+        """Copy a directory from the local filesystem to the remote node.
+
+        Copy `source_dir` from the local filesystem to `destination_dir` on the remote node
+        associated with this remote session. The new remote directory will be created at
+        `destination_dir` path.
+
+        Example:
+            source_dir = '/local/path/to/source'
+            destination_dir = '/remote/path/to/destination'
+            compress_format = TarCompressionFormat.xz
+
+            The method will:
+                1. Create a tarball from `source_dir`, resulting in:
+                    '/local/path/to/source.tar.xz',
+                2. Copy '/local/path/to/source.tar.xz' to
+                    '/remote/path/to/destination/source.tar.xz',
+                3. Extract the contents of the tarball, resulting in:
+                    '/remote/path/to/destination/source/',
+                4. Remove the tarball after extraction
+                    ('/remote/path/to/destination/source.tar.xz').
+
+            Final Path Structure:
+                '/remote/path/to/destination/source/'
+
+        Args:
+            source_dir: The directory on the local filesystem.
+            destination_dir: The directory path on the remote node.
+            compress_format: The compression format to use. Defaults to no compression.
+            exclude: Patterns for files or directories to exclude from the tarball.
+                These patterns are used with `fnmatch.fnmatch` to filter out files.
+        """
+
+    @abstractmethod
+    def remove_remote_file(self, remote_file_path: str | PurePath, force: bool = True) -> None:
+        """Remove remote file, by default remove forcefully.
+
+        Args:
+            remote_file_path: The file path to remove.
+            force: If :data:`True`, ignore all warnings and try to remove at all costs.
+        """
+
     @abstractmethod
     def remove_remote_dir(
         self,
@@ -213,11 +302,34 @@ def remove_remote_dir(
         """Remove remote directory, by default remove recursively and forcefully.
 
         Args:
-            remote_dir_path: The path of the directory to remove.
+            remote_dir_path: The directory path to remove.
             recursive: If :data:`True`, also remove all contents inside the directory.
             force: If :data:`True`, ignore all warnings and try to remove at all costs.
         """
 
+    @abstractmethod
+    def create_remote_tarball(
+        self,
+        remote_dir_path: str | PurePath,
+        compress_format: TarCompressionFormat = TarCompressionFormat.none,
+        exclude: str | list[str] | None = None,
+    ) -> PurePosixPath:
+        """Create a tarball from the contents of the specified remote directory.
+
+        This method creates a tarball containing all files and directories
+        within `remote_dir_path`. The tarball will be saved in the directory of
+        `remote_dir_path` and will be named based on `remote_dir_path`.
+
+        Args:
+            remote_dir_path: The directory path on the remote node.
+            compress_format: The compression format to use. Defaults to no compression.
+            exclude: Patterns for files or directories to exclude from the tarball.
+                These patterns are used with `tar`'s `--exclude` option.
+
+        Returns:
+            The path to the created tarball on the remote node.
+        """
+
     @abstractmethod
     def extract_remote_tarball(
         self,
@@ -227,7 +339,7 @@ def extract_remote_tarball(
         """Extract remote tarball in its remote directory.
 
         Args:
-            remote_tarball_path: The path of the tarball on the remote node.
+            remote_tarball_path: The tarball path on the remote node.
             expected_dir: If non-empty, check whether `expected_dir` exists after extracting
                 the archive.
         """
dts/framework/testbed_model/posix_session.py +84 -4

107 lines not on this page · raw message

dts/framework/utils.py +87 -4

146 lines not on this page · raw message

Signature · 1 line
2.43.0
Reviewed-by on v2 4/7
#18 lore raw

Re: [PATCH v2 4/7] dts: enable copying directories to and from nodes

In reply to Luca Vizzarro
Quoted 10 lines · Luca Vizzarro
dts/framework/testbed_model/os_session.py +3 -0
+
+    @abstractmethod
+    def remove_remote_file(self, remote_file_path: str | PurePath, force:

bool = True) -> None:

dts/framework/testbed_model/os_session.py +5 -0
+        """Remove remote file, by default remove forcefully.
+
+        Args:
+            remote_file_path: The file path to remove.
+            force: If :data:`True`, ignore all warnings and try to remove
Quoted 3 lines

at all costs.
+ """

This is outside of the scope of this patch, but I figured I would comment that we should use this to clean the dpdk-devbind.py file when we re-add that functionality. I'm glad this method is added. :)

Quoted 18 lines
dts/framework/testbed_model/os_session.py +1 -0
+
     @abstractmethod
     def remove_remote_dir(
         self,
@@ -213,11 +302,34 @@ def remove_remote_dir(
         """Remove remote directory, by default remove recursively and

forcefully.

Args:

dts/framework/testbed_model/os_session.py +1 -1
-            remote_dir_path: The path of the directory to remove.
+            remote_dir_path: The directory path to remove.
             recursive: If :data:`True`, also remove all contents inside

the directory.
force: If :data:True, ignore all warnings and try to remove
at all costs.

         """

dts/framework/testbed_model/os_session.py def remove_remote_dir( · line 316

Quoted 7 lines
dts/framework/testbed_model/os_session.py +7 -0
+    @abstractmethod
+    def create_remote_tarball(
+        self,
+        remote_dir_path: str | PurePath,
+        compress_format: TarCompressionFormat = TarCompressionFormat.none,
+        exclude: str | list[str] | None = None,
+    ) -> PurePosixPath:

Does this have to be a PurePosixPath instead of a PurePath? I know adding Windows support for DTS seems far out, but we should not add in barriers to that now without good reason (though if there is a strong practical reason why we want to do this now, then okay). I believe we will have a PurePosixPath return in testbed_model/posix_session.py and a PureWindowsPath return in testbed_model/windows_session.py (when it exists).

Otherwise, I know we discussed this at the DTS call on Thurs, but thanks for remaining .gz .xz agnostic.

#19 lore raw

Re: [PATCH v2 4/7] dts: enable copying directories to and from nodes

Quoted 14 lines · Patrick Robb

On Mon, Oct 21, 2024 at 9:49 AM Luca Vizzarro wrote:
+
+    @abstractmethod
+    def remove_remote_file(self, remote_file_path: str | PurePath,
force: bool = True) -> None:
+        """Remove remote file, by default remove forcefully. +
+        Args:
+            remote_file_path: The file path to remove. +            force: If :data:True, ignore all warnings and try to remove at all costs.
+        """

Quoted 1 line

This is outside of the scope of this patch, but I figured I would comment that we should use this to clean the dpdk-devbind.py file when we re-add that functionality. I'm glad this method is added. :)

Sounds good to me!

Quoted 11 lines

+    @abstractmethod
+    def create_remote_tarball(
+        self,
+        remote_dir_path: str | PurePath, +        compress_format: TarCompressionFormat = TarCompressionFormat.none,
+        exclude: str | list[str] | None = None, +    ) -> PurePosixPath:

Does this have to be a PurePosixPath instead of a PurePath? I know adding Windows support for DTS seems far out, but we should not add in barriers to that now without good reason (though if there is a strong practical reason why we want to do this now, then okay). I believe we will have a PurePosixPath return in testbed_model/posix_session.py and a PureWindowsPath return in testbed_model/windows_session.py (when it exists).

Excellent catch! Quite missed this, we should be able to amend this to PurePath under os_session.py and keep PurePosixPath under posix_session.py

Quoted 2 lines

Otherwise, I know we discussed this at the DTS call on Thurs, but thanks for remaining .gz .xz agnostic.

The choice to zip the tarball is taken under framework.testbed_model.sut_node:_copy_dpdk_tree

#20 lore raw

PATCH v2 5/7 dts: add support for externally compiled DPDK

In reply to Luca Vizzarro

From: Tomáš Ďurovec <[email protected]>

Enable the user to use either a DPDK source tree directory or a tarball, with and without a pre-built build directory. These can be stored on either SUT node or the DTS host. The DPDK build setup or the pre-built binaries can be specified through the configuration file, the command line arguments or environment variables.

---
 dts/conf.yaml                                |  24 +-
 dts/framework/config/__init__.py             | 123 ++++++-
 dts/framework/config/conf_yaml_schema.json   |  62 +++-
 dts/framework/config/types.py                |  17 +-
 dts/framework/exception.py                   |   4 +-
 dts/framework/remote_session/dpdk_shell.py   |   2 +-
 dts/framework/runner.py                      |   8 +-
 dts/framework/settings.py                    | 200 +++++++++--
 dts/framework/test_result.py                 |  23 +-
 dts/framework/testbed_model/node.py          |  22 +-
 dts/framework/testbed_model/os_session.py    |  63 +++-
 dts/framework/testbed_model/posix_session.py |  39 ++-
 dts/framework/testbed_model/sut_node.py      | 351 +++++++++++++------
 13 files changed, 732 insertions(+), 206 deletions(-)
dts/conf.yaml +18 -6
index 814744a1fc..8a65a481d6 100644
@@ -5,12 +5,24 @@
 test_runs:
   # define one test run environment
   - dpdk_build:
-      arch: x86_64
-      os: linux
-      cpu: native
-      # the combination of the following two makes CC="ccache gcc"
-      compiler: gcc
-      compiler_wrapper: ccache
+      # dpdk_tree: Commented out because `tarball` is defined.
+      tarball: dpdk-tarball.tar.xz
+      # Either `dpdk_tree` or `tarball` can be defined, but not both.
+      remote: false # Optional, defaults to false. If it's true, the `dpdk_tree` or `tarball`
+                    # is located on the SUT node, instead of the execution host.
+
+      # precompiled_build_dir: Commented out because `build_options` is defined.
+      build_options:
+        arch: x86_64
+        os: linux
+        cpu: native
+        # the combination of the following two makes CC="ccache gcc"
+        compiler: gcc
+        compiler_wrapper: ccache # Optional.
+      # If `precompiled_build_dir` is defined, DPDK has been pre-built and the build directory is
+      # in a subdirectory of DPDK tree root directory. Otherwise, will be using the `build_options`
+      # to build the DPDK from source. Either `precompiled_build_dir` or `build_options` can be
+      # defined, but not both.
     perf: false # disable performance testing
     func: true # enable functional testing
     skip_smoke_tests: false # optional
dts/framework/config/__init__.py +118 -5

165 lines not on this page · raw message

dts/framework/config/conf_yaml_schema.json +59 -3

81 lines not on this page · raw message

dts/framework/config/types.py +16 -1
index a710c20d6a..02e738a61e 100644
@@ -86,6 +86,21 @@ class DPDKBuildConfigDict(TypedDict):
     compiler_wrapper: str
 
 
+class DPDKConfigurationDict(TypedDict):
+    """Allowed keys and values."""
+
+    #:
+    dpdk_tree: str | None
+    #:
+    tarball: str | None
+    #:
+    remote: bool
+    #:
+    precompiled_build_dir: str | None
+    #:
+    build_options: DPDKBuildConfigDict
+
+
 class TestSuiteConfigDict(TypedDict):
     """Allowed keys and values."""
 
@@ -108,7 +123,7 @@ class TestRunConfigDict(TypedDict):
     """Allowed keys and values."""
 
     #:
-    dpdk_build: DPDKBuildConfigDict
+    dpdk_build: DPDKConfigurationDict
     #:
     perf: bool
     #:
dts/framework/exception.py +2 -2
index f45f789825..d967ede09b 100644
@@ -184,8 +184,8 @@ class InteractiveCommandExecutionError(DTSError):
     severity: ClassVar[ErrorSeverity] = ErrorSeverity.REMOTE_CMD_EXEC_ERR
 
 
-class RemoteDirectoryExistsError(DTSError):
-    """A directory that exists on a remote node."""
+class RemoteFileNotFoundError(DTSError):
+    """A remote file or directory is requested but doesn’t exist."""
 
     #:
     severity: ClassVar[ErrorSeverity] = ErrorSeverity.REMOTE_CMD_EXEC_ERR
dts/framework/remote_session/dpdk_shell.py +1 -1
index c5f5c2d116..b39132cc42 100644
@@ -104,4 +104,4 @@ def _update_real_path(self, path: PurePath) -> None:
 
         Adds the remote DPDK build directory to the path.
         """
-        super()._update_real_path(self._node.remote_dpdk_build_dir.joinpath(path))
+        super()._update_real_path(PurePath(self._node.remote_dpdk_build_dir).joinpath(path))
dts/framework/runner.py +6 -2
index 55cb16df73..8bbe698eaf 100644
@@ -364,15 +364,19 @@ def _run_test_run(
             test_run_config: A test run configuration.
             test_run_result: The test run's result.
             test_suites_with_cases: The test suites with test cases to run.
+
+        Raises:
+            ConfigurationError: If the DPDK sources or build is not set up from config or settings.
         """
         self._logger.info(
             f"Running test run with SUT '{test_run_config.system_under_test_node.name}'."
         )
         test_run_result.add_sut_info(sut_node.node_info)
         try:
-            sut_node.set_up_test_run(test_run_config)
+            dpdk_location = SETTINGS.dpdk_location or test_run_config.dpdk_config.dpdk_location
+            sut_node.set_up_test_run(test_run_config, dpdk_location)
             test_run_result.add_dpdk_build_info(sut_node.get_dpdk_build_info())
-            tg_node.set_up_test_run(test_run_config)
+            tg_node.set_up_test_run(test_run_config, dpdk_location)
             test_run_result.update_setup(Result.PASS)
         except Exception as e:
             self._logger.exception("Test run setup failed.")
dts/framework/settings.py +170 -30

279 lines not on this page · raw message

dts/framework/test_result.py +1 -22
index 7fe6136574..0cd27c1e4f 100644
@@ -30,16 +30,7 @@
 
 from framework.testbed_model.capability import Capability
 
-from .config import (
-    OS,
-    Architecture,
-    Compiler,
-    CPUType,
-    DPDKBuildInfo,
-    NodeInfo,
-    TestRunConfiguration,
-    TestSuiteConfig,
-)
+from .config import DPDKBuildInfo, NodeInfo, TestRunConfiguration, TestSuiteConfig
 from .exception import DTSError, ErrorSeverity
 from .logger import DTSLogger
 from .settings import SETTINGS
@@ -365,10 +356,6 @@ class TestRunResult(BaseResult):
     The internal list stores the results of all test suites in a given test run.
 
     Attributes:
-        arch: The DPDK build architecture.
-        os: The DPDK build operating system.
-        cpu: The DPDK build CPU.
-        compiler: The DPDK build compiler.
         compiler_version: The DPDK build compiler version.
         dpdk_version: The built DPDK version.
         sut_os_name: The operating system of the SUT node.
@@ -376,10 +363,6 @@ class TestRunResult(BaseResult):
         sut_kernel_version: The operating system kernel version of the SUT node.
     """
 
-    arch: Architecture
-    os: OS
-    cpu: CPUType
-    compiler: Compiler
     compiler_version: str | None
     dpdk_version: str | None
     sut_os_name: str
@@ -395,10 +378,6 @@ def __init__(self, test_run_config: TestRunConfiguration):
             test_run_config: A test run configuration.
         """
         super().__init__()
-        self.arch = test_run_config.dpdk_build.arch
-        self.os = test_run_config.dpdk_build.os
-        self.cpu = test_run_config.dpdk_build.cpu
-        self.compiler = test_run_config.dpdk_build.compiler
         self.compiler_version = None
         self.dpdk_version = None
         self._config = test_run_config
dts/framework/testbed_model/node.py +6 -16
index 51443cd71f..62867fd80c 100644
@@ -15,12 +15,11 @@
 
 from abc import ABC
 from ipaddress import IPv4Interface, IPv6Interface
-from typing import Any, Callable, Union
+from typing import Union
 
-from framework.config import OS, NodeConfiguration, TestRunConfiguration
+from framework.config import OS, DPDKLocation, NodeConfiguration, TestRunConfiguration
 from framework.exception import ConfigurationError
 from framework.logger import DTSLogger, get_dts_logger
-from framework.settings import SETTINGS
 
 from .cpu import (
     LogicalCore,
@@ -95,7 +94,9 @@ def _init_ports(self) -> None:
         for port in self.ports:
             self.configure_port_state(port)
 
-    def set_up_test_run(self, test_run_config: TestRunConfiguration) -> None:
+    def set_up_test_run(
+        self, test_run_config: TestRunConfiguration, dpdk_location: DPDKLocation
+    ) -> None:
         """Test run setup steps.
 
         Configure hugepages on all DTS node types. Additional steps can be added by
@@ -104,6 +105,7 @@ def set_up_test_run(self, test_run_config: TestRunConfiguration) -> None:
         Args:
             test_run_config: A test run configuration according to which
                 the setup steps will be taken.
+            dpdk_location: The target source of the DPDK tree.
         """
         self._setup_hugepages()
 
@@ -216,18 +218,6 @@ def close(self) -> None:
         for session in self._other_sessions:
             session.close()
 
-    @staticmethod
-    def skip_setup(func: Callable[..., Any]) -> Callable[..., Any]:
-        """Skip the decorated function.
-
-        The :option:`--skip-setup` command line argument and the :envvar:`DTS_SKIP_SETUP`
-        environment variable enable the decorator.
-        """
-        if SETTINGS.skip_setup:
-            return lambda *args: None
-        else:
-            return func
-
 
 def create_session(node_config: NodeConfiguration, name: str, logger: DTSLogger) -> OSSession:
     """Factory for OS-aware sessions.
dts/framework/testbed_model/os_session.py +52 -11

81 lines not on this page · raw message

dts/framework/testbed_model/posix_session.py +33 -6
index 94e721da61..5ab7c18fb7 100644
@@ -91,6 +91,11 @@ def join_remote_path(self, *args: str | PurePath) -> PurePosixPath:
         """Overrides :meth:`~.os_session.OSSession.join_remote_path`."""
         return PurePosixPath(*args)
 
+    def remote_path_exists(self, remote_path: str | PurePath) -> bool:
+        """Overrides :meth:`~.os_session.OSSession.remote_path_exists`."""
+        result = self.send_command(f"test -e {remote_path}")
+        return not result.return_code
+
     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)
@@ -196,6 +201,32 @@ def extract_remote_tarball(
         if expected_dir:
             self.send_command(f"ls {expected_dir}", verify=True)
 
+    def is_remote_dir(self, remote_path: str) -> bool:
+        """Overrides :meth:`~.os_session.OSSession.is_remote_dir`."""
+        result = self.send_command(f"test -d {remote_path}")
+        return not result.return_code
+
+    def is_remote_tarfile(self, remote_tarball_path: str) -> bool:
+        """Overrides :meth:`~.os_session.OSSession.is_remote_tarfile`."""
+        result = self.send_command(f"tar -tvf {remote_tarball_path}")
+        return not result.return_code
+
+    def get_tarball_top_dir(
+        self, remote_tarball_path: str | PurePath
+    ) -> str | PurePosixPath | None:
+        """Overrides :meth:`~.os_session.OSSession.get_tarball_top_dir`."""
+        members = self.send_command(f"tar tf {remote_tarball_path}").stdout.split()
+
+        top_dirs = []
+        for member in members:
+            parts_of_member = PurePosixPath(member).parts
+            if parts_of_member:
+                top_dirs.append(parts_of_member[0])
+
+        if len(set(top_dirs)) == 1:
+            return top_dirs[0]
+        return None
+
     def build_dpdk(
         self,
         env_vars: dict,
@@ -301,7 +332,7 @@ def _get_dpdk_pids(self, dpdk_runtime_dirs: Iterable[str | PurePath]) -> list[in
         pid_regex = r"p(\d+)"
         for dpdk_runtime_dir in dpdk_runtime_dirs:
             dpdk_config_file = PurePosixPath(dpdk_runtime_dir, "config")
-            if self._remote_files_exists(dpdk_config_file):
+            if self.remote_path_exists(dpdk_config_file):
                 out = self.send_command(f"lsof -Fp {dpdk_config_file}").stdout
                 if out and "No such file or directory" not in out:
                     for out_line in out.splitlines():
@@ -310,10 +341,6 @@ def _get_dpdk_pids(self, dpdk_runtime_dirs: Iterable[str | PurePath]) -> list[in
                             pids.append(int(match.group(1)))
         return pids
 
-    def _remote_files_exists(self, remote_path: PurePath) -> bool:
-        result = self.send_command(f"test -e {remote_path}")
-        return not result.return_code
-
     def _check_dpdk_hugepages(self, dpdk_runtime_dirs: Iterable[str | PurePath]) -> None:
         """Check there aren't any leftover hugepages.
 
@@ -325,7 +352,7 @@ def _check_dpdk_hugepages(self, dpdk_runtime_dirs: Iterable[str | PurePath]) ->
         """
         for dpdk_runtime_dir in dpdk_runtime_dirs:
             hugepage_info = PurePosixPath(dpdk_runtime_dir, "hugepage_info")
-            if self._remote_files_exists(hugepage_info):
+            if self.remote_path_exists(hugepage_info):
                 out = self.send_command(f"lsof -Fp {hugepage_info}").stdout
                 if out and "No such file or directory" not in out:
                     self._logger.warning("Some DPDK processes did not free hugepages.")
dts/framework/testbed_model/sut_node.py +250 -101

497 lines not on this page · raw message

Signature · 1 line
2.43.0
#21 lore raw

Re: [PATCH v2 5/7] dts: add support for externally compiled DPDK

Just wondering, if the user wants to run DTS using the configuration yaml file or the environment variables instead of the command line args, are they supposed to run main.py by itself after setup? Because right now, it won't run without the --tarball or --dpdk-tree args, even if it's specified in the config file. It seems like it just ignores whatever was specified in the command line if it's specified in the yaml file, but won't execute without the command line args either.

#22 lore raw

Re: [PATCH v2 5/7] dts: add support for externally compiled DPDK

Quoted 1 line · Dean Marx

Just wondering, if the user wants to run DTS using the configuration yaml file or the environment variables instead of the command line args, are they supposed to run main.py by itself after setup? Because right now, it won't run without the --tarball or --dpdk-tree args, even if it's specified in the config file. It seems like it just ignores whatever was specified in the command line if it's specified in the yaml file, but won't execute without the command line args either.

Hi Dean,

If I understood your query correctly, I can't seem to replicate your issue, and I need some steps so that I fully understand.

My configuration file is set as:

dpdk_build:
dpdk_tree: /home/luca/dpdk
remote: true
precompiled_build_dir: build

and running:

  ./main.py --config-file my-conf.yaml

works just as expected. It re-uses my pre-build DPDK repository on my SUT node. We tried every setup:

(tree, tarball)*(local, remote)*(precompiled, build_options)

and we were able to get it to work without issue. In case I misunderstood your problem I just attempted to call:

  (cd ../ && git archive --format=tar.gz -o dts/dpdk-HEAD.tar.gz \
    --prefix dpdk-HEAD/ HEAD)
  ./main.py --config-file my-conf.yaml --tarball dpdk.tar.gz

and as expected it failed because my configuration was assuming a precompiled build dir in my tarball, but it copied and extracted the tarball on the remote correctly. Changing from precompiled to build, made it fully work.

Looking forward to hearing back from you.

Best,
Luca

Reviewed-by
#23 lore raw

Re: [PATCH v2 5/7] dts: add support for externally compiled DPDK

Quoted 13 lines

Hi Dean,

If I understood your query correctly, I can't seem to replicate your issue, and I need some steps so that I fully understand.

My configuration file is set as:

dpdk_build:
dpdk_tree: /home/luca/dpdk
remote: true
precompiled_build_dir: build

Quoted 7 lines

and running:

   ./main.py --config-file my-conf.yaml

works just as expected. It re-uses my pre-build DPDK repository on my SUT node. We tried every setup:

I may have just misunderstood how the command line args are supposed to be used. I'm assuming based on your response that --config-file is only used for when the tarball/tree is located on the host, versus --tarball or --dpdk-tree being for when they're located on the remote server?

If this is the case my apologies, I was setting it up incorrectly. And if so:

#24 lore raw

Re: [PATCH v2 5/7] dts: add support for externally compiled DPDK

Also, I want to point out that even though the --config-file argument defaults to /dpdk/dts/conf.yaml, you still can't run ./main.py by itself.

#25 lore raw

Re: [PATCH v2 5/7] dts: add support for externally compiled DPDK

In reply to Dean Marx
Quoted 5 lines · Dean Marx

I may have just misunderstood how the command line args are supposed to be used. I'm assuming based on your response that --config-file is only used for when the tarball/tree is located on the host, versus --tarball or --dpdk-tree being for when they're located on the remote server?

If this is the case my apologies, I was setting it up incorrectly. And if so:

Reviewed-by Dean Marx <[email protected] <mailto:[email protected]>>

No, sorry for confusing you Dean! --tarball and --dpdk-tree are just overrides for their respective fields in the configuration file. You can do everything by using just the configuration file, without the need for CLI arguments.

Reviewed-by on v2 5/7
#26 lore raw

Re: [PATCH v2 5/7] dts: add support for externally compiled DPDK

In reply to Luca Vizzarro
Quoted 32 lines · Luca Vizzarro

From: Tomáš Ďurovec <[email protected]>

Enable the user to use either a DPDK source tree directory or a tarball, with and without a pre-built build directory. These can be stored on either SUT node or the DTS host. The DPDK build setup or the pre-built binaries can be specified through the configuration file, the command line arguments or environment variables.

---
 dts/conf.yaml                                |  24 +-
 dts/framework/config/__init__.py             | 123 ++++++-
 dts/framework/config/conf_yaml_schema.json   |  62 +++-
 dts/framework/config/types.py                |  17 +-
 dts/framework/exception.py                   |   4 +-
 dts/framework/remote_session/dpdk_shell.py   |   2 +-
 dts/framework/runner.py                      |   8 +-
 dts/framework/settings.py                    | 200 +++++++++--
 dts/framework/test_result.py                 |  23 +-
 dts/framework/testbed_model/node.py          |  22 +-
 dts/framework/testbed_model/os_session.py    |  63 +++-
 dts/framework/testbed_model/posix_session.py |  39 ++-
 dts/framework/testbed_model/sut_node.py      | 351 +++++++++++++------
 13 files changed, 732 insertions(+), 206 deletions(-)
dts/conf.yaml +0 -0
index 814744a1fc..8a65a481d6 100644
@@ -5,12 +5,24 @@
 test_runs:

dts/conf.yaml line 9

Quoted 10 lines
dts/conf.yaml +1 -6
   # define one test run environment
   - dpdk_build:
-      arch: x86_64
-      os: linux
-      cpu: native
-      # the combination of the following two makes CC="ccache gcc"
-      compiler: gcc
-      compiler_wrapper: ccache
+      # dpdk_tree: Commented out because `tarball` is defined.
 

Should this key name be extended to clarify the desired value is a path, and whether it is absolute or relative?

+1 to Dean's concerns about using the tarball without --tarball flag if dpdk_tree is commented out and tarball is defined.

#27 lore raw

Re: [PATCH v2 5/7] dts: add support for externally compiled DPDK

Hi Patrick,

Quoted 17 lines · Patrick Robb

diff --git a/dts/conf.yaml b/dts/conf.yaml
index 814744a1fc..8a65a481d6 100644
--- a/dts/conf.yaml
+++ b/dts/conf.yaml
@@ -5,12 +5,24 @@
 test_runs:
   # define one test run environment
   - dpdk_build:
-      arch: x86_64
-      os: linux
-      cpu: native
-      # the combination of the following two makes CC="ccache gcc" -      compiler: gcc
-      compiler_wrapper: ccache
+      # dpdk_tree: Commented out because tarball is defined.

Quoted 1 line

Should this key name be extended to clarify the desired value is a path, and whether it is absolute or relative?

We could amend the key name to something more suitable if we wished. The path could be either absolute or relative, so it doesn't matter. I assume you are referring to change dpdk_tree to dpdk_tree_path and tarball to tarball_path or something similar?

Quoted 2 lines

+1 to Dean's concerns about using the tarball without --tarball flag if dpdk_tree is commented out and tarball is defined.

As replied to Dean, this scenario currently works, and I have also just re-tested it for completeness. I need some more details to figure out what's happening.

Best,
Luca

#28 lore raw

Re: [PATCH v2 5/7] dts: add support for externally compiled DPDK

Quoted 20 lines · Luca Vizzarro

Hi Patrick,

Quoted 17 lines · Patrick Robb

diff --git a/dts/conf.yaml b/dts/conf.yaml
index 814744a1fc..8a65a481d6 100644
--- a/dts/conf.yaml
+++ b/dts/conf.yaml
@@ -5,12 +5,24 @@
test_runs:
# define one test run environment
- dpdk_build:
- arch: x86_64
- os: linux
- cpu: native
- # the combination of the following two makes CC="ccache gcc"
- compiler: gcc
- compiler_wrapper: ccache
+ # dpdk_tree: Commented out because tarball is defined.

Quoted 8 lines
Quoted 2 lines

Should this key name be extended to clarify the desired value is a path, and whether it is absolute or relative?

We could amend the key name to something more suitable if we wished. The path could be either absolute or relative, so it doesn't matter. I assume you are referring to change dpdk_tree to dpdk_tree_path and tarball to tarball_path or something similar?

Yes, that was my thinking. Up to you on whether it's better or just overly wordy.

Quoted 8 lines
Quoted 3 lines

+1 to Dean's concerns about using the tarball without --tarball flag if dpdk_tree is commented out and tarball is defined.

As replied to Dean, this scenario currently works, and I have also just re-tested it for completeness. I need some more details to figure out what's happening.

Okay, so I guess this is fine. I chatted with Dean about this today and it sounds like the workflows he was worried about do actually work (namely, copying a tarball from DTS engine to SUT) but that there is an added requirement that a flag be added (i.e. you can't just run main.py alone anymore) and it's unclear to him (and me) why this might be the case. I can try and take another look tonight, but I'm basically happy now that I know the workflows Dean was concerned about are tested and work.

Quoted 3 lines

Best,
Luca

#29 lore raw

PATCH v2 6/7 doc: update argument options for external DPDK build

In reply to Luca Vizzarro

From: Tomáš Ďurovec <[email protected]>

By adding support for external build, we extend the argument documentation for supported options.

---
 doc/guides/tools/dts.rst | 75 ++++++++++++++++++++++++----------------
 1 file changed, 45 insertions(+), 30 deletions(-)
doc/guides/tools/dts.rst +45 -30
index 65cce9e5ed..7b90c4856e 100644
@@ -195,10 +195,10 @@ Running DTS
 -----------
 
 DTS needs to know which nodes to connect to and what hardware to use on those nodes.
-Once that's configured, either a DPDK source code tarball or a Git revision ID
-of choice needs to be supplied.
-DTS will use this to compile DPDK on the SUT node
-and then run the tests with the newly built binaries.
+Once that's configured, either a DPDK source code tarball or tree folder need to be supplied whether
+these are on your DTS host machine or the SUT node.
+DTS can accept a pre-compiled build placed in a subdirectory, or it will compile DPDK on the SUT
+node, and then run the tests with the newly built binaries.
 
 
 Configuring DTS
@@ -221,44 +221,59 @@ DTS is run with ``main.py`` located in the ``dts`` directory after entering Poet
 .. code-block:: console
 
    (dts-py3.10) $ ./main.py --help
-   usage: main.py [-h] [--config-file FILE_PATH] [--output-dir DIR_PATH] [-t SECONDS] [-v] [-s] (--tarball FILE_PATH | --revision ID)
-                  [--compile-timeout SECONDS] [--test-suite TEST_SUITE [TEST_CASES ...]] [--re-run N_TIMES]
+   usage: main.py [-h] [--config-file FILE_PATH] [--output-dir DIR_PATH] [-t SECONDS] [-v] [--dpdk-tree DIR_PATH | --tarball FILE_PATH] [--remote-source]
+                  [--precompiled-build-dir DIR_NAME] [--compile-timeout SECONDS] [--test-suite TEST_SUITE [TEST_CASES ...]] [--re-run N_TIMES]
+                  [--random-seed NUMBER]
 
-   Run DPDK test suites. All options may be specified with the environment variables provided in brackets. Command line arguments have higher
-   priority.
+   Run DPDK test suites. All options may be specified with the environment variables provided in brackets. Command line arguments have higher priority.
 
    options:
-     -h, --help            show this help message and exit
-     --config-file FILE_PATH
-                           [DTS_CFG_FILE] The configuration file that describes the test cases, SUTs and targets. (default: conf.yaml)
-     --output-dir DIR_PATH, --output DIR_PATH
+   -h, --help            show this help message and exit
+   --config-file FILE_PATH
+                           [DTS_CFG_FILE] The configuration file that describes the test cases, SUTs and DPDK build configs. (default:
+                           /home/lucviz01/dpdk/dts/conf.yaml)
+   --output-dir DIR_PATH, --output DIR_PATH
                            [DTS_OUTPUT_DIR] Output directory where DTS logs and results are saved. (default: output)
-     -t SECONDS, --timeout SECONDS
+   -t SECONDS, --timeout SECONDS
                            [DTS_TIMEOUT] The default timeout for all DTS operations except for compiling DPDK. (default: 15)
-     -v, --verbose         [DTS_VERBOSE] Specify to enable verbose output, logging all messages to the console. (default: False)
-     -s, --skip-setup      [DTS_SKIP_SETUP] Specify to skip all setup steps on SUT and TG nodes. (default: False)
-     --tarball FILE_PATH, --snapshot FILE_PATH
-                           [DTS_DPDK_TARBALL] Path to DPDK source code tarball to test. (default: None)
-     --revision ID, --rev ID, --git-ref ID
+   -v, --verbose           [DTS_VERBOSE] Specify to enable verbose output, logging all messages to the console. (default: False)
+   --revision ID, --rev ID, --git-ref ID
                            [DTS_DPDK_REVISION_ID] Git revision ID to test. Could be commit, tag, tree ID etc. To test local changes, first
                            commit them, then use their commit ID. (default: None)
-     --compile-timeout SECONDS
+   --compile-timeout SECONDS
                            [DTS_COMPILE_TIMEOUT] The timeout for compiling DPDK. (default: 1200)
-     --test-suite TEST_SUITE [TEST_CASES ...]
-                           [DTS_TEST_SUITES] A list containing a test suite with test cases. The first parameter is the test suite name, and
-                           the rest are test case names, which are optional. May be specified multiple times. To specify multiple test suites
-                           in the environment variable, join the lists with a comma. Examples: --test-suite suite case case --test-suite
-                           suite case ... | DTS_TEST_SUITES='suite case case, suite case, ...' | --test-suite suite --test-suite suite case
-                           ... | DTS_TEST_SUITES='suite, suite case, ...' (default: [])
-     --re-run N_TIMES, --re_run N_TIMES
+   --test-suite TEST_SUITE [TEST_CASES ...]
+                           [DTS_TEST_SUITES] A list containing a test suite with test cases. The first parameter is the test suite name, and the rest are
+                           test case names, which are optional. May be specified multiple times. To specify multiple test suites in the environment
+                           variable, join the lists with a comma. Examples: --test-suite suite case case --test-suite suite case ... |
+                           DTS_TEST_SUITES='suite case case, suite case, ...' | --test-suite suite --test-suite suite case ... | DTS_TEST_SUITES='suite,
+                           suite case, ...' (default: [])
+   --re-run N_TIMES, --re_run N_TIMES
                            [DTS_RERUN] Re-run each test case the specified number of times if a test failure occurs. (default: 0)
-     --random-seed NUMBER  [DTS_RANDOM_SEED] The seed to use with the pseudo-random generator. If not specified, the configuration value is
-                           used instead. If that's also not specified, a random seed is generated. (default: None)
+   --random-seed NUMBER  [DTS_RANDOM_SEED] The seed to use with the pseudo-random generator. If not specified, the configuration value is used instead.
+                           If that's also not specified, a random seed is generated. (default: None)
+
+   DPDK Build Options:
+   Arguments in this group (and subgroup) will be applied to a DPDKLocation when the DPDK tree, tarball or revision will be provided, other arguments
+   like remote source and build dir are optional. A DPDKLocation from settings are used instead of from config if construct successful.
+
+   --dpdk-tree DIR_PATH  [DTS_DPDK_TREE] The path to the DPDK source tree directory to test. Cannot be used in conjunction with --tarball. (default:
+                           None)
+   --tarball FILE_PATH, --snapshot FILE_PATH
+                           [DTS_DPDK_TARBALL] The path to the DPDK source tarball to test. DPDK must be contained in a folder with the same name as the
+                           tarball file. Cannot be used in conjunction with --dpdk-tree. (default: None)
+   --remote-source       [DTS_REMOTE_SOURCE] Set this option if either the DPDK source tree or tarball to be used are located on the SUT node. Can only
+                           be used with --dpdk-tree or --tarball. (default: False)
+   --precompiled-build-dir DIR_NAME
+                           [DTS_PRECOMPILED_BUILD_DIR] Define the subdirectory under the DPDK tree root directory where the pre-compiled binaries are
+                           located. If set, DTS will build DPDK under the `build` directory instead. Can only be used with --dpdk-tree or --tarball.
+                           (default: None)
 
 
 The brackets contain the names of environment variables that set the same thing.
-The minimum DTS needs is a config file and a DPDK tarball or git ref ID.
-You may pass those to DTS using the command line arguments or use the default paths.
+The minimum DTS needs is a config file and a pre-built DPDK or DPDK
+sources location which can be specified in said config file or on the
+command line or environment variables.
 
 Example command for running DTS with the template configuration and DPDK tag v23.11:
 
Signature · 1 line
2.43.0
Reviewed-by on v2 6/7
#30 lore raw

Re: [PATCH v2 6/7] doc: update argument options for external DPDK build

Quoted 8 lines · Luca Vizzarro

From: Tomáš Ďurovec <[email protected]>

By adding support for external build, we extend the argument documentation for supported options.

Other than the comments I brought up on the previous patch:

Reviewed-by on v2 6/7
#31 lore raw

Re: [PATCH v2 6/7] doc: update argument options for external DPDK build

In reply to Luca Vizzarro
Quoted 9 lines · Luca Vizzarro
doc/guides/tools/dts.rst +3 -0
+
+   DPDK Build Options:
+   Arguments in this group (and subgroup) will be applied to a

DPDKLocation when the DPDK tree, tarball or revision will be provided, other arguments
+ like remote source and build dir are optional. A DPDKLocation from
settings are used instead of from config if construct successful.

Maybe call this "DPDK Source Options?" To me, "DPDK Build Options" invokes meson options supported in DPDK. Up to you though.

#32 lore raw

Re: [PATCH v2 6/7] doc: update argument options for external DPDK build

Quoted 12 lines · Patrick Robb

On Mon, Oct 21, 2024 at 9:50 AM Luca Vizzarro <[email protected] <mailto:[email protected]>> wrote:

+
+   DPDK Build Options:
+   Arguments in this group (and subgroup) will be applied to a DPDKLocation when the DPDK tree, tarball or revision will be provided, other arguments
+   like remote source and build dir are optional. A DPDKLocation from settings are used instead of from config if construct successful.

Quoted 2 lines

Maybe call this "DPDK Source Options?" To me, "DPDK Build Options" invokes meson options supported in DPDK. Up to you though.

Reviewed-by Patrick Robb <[email protected] <mailto:[email protected]>>

Perfectly understandable concern to be honest. But it's also somewhat complicated, given this refers to the build whether it's uncompiled or precompiled and the location of the sources. It may require some thought.

#33 lore raw

Re: [PATCH v2 6/7] doc: update argument options for external DPDK build

Quoted 15 lines · Luca Vizzarro
Quoted 11 lines · Patrick Robb

On Mon, Oct 21, 2024 at 9:50 AM Luca Vizzarro <[email protected] <mailto:[email protected]>> wrote:

+
+ DPDK Build Options:
+ Arguments in this group (and subgroup) will be applied to a
DPDKLocation when the DPDK tree, tarball or revision will be provided, other arguments
+ like remote source and build dir are optional. A DPDKLocation
from settings are used instead of from config if construct

successful.

Quoted 2 lines
Quoted 8 lines
Quoted 3 lines

Maybe call this "DPDK Source Options?" To me, "DPDK Build Options" invokes meson options supported in DPDK. Up to you though.

Reviewed-by Patrick Robb <[email protected] <mailto:[email protected]>>

Perfectly understandable concern to be honest. But it's also somewhat complicated, given this refers to the build whether it's uncompiled or precompiled and the location of the sources. It may require some thought.

"DPDK Build Source" instead of "DPDK Build Options"?

I don't know why but for some reason "Build Options" strongly translates to meson options in my mind.

But if it's a headache I think we can drop it - everything is documented in any case so it shouldn't be a big deal.

#34 lore raw

PATCH v2 7/7 dts: remove git ref option

In reply to Luca Vizzarro

From: Tomáš Ďurovec <[email protected]>

Given the whole DPDK tree directory can now be copied to the nodes, there is no more need to use the git ref option, as the tree can be controlled directly by the user.

---
 doc/guides/tools/dts.rst  |   9 ---
 dts/framework/settings.py |  48 ++-------------
 dts/framework/utils.py    | 119 +-------------------------------------
 3 files changed, 7 insertions(+), 169 deletions(-)
doc/guides/tools/dts.rst +0 -9
index 7b90c4856e..a00d987ece 100644
@@ -237,9 +237,6 @@ DTS is run with ``main.py`` located in the ``dts`` directory after entering Poet
    -t SECONDS, --timeout SECONDS
                            [DTS_TIMEOUT] The default timeout for all DTS operations except for compiling DPDK. (default: 15)
    -v, --verbose           [DTS_VERBOSE] Specify to enable verbose output, logging all messages to the console. (default: False)
-   --revision ID, --rev ID, --git-ref ID
-                           [DTS_DPDK_REVISION_ID] Git revision ID to test. Could be commit, tag, tree ID etc. To test local changes, first
-                           commit them, then use their commit ID. (default: None)
    --compile-timeout SECONDS
                            [DTS_COMPILE_TIMEOUT] The timeout for compiling DPDK. (default: 1200)
    --test-suite TEST_SUITE [TEST_CASES ...]
@@ -275,12 +272,6 @@ The minimum DTS needs is a config file and a pre-built DPDK or DPDK
 sources location which can be specified in said config file or on the
 command line or environment variables.
 
-Example command for running DTS with the template configuration and DPDK tag v23.11:
-
-.. code-block:: console
-
-   (dts-py3.10) $ ./main.py --git-ref v23.11
-
 
 DTS Results
 ~~~~~~~~~~~
dts/framework/settings.py +6 -42

100 lines not on this page · raw message

dts/framework/utils.py +1 -118

149 lines not on this page · raw message

Signature · 1 line
2.43.0
Reviewed-by on v2 7/7
#36 lore raw

Re: [PATCH v2 7/7] dts: remove git ref option

In reply to Luca Vizzarro
Quoted 42 lines · Luca Vizzarro

From: Tomáš Ďurovec <[email protected]>

Given the whole DPDK tree directory can now be copied to the nodes, there is no more need to use the git ref option, as the tree can be controlled directly by the user.

---
 doc/guides/tools/dts.rst  |   9 ---
 dts/framework/settings.py |  48 ++-------------
 dts/framework/utils.py    | 119 +-------------------------------------
 3 files changed, 7 insertions(+), 169 deletions(-)
doc/guides/tools/dts.rst +0 -0
index 7b90c4856e..a00d987ece 100644
@@ -237,9 +237,6 @@ DTS is run with ``main.py`` located in the ``dts``

directory after entering Poet
-t SECONDS, --timeout SECONDS
[DTS_TIMEOUT] The default timeout for all DTS
operations except for compiling DPDK. (default: 15)

    -v, --verbose           [DTS_VERBOSE] Specify to enable verbose

output, logging all messages to the console. (default: False)

doc/guides/tools/dts.rst +0 -2
-   --revision ID, --rev ID, --git-ref ID
-                           [DTS_DPDK_REVISION_ID] Git revision ID to

test. Could be commit, tag, tree ID etc. To test local changes, first
- commit them, then use their commit ID.
(default: None)
--compile-timeout SECONDS
[DTS_COMPILE_TIMEOUT] The timeout for
compiling DPDK. (default: 1200)
--test-suite TEST_SUITE [TEST_CASES ...]

doc/guides/tools/dts.rst +0 -0
@@ -275,12 +272,6 @@ The minimum DTS needs is a config file and a

pre-built DPDK or DPDK
sources location which can be specified in said config file or on the command line or environment variables.

-Example command for running DTS with the template configuration and DPDK tag v23.11:

doc/guides/tools/dts.rst The minimum DTS needs is a config file and a pre-built DPDK or DPDK · line 283

Quoted 5 lines
doc/guides/tools/dts.rst +0 -5
-
-.. code-block:: console
-
-   (dts-py3.10) $ ./main.py --git-ref v23.11
-

I see this needs to go because of the --git-ref usage. Can this be replaced with a new example command? Perhaps even 2, one for each of --tarball and --dpdk-tree?

#37 lore raw

Re: [PATCH v2 7/7] dts: remove git ref option

Hi Patrick,

Quoted 10 lines · Patrick Robb
    -Example command for running DTS with the template configuration and
    DPDK tag v23.11:
    -
    -.. code-block:: console
    -
    -   (dts-py3.10) $ ./main.py --git-ref v23.11
    -

I see this needs to go because of the --git-ref usage. Can this be replaced with a new example command? Perhaps even 2, one for each of -- tarball and --dpdk-tree?

These patches make these command line arguments optional, and instead of being the primary source of DPDK, they become overrides of the configuration fields. The original doc snippet was there as it was mandatory to make it work, but it's no longer the case given the configuration must be completed or DTS won't run. And naturall with a completed configuration there is no further need to use CLI arguments.

Hope this clarifies!

Best,
Luca

#38 lore raw
In reply to Luca Vizzarro

Hi Luca,

I noticed in the new version of this series the "improve statistics" patch was taken out, was there any reason for this? I believe Juraj wanted to create a feature that wrote all of the test suite/case summaries in a JSON/text output file, is this going to be implemented later or in a different format?
https://patches.dpdk.org/project/dpdk/patch/[email protected]/

Quoted 50 lines · Luca Vizzarro

Hello,

taking over this patchset from Tomáš, who no longer contributes to DTS. Please find in this cover letter the changes I've made.

v2:
- rebased on top of dts-next and resolved conflicts
- fixed bugs
- rephrased some docstrings
- improved settings naming for less ambiguity
- improved commit subjects and bodies

Kind regards,
Luca

Tomáš Ďurovec (7):
dts: rename build target to DPDK build
dts: enforce one dpdk build per test run
dts: fix remote session file transfer vars
dts: enable copying directories to and from nodes
dts: add support for externally compiled DPDK
doc: update argument options for external DPDK build
dts: remove git ref option

 doc/guides/tools/dts.rst                      |  82 ++--
 dts/conf.yaml                                 |  18 +-
 dts/framework/config/__init__.py              | 142 ++++++-
 dts/framework/config/conf_yaml_schema.json    |  72 +++-
 dts/framework/config/types.py                 |  19 +-
 dts/framework/exception.py                    |   4 +-
 dts/framework/logger.py                       |   4 -
 dts/framework/remote_session/dpdk_shell.py    |   2 +-
 .../remote_session/remote_session.py          |  24 +-
 dts/framework/remote_session/ssh_session.py   |  18 +-
 dts/framework/runner.py                       | 139 ++-----
 dts/framework/settings.py                     | 202 +++++++---
 dts/framework/test_result.py                  | 124 ++----
 dts/framework/test_suite.py                   |   2 +-
 dts/framework/testbed_model/node.py           |  22 +-
 dts/framework/testbed_model/os_session.py     | 209 ++++++++--
 dts/framework/testbed_model/posix_session.py  | 141 ++++++-
 dts/framework/testbed_model/sut_node.py       | 376 ++++++++++++------
 dts/framework/utils.py                        | 164 +++-----
 dts/tests/TestSuite_smoke_tests.py            |   2 +-
 20 files changed, 1130 insertions(+), 636 deletions(-)

--
2.43.0

#39 lore raw
Quoted 8 lines · Dean Marx

Hi Luca,

I noticed in the new version of this series the "improve statistics" patch was taken out, was there any reason for this? I believe Juraj wanted to create a feature that wrote all of the test suite/case summaries in a JSON/text output file, is this going to be implemented later or in a different format?

https://patches.dpdk.org/project/dpdk/patch/[email protected]/
<https://patches.dpdk.org/project/dpdk/patch/[email protected]/>

Quoted 1 line

It's just been split off into its own patch. Still there:
https://patches.dpdk.org/project/dpdk/patch/[email protected]/

#40 lore raw
In reply to Dean Marx
Quoted 3 lines · Dean Marx

Hi Luca,

I noticed in the new version of this series the "improve statistics" patch was taken out, was there any reason for this? I believe Juraj wanted to create a feature that wrote all of the test suite/case summaries in a JSON/text output file, is this going to be implemented later or in a different format?

Hi Dean,

Sorry for causing confusion! Like Paul mentioned, this was split in a different patchset by Tomáš himself in the non-RFC patchset. I haven't had a chance to give it a good look. Once I download it, rebase, solve merge conflicts and apply any changes (review) needed, I'll send it out.

In the meantime do you mind providing a review to the patch that Paul linked, so that I could also apply your comments if you have any.

Thanks,
Luca

#41 lore raw

Ah okay, that makes sense. Yes I'll review that ASAP

Quoted 22 lines · Luca Vizzarro
Quoted 7 lines · Dean Marx

Hi Luca,

I noticed in the new version of this series the "improve statistics" patch was taken out, was there any reason for this? I believe Juraj wanted to create a feature that wrote all of the test suite/case summaries in a JSON/text output file, is this going to be implemented later or in a different format?

Hi Dean,

Sorry for causing confusion! Like Paul mentioned, this was split in a different patchset by Tomáš himself in the non-RFC patchset. I haven't had a chance to give it a good look. Once I download it, rebase, solve merge conflicts and apply any changes (review) needed, I'll send it out.

In the meantime do you mind providing a review to the patch that Paul linked, so that I could also apply your comments if you have any.

Thanks,
Luca

#42 lore raw

v3 cover DTS external DPDK build

In reply to Tomáš Ďurovec

Hello,

sending a fix for some minor problems found in the meantime.

v3:
- added Tomáš to mailmap
- fixed docstrings
- amended commit subject
v2:
- rebased on top of dts-next and resolved conflicts
- fixed bugs
- rephrased some docstrings
- improved settings naming for less ambiguity
- improved commit subjects and bodies

Kind regards,
Luca

Tomáš Ďurovec (7):
dts: rename build target to DPDK build
dts: enforce one dpdk build per test run
dts: change remote and local paths objects
dts: enable copying directories to and from nodes
dts: add support for externally compiled DPDK
doc: update argument options for external DPDK build
dts: remove git ref option

 .mailmap                                      |   1 +
 doc/guides/tools/dts.rst                      |  82 ++--
 dts/conf.yaml                                 |  18 +-
 dts/framework/config/__init__.py              | 142 ++++++-
 dts/framework/config/conf_yaml_schema.json    |  72 +++-
 dts/framework/config/types.py                 |  19 +-
 dts/framework/exception.py                    |   4 +-
 dts/framework/logger.py                       |   4 -
 dts/framework/remote_session/dpdk_shell.py    |   2 +-
 .../remote_session/remote_session.py          |  24 +-
 dts/framework/remote_session/ssh_session.py   |  18 +-
 dts/framework/runner.py                       | 139 ++-----
 dts/framework/settings.py                     | 202 +++++++---
 dts/framework/test_result.py                  | 124 ++----
 dts/framework/test_suite.py                   |   2 +-
 dts/framework/testbed_model/node.py           |  22 +-
 dts/framework/testbed_model/os_session.py     | 209 ++++++++--
 dts/framework/testbed_model/posix_session.py  | 141 ++++++-
 dts/framework/testbed_model/sut_node.py       | 376 ++++++++++++------
 dts/framework/utils.py                        | 164 +++-----
 dts/tests/TestSuite_smoke_tests.py            |   2 +-
 21 files changed, 1131 insertions(+), 636 deletions(-)
Signature · 1 line
2.43.0
#43 lore raw

PATCH v3 1/7 dts: rename build target to DPDK build

From: Tomáš Ďurovec <[email protected]>

Since the DPDK may already be built, some more general name is needed that includes both the DPDK location and the build config (if we are going to build).

---
 .mailmap                                   |   1 +
 dts/conf.yaml                              |   2 +-
 dts/framework/config/__init__.py           |  26 ++---
 dts/framework/config/conf_yaml_schema.json |  10 +-
 dts/framework/config/types.py              |   4 +-
 dts/framework/logger.py                    |   4 +-
 dts/framework/runner.py                    | 112 ++++++++++-----------
 dts/framework/settings.py                  |   2 +-
 dts/framework/test_result.py               |  72 +++++++------
 dts/framework/test_suite.py                |   2 +-
 dts/framework/testbed_model/sut_node.py    |  55 +++++-----
 dts/tests/TestSuite_smoke_tests.py         |   2 +-
 12 files changed, 143 insertions(+), 149 deletions(-)
.mailmap +1 -0
index 4a508bafad..c27d58bb0e 100644
@@ -1498,6 +1498,7 @@ Ting Xu <[email protected]>
 Tingting Liao <[email protected]>
 Tiwei Bie <[email protected]> <[email protected]>
 Todd Fujinaka <[email protected]>
+Tomáš Ďurovec <[email protected]>
 Tomasz Cel <[email protected]>
 Tomasz Duszynski <[email protected]> <[email protected]>
 Tomasz Jonak <[email protected]>
dts/conf.yaml +1 -1
index ca5e87636e..1363e93580 100644
@@ -4,7 +4,7 @@
 
 test_runs:
   # define one test run environment
-  - build_targets:
+  - dpdk_builds:
       - arch: x86_64
         os: linux
         cpu: native
dts/framework/config/__init__.py +13 -13
index 269d9ec318..c243716010 100644
@@ -45,8 +45,8 @@
 from typing_extensions import Self
 
 from framework.config.types import (
-    BuildTargetConfigDict,
     ConfigurationDict,
+    DPDKBuildConfigDict,
     NodeConfigDict,
     PortConfigDict,
     TestRunConfigDict,
@@ -335,7 +335,7 @@ class NodeInfo:
 
 
 @dataclass(slots=True, frozen=True)
-class BuildTargetConfiguration:
+class DPDKBuildConfiguration:
     """DPDK build configuration.
 
     The configuration used for building DPDK.
@@ -358,7 +358,7 @@ class BuildTargetConfiguration:
     name: str
 
     @classmethod
-    def from_dict(cls, d: BuildTargetConfigDict) -> Self:
+    def from_dict(cls, d: DPDKBuildConfigDict) -> Self:
         r"""A convenience method that processes the inputs before creating an instance.
 
         `arch`, `os`, `cpu` and `compiler` are converted to :class:`Enum`\s and
@@ -368,7 +368,7 @@ def from_dict(cls, d: BuildTargetConfigDict) -> Self:
             d: The configuration dictionary.
 
         Returns:
-            The build target configuration instance.
+            The DPDK build configuration instance.
         """
         return cls(
             arch=Architecture(d["arch"]),
@@ -381,8 +381,8 @@ def from_dict(cls, d: BuildTargetConfigDict) -> Self:
 
 
 @dataclass(slots=True, frozen=True)
-class BuildTargetInfo:
-    """Various versions and other information about a build target.
+class DPDKBuildInfo:
+    """Various versions and other information about a DPDK build.
 
     Attributes:
         dpdk_version: The DPDK version that was built.
@@ -437,7 +437,7 @@ class TestRunConfiguration:
     and with what DPDK build.
 
     Attributes:
-        build_targets: A list of DPDK builds to test.
+        dpdk_builds: A list of DPDK builds to test.
         perf: Whether to run performance tests.
         func: Whether to run functional tests.
         skip_smoke_tests: Whether to skip smoke tests.
@@ -448,7 +448,7 @@ class TestRunConfiguration:
         random_seed: The seed to use for pseudo-random generation.
     """
 
-    build_targets: list[BuildTargetConfiguration]
+    dpdk_builds: list[DPDKBuildConfiguration]
     perf: bool
     func: bool
     skip_smoke_tests: bool
@@ -466,7 +466,7 @@ def from_dict(
     ) -> Self:
         """A convenience method that processes the inputs before creating an instance.
 
-        The build target and the test suite config are transformed into their respective objects.
+        The DPDK build and the test suite config are transformed into their respective objects.
         SUT and TG configurations are taken from `node_map`. The other (:class:`bool`) attributes
         are just stored.
 
@@ -477,8 +477,8 @@ def from_dict(
         Returns:
             The test run configuration instance.
         """
-        build_targets: list[BuildTargetConfiguration] = list(
-            map(BuildTargetConfiguration.from_dict, d["build_targets"])
+        dpdk_builds: list[DPDKBuildConfiguration] = list(
+            map(DPDKBuildConfiguration.from_dict, d["dpdk_builds"])
         )
         test_suites: list[TestSuiteConfig] = list(map(TestSuiteConfig.from_dict, d["test_suites"]))
         sut_name = d["system_under_test_node"]["node_name"]
@@ -501,7 +501,7 @@ def from_dict(
         )
         random_seed = d.get("random_seed", None)
         return cls(
-            build_targets=build_targets,
+            dpdk_builds=dpdk_builds,
             perf=d["perf"],
             func=d["func"],
             skip_smoke_tests=skip_smoke_tests,
@@ -552,7 +552,7 @@ class Configuration:
     def from_dict(cls, d: ConfigurationDict) -> Self:
         """A convenience method that processes the inputs before creating an instance.
 
-        Build target and test suite config are transformed into their respective objects.
+        DPDK build and test suite config are transformed into their respective objects.
         SUT and TG configurations are taken from `node_map`. The other (:class:`bool`) attributes
         are just stored.
 
dts/framework/config/conf_yaml_schema.json +5 -5
index df390e8ae2..927a73ac6c 100644
@@ -110,9 +110,9 @@
         "mscv"
       ]
     },
-    "build_target": {
+    "dpdk_build": {
       "type": "object",
-      "description": "Targets supported by DTS",
+      "description": "DPDK build configuration supported by DTS.",
       "properties": {
         "arch": {
           "type": "string",
@@ -327,10 +327,10 @@
       "items": {
         "type": "object",
         "properties": {
-          "build_targets": {
+          "dpdk_builds": {
             "type": "array",
             "items": {
-              "$ref": "#/definitions/build_target"
+              "$ref": "#/definitions/dpdk_build"
             },
             "minimum": 1
           },
@@ -387,7 +387,7 @@
         },
         "additionalProperties": false,
         "required": [
-          "build_targets",
+          "dpdk_builds",
           "perf",
           "func",
           "test_suites",
dts/framework/config/types.py +2 -2
index ce7b784ac8..4f450267d1 100644
@@ -71,7 +71,7 @@ class NodeConfigDict(TypedDict):
     traffic_generator: TrafficGeneratorConfigDict
 
 
-class BuildTargetConfigDict(TypedDict):
+class DPDKBuildConfigDict(TypedDict):
     """Allowed keys and values."""
 
     #:
@@ -108,7 +108,7 @@ class TestRunConfigDict(TypedDict):
     """Allowed keys and values."""
 
     #:
-    build_targets: list[BuildTargetConfigDict]
+    dpdk_builds: list[DPDKBuildConfigDict]
     #:
     perf: bool
     #:
dts/framework/logger.py +2 -2
index 9420323d38..3fbe618219 100644
@@ -33,7 +33,7 @@ class DtsStage(StrEnum):
     #:
     test_run_setup = auto()
     #:
-    build_target_setup = auto()
+    dpdk_build_setup = auto()
     #:
     test_suite_setup = auto()
     #:
@@ -41,7 +41,7 @@ class DtsStage(StrEnum):
     #:
     test_suite_teardown = auto()
     #:
-    build_target_teardown = auto()
+    dpdk_build_teardown = auto()
     #:
     test_run_teardown = auto()
     #:
dts/framework/runner.py +55 -57

247 lines not on this page · raw message

dts/framework/settings.py +1 -1
index 7744e37f54..52a1582d5c 100644
@@ -278,7 +278,7 @@ def _get_parser() -> _DTSArgumentParser:
         "--config-file",
         default=SETTINGS.config_file_path,
         type=Path,
-        help="The configuration file that describes the test cases, SUTs and targets.",
+        help="The configuration file that describes the test cases, SUTs and DPDK build configs.",
         metavar="FILE_PATH",
         dest="config_file_path",
     )
dts/framework/test_result.py +35 -37

158 lines not on this page · raw message

dts/framework/test_suite.py +1 -1
index 6a1d067215..9e08339ada 100644
@@ -71,7 +71,7 @@ class TestSuite(TestProtocol):
     sut_node: SutNode
     tg_node: TGNode
     #: Whether the test suite is blocking. A failure of a blocking test suite
-    #: will block the execution of all subsequent test suites in the current build target.
+    #: will block the execution of all subsequent test suites in the current DPDK build.
     is_blocking: ClassVar[bool] = False
     _logger: DTSLogger
     _sut_port_ingress: Port
dts/framework/testbed_model/sut_node.py +26 -29

125 lines not on this page · raw message

dts/tests/TestSuite_smoke_tests.py +1 -1
index 5f953a190f..9822240b5b 100644
@@ -31,7 +31,7 @@ class TestSmokeTests(TestSuite):
 
     Attributes:
         is_blocking: This test suite will block the execution of all other test suites
-            in the build target after it.
+            in the DPDK build after it.
         nics_in_node: The NICs present on the SUT node.
     """
 
Signature · 1 line
2.43.0
#44 lore raw

PATCH v3 2/7 dts: enforce one dpdk build per test run

In reply to Luca Vizzarro

From: Tomáš Ďurovec <[email protected]>

Given a pre-built DPDK repository can be supplied to DTS, there is no need to define multiple build targets. To simplify the process this change makes each test run use only one DPDK build whether it's pre-built or it needs to be built by DTS.

---
 dts/conf.yaml                              |  14 +--
 dts/framework/config/__init__.py           |   9 +-
 dts/framework/config/conf_yaml_schema.json |  10 +-
 dts/framework/config/types.py              |   2 +-
 dts/framework/logger.py                    |   4 -
 dts/framework/runner.py                    | 117 +++++---------------
 dts/framework/test_result.py               | 119 ++++++---------------
 dts/framework/test_suite.py                |   2 +-
 dts/framework/testbed_model/sut_node.py    |   6 +-
 dts/tests/TestSuite_smoke_tests.py         |   2 +-
 10 files changed, 80 insertions(+), 205 deletions(-)
dts/conf.yaml +7 -7
index 1363e93580..814744a1fc 100644
@@ -4,13 +4,13 @@
 
 test_runs:
   # define one test run environment
-  - dpdk_builds:
-      - arch: x86_64
-        os: linux
-        cpu: native
-        # the combination of the following two makes CC="ccache gcc"
-        compiler: gcc
-        compiler_wrapper: ccache
+  - dpdk_build:
+      arch: x86_64
+      os: linux
+      cpu: native
+      # the combination of the following two makes CC="ccache gcc"
+      compiler: gcc
+      compiler_wrapper: ccache
     perf: false # disable performance testing
     func: true # enable functional testing
     skip_smoke_tests: false # optional
dts/framework/config/__init__.py +3 -6
index c243716010..49b2e8d016 100644
@@ -437,7 +437,7 @@ class TestRunConfiguration:
     and with what DPDK build.
 
     Attributes:
-        dpdk_builds: A list of DPDK builds to test.
+        dpdk_build: A DPDK build to test.
         perf: Whether to run performance tests.
         func: Whether to run functional tests.
         skip_smoke_tests: Whether to skip smoke tests.
@@ -448,7 +448,7 @@ class TestRunConfiguration:
         random_seed: The seed to use for pseudo-random generation.
     """
 
-    dpdk_builds: list[DPDKBuildConfiguration]
+    dpdk_build: DPDKBuildConfiguration
     perf: bool
     func: bool
     skip_smoke_tests: bool
@@ -477,9 +477,6 @@ def from_dict(
         Returns:
             The test run configuration instance.
         """
-        dpdk_builds: list[DPDKBuildConfiguration] = list(
-            map(DPDKBuildConfiguration.from_dict, d["dpdk_builds"])
-        )
         test_suites: list[TestSuiteConfig] = list(map(TestSuiteConfig.from_dict, d["test_suites"]))
         sut_name = d["system_under_test_node"]["node_name"]
         skip_smoke_tests = d.get("skip_smoke_tests", False)
@@ -501,7 +498,7 @@ def from_dict(
         )
         random_seed = d.get("random_seed", None)
         return cls(
-            dpdk_builds=dpdk_builds,
+            dpdk_build=DPDKBuildConfiguration.from_dict(d["dpdk_build"]),
             perf=d["perf"],
             func=d["func"],
             skip_smoke_tests=skip_smoke_tests,
dts/framework/config/conf_yaml_schema.json +3 -7
index 927a73ac6c..94d7efa5f5 100644
@@ -327,12 +327,8 @@
       "items": {
         "type": "object",
         "properties": {
-          "dpdk_builds": {
-            "type": "array",
-            "items": {
-              "$ref": "#/definitions/dpdk_build"
-            },
-            "minimum": 1
+          "dpdk_build": {
+            "$ref": "#/definitions/dpdk_build"
           },
           "perf": {
             "type": "boolean",
@@ -387,7 +383,7 @@
         },
         "additionalProperties": false,
         "required": [
-          "dpdk_builds",
+          "dpdk_build",
           "perf",
           "func",
           "test_suites",
dts/framework/config/types.py +1 -1
index 4f450267d1..a710c20d6a 100644
@@ -108,7 +108,7 @@ class TestRunConfigDict(TypedDict):
     """Allowed keys and values."""
 
     #:
-    dpdk_builds: list[DPDKBuildConfigDict]
+    dpdk_build: DPDKBuildConfigDict
     #:
     perf: bool
     #:
dts/framework/logger.py +0 -4
index 3fbe618219..d2b8e37da4 100644
@@ -33,16 +33,12 @@ class DtsStage(StrEnum):
     #:
     test_run_setup = auto()
     #:
-    dpdk_build_setup = auto()
-    #:
     test_suite_setup = auto()
     #:
     test_suite = auto()
     #:
     test_suite_teardown = auto()
     #:
-    dpdk_build_teardown = auto()
-    #:
     test_run_teardown = auto()
     #:
     post_run = auto()
dts/framework/runner.py +26 -91

212 lines not on this page · raw message

dts/framework/test_result.py +34 -85

201 lines not on this page · raw message

dts/framework/test_suite.py +1 -1
index 9e08339ada..cbe3b30ffc 100644
@@ -71,7 +71,7 @@ class TestSuite(TestProtocol):
     sut_node: SutNode
     tg_node: TGNode
     #: Whether the test suite is blocking. A failure of a blocking test suite
-    #: will block the execution of all subsequent test suites in the current DPDK build.
+    #: will block the execution of all subsequent test suites in the current test run.
     is_blocking: ClassVar[bool] = False
     _logger: DTSLogger
     _sut_port_ingress: Port
dts/framework/testbed_model/sut_node.py +4 -2
index 616da1663d..0eac12098f 100644
@@ -181,13 +181,15 @@ def set_up_test_run(self, test_run_config: TestRunConfiguration) -> None:
         super().set_up_test_run(test_run_config)
         for vdev in test_run_config.vdevs:
             self.virtual_devices.append(VirtualDevice(vdev))
+        self._set_up_dpdk(test_run_config.dpdk_build)
 
     def tear_down_test_run(self) -> None:
         """Extend the test run teardown with virtual device teardown."""
         super().tear_down_test_run()
         self.virtual_devices = []
+        self._tear_down_dpdk()
 
-    def set_up_dpdk(self, dpdk_build_config: DPDKBuildConfiguration) -> None:
+    def _set_up_dpdk(self, dpdk_build_config: DPDKBuildConfiguration) -> None:
         """Set up DPDK the SUT node and bind ports.
 
         DPDK setup includes setting all internals needed for the build, the copying of DPDK tarball
@@ -202,7 +204,7 @@ def set_up_dpdk(self, dpdk_build_config: DPDKBuildConfiguration) -> None:
         self._build_dpdk()
         self.bind_ports_to_driver()
 
-    def tear_down_dpdk(self) -> None:
+    def _tear_down_dpdk(self) -> None:
         """Reset DPDK variables and bind port driver to the OS driver."""
         self._env_vars = {}
         self._dpdk_build_config = None
dts/tests/TestSuite_smoke_tests.py +1 -1
index 9822240b5b..d7870bd40f 100644
@@ -31,7 +31,7 @@ class TestSmokeTests(TestSuite):
 
     Attributes:
         is_blocking: This test suite will block the execution of all other test suites
-            in the DPDK build after it.
+            in the test run after it.
         nics_in_node: The NICs present on the SUT node.
     """
 
Signature · 1 line
2.43.0
#45 lore raw

PATCH v3 3/7 dts: change remote and local paths objects

In reply to Luca Vizzarro

From: Tomáš Ďurovec <[email protected]>

The OSSession (and its subclasses) should accept PurePaths for remote paths to translate from OS-unaware (PurePath) to OS-aware (Path) only on the remote side. For local paths, they should accept Paths, as Python is OS-aware locally.

---
 .../remote_session/remote_session.py          | 24 ++++++----------
 dts/framework/remote_session/ssh_session.py   | 18 ++++--------
 dts/framework/testbed_model/os_session.py     | 28 ++++++++-----------
 dts/framework/testbed_model/posix_session.py  | 18 ++++--------
 4 files changed, 30 insertions(+), 58 deletions(-)
dts/framework/remote_session/remote_session.py +9 -15
index 8c580b070f..ab83f5b266 100644
@@ -12,7 +12,7 @@
 
 from abc import ABC, abstractmethod
 from dataclasses import InitVar, dataclass, field
-from pathlib import PurePath
+from pathlib import Path, PurePath
 
 from framework.config import NodeConfiguration
 from framework.exception import RemoteCommandExecutionError
@@ -196,35 +196,29 @@ def is_alive(self) -> bool:
         """Check whether the remote session is still responding."""
 
     @abstractmethod
-    def copy_from(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_from(self, source_file: str | PurePath, destination_dir: str | Path) -> None:
         """Copy a file from the remote Node to the local filesystem.
 
         Copy `source_file` from the remote Node associated with this remote session
-        to `destination_file` on the local filesystem.
+        to `destination_dir` on the local filesystem.
 
         Args:
             source_file: The file on the remote Node.
-            destination_file: A file or directory path on the local filesystem.
+            destination_dir: The directory path on the local filesystem where the `source_file`
+                will be saved.
         """
 
     @abstractmethod
-    def copy_to(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_to(self, source_file: str | Path, destination_dir: str | PurePath) -> None:
         """Copy a file from local filesystem to the remote Node.
 
-        Copy `source_file` from local filesystem to `destination_file` on the remote Node
+        Copy `source_file` from local filesystem to `destination_dir` on the remote Node
         associated with this remote session.
 
         Args:
             source_file: The file on the local filesystem.
-            destination_file: A file or directory path on the remote Node.
+            destination_dir: The directory path on the remote Node where the `source_file`
+                will be saved.
         """
 
     @abstractmethod
dts/framework/remote_session/ssh_session.py +5 -13
index 66f8176833..329121913f 100644
@@ -5,7 +5,7 @@
 
 import socket
 import traceback
-from pathlib import PurePath
+from pathlib import Path, PurePath
 
 from fabric import Connection  # type: ignore[import-untyped]
 from invoke.exceptions import (  # type: ignore[import-untyped]
@@ -103,21 +103,13 @@ def is_alive(self) -> bool:
         """Overrides :meth:`~.remote_session.RemoteSession.is_alive`."""
         return self.session.is_connected
 
-    def copy_from(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_from(self, source_file: str | PurePath, destination_dir: str | Path) -> None:
         """Overrides :meth:`~.remote_session.RemoteSession.copy_from`."""
-        self.session.get(str(destination_file), str(source_file))
+        self.session.get(str(source_file), str(destination_dir))
 
-    def copy_to(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_to(self, source_file: str | Path, destination_dir: str | PurePath) -> None:
         """Overrides :meth:`~.remote_session.RemoteSession.copy_to`."""
-        self.session.put(str(source_file), str(destination_file))
+        self.session.put(str(source_file), str(destination_dir))
 
     def close(self) -> None:
         """Overrides :meth:`~.remote_session.RemoteSession.close`."""
dts/framework/testbed_model/os_session.py +11 -17
index 79f56b289b..1aac3659bf 100644
@@ -25,7 +25,7 @@
 from abc import ABC, abstractmethod
 from collections.abc import Iterable
 from ipaddress import IPv4Interface, IPv6Interface
-from pathlib import PurePath
+from pathlib import Path, PurePath
 from typing import Union
 
 from framework.config import Architecture, NodeConfiguration, NodeInfo
@@ -178,35 +178,29 @@ def join_remote_path(self, *args: str | PurePath) -> PurePath:
         """
 
     @abstractmethod
-    def copy_from(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_from(self, source_file: str | PurePath, destination_dir: str | Path) -> None:
         """Copy a file from the remote node to the local filesystem.
 
         Copy `source_file` from the remote node associated with this remote
-        session to `destination_file` on the local filesystem.
+        session to `destination_dir` on the local filesystem.
 
         Args:
-            source_file: the file on the remote node.
-            destination_file: a file or directory path on the local filesystem.
+            source_file: The file on the remote node.
+            destination_dir: The directory path on the local filesystem where the `source_file`
+                will be saved.
         """
 
     @abstractmethod
-    def copy_to(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_to(self, source_file: str | Path, destination_dir: str | PurePath) -> None:
         """Copy a file from local filesystem to the remote node.
 
-        Copy `source_file` from local filesystem to `destination_file`
+        Copy `source_file` from local filesystem to `destination_dir`
         on the remote node associated with this remote session.
 
         Args:
-            source_file: the file on the local filesystem.
-            destination_file: a file or directory path on the remote node.
+            source_file: The file on the local filesystem.
+            destination_dir: The directory path on the remote Node where the `source_file`
+                will be saved.
         """
 
     @abstractmethod
dts/framework/testbed_model/posix_session.py +5 -13
index d279bb8b53..2449c0ab35 100644
@@ -13,7 +13,7 @@
 
 import re
 from collections.abc import Iterable
-from pathlib import PurePath, PurePosixPath
+from pathlib import Path, PurePath, PurePosixPath
 
 from framework.config import Architecture, NodeInfo
 from framework.exception import DPDKBuildError, RemoteCommandExecutionError
@@ -85,21 +85,13 @@ def join_remote_path(self, *args: str | PurePath) -> PurePosixPath:
         """Overrides :meth:`~.os_session.OSSession.join_remote_path`."""
         return PurePosixPath(*args)
 
-    def copy_from(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    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_file)
+        self.remote_session.copy_from(source_file, destination_dir)
 
-    def copy_to(
-        self,
-        source_file: str | PurePath,
-        destination_file: str | PurePath,
-    ) -> None:
+    def copy_to(self, source_file: str | Path, destination_dir: str | PurePath) -> None:
         """Overrides :meth:`~.os_session.OSSession.copy_to`."""
-        self.remote_session.copy_to(source_file, destination_file)
+        self.remote_session.copy_to(source_file, destination_dir)
 
     def remove_remote_dir(
         self,
Signature · 1 line
2.43.0
Reviewed-by on v3 3/7
#46 lore raw

Re: [PATCH v3 3/7] dts: change remote and local paths objects

Quoted 10 lines · Luca Vizzarro

From: Tomáš Ďurovec <[email protected]>

The OSSession (and its subclasses) should accept PurePaths for remote paths to translate from OS-unaware (PurePath) to OS-aware (Path) only on the remote side. For local paths, they should accept Paths, as Python is OS-aware locally.

#48 lore raw

PATCH v3 4/7 dts: enable copying directories to and from nodes

In reply to Luca Vizzarro

From: Tomáš Ďurovec <[email protected]>

Currently there is no support to transfer whole directories between the DTS host and the nodes. This change adds this new feature.

---
 dts/framework/testbed_model/os_session.py    | 120 ++++++++++++++++++-
 dts/framework/testbed_model/posix_session.py |  88 +++++++++++++-
 dts/framework/utils.py                       |  91 +++++++++++++-
 3 files changed, 287 insertions(+), 12 deletions(-)
dts/framework/testbed_model/os_session.py +116 -4
index 1aac3659bf..6c3f84dec1 100644
@@ -25,7 +25,7 @@
 from abc import ABC, abstractmethod
 from collections.abc import Iterable
 from ipaddress import IPv4Interface, IPv6Interface
-from pathlib import Path, PurePath
+from pathlib import Path, PurePath, PurePosixPath
 from typing import Union
 
 from framework.config import Architecture, NodeConfiguration, NodeInfo
@@ -38,7 +38,7 @@
 )
 from framework.remote_session.remote_session import CommandResult
 from framework.settings import SETTINGS
-from framework.utils import MesonArgs
+from framework.utils import MesonArgs, TarCompressionFormat
 
 from .cpu import LogicalCore
 from .port import Port
@@ -203,6 +203,95 @@ def copy_to(self, source_file: str | Path, destination_dir: str | PurePath) -> N
                 will be saved.
         """
 
+    @abstractmethod
+    def copy_dir_from(
+        self,
+        source_dir: str | PurePath,
+        destination_dir: str | Path,
+        compress_format: TarCompressionFormat = TarCompressionFormat.none,
+        exclude: str | list[str] | None = None,
+    ) -> None:
+        """Copy a directory from the remote node to the local filesystem.
+
+        Copy `source_dir` from the remote node associated with this remote session to
+        `destination_dir` on the local filesystem. The new local directory will be created
+        at `destination_dir` path.
+
+        Example:
+            source_dir = '/remote/path/to/source'
+            destination_dir = '/local/path/to/destination'
+            compress_format = TarCompressionFormat.xz
+
+            The method will:
+                1. Create a tarball from `source_dir`, resulting in:
+                    '/remote/path/to/source.tar.xz',
+                2. Copy '/remote/path/to/source.tar.xz' to
+                    '/local/path/to/destination/source.tar.xz',
+                3. Extract the contents of the tarball, resulting in:
+                    '/local/path/to/destination/source/',
+                4. Remove the tarball after extraction
+                    ('/local/path/to/destination/source.tar.xz').
+
+            Final Path Structure:
+                '/local/path/to/destination/source/'
+
+        Args:
+            source_dir: The directory on the remote node.
+            destination_dir: The directory path on the local filesystem.
+            compress_format: The compression format to use. Defaults to no compression.
+            exclude: Patterns for files or directories to exclude from the tarball.
+                These patterns are used with `tar`'s `--exclude` option.
+        """
+
+    @abstractmethod
+    def copy_dir_to(
+        self,
+        source_dir: str | Path,
+        destination_dir: str | PurePath,
+        compress_format: TarCompressionFormat = TarCompressionFormat.none,
+        exclude: str | list[str] | None = None,
+    ) -> None:
+        """Copy a directory from the local filesystem to the remote node.
+
+        Copy `source_dir` from the local filesystem to `destination_dir` on the remote node
+        associated with this remote session. The new remote directory will be created at
+        `destination_dir` path.
+
+        Example:
+            source_dir = '/local/path/to/source'
+            destination_dir = '/remote/path/to/destination'
+            compress_format = TarCompressionFormat.xz
+
+            The method will:
+                1. Create a tarball from `source_dir`, resulting in:
+                    '/local/path/to/source.tar.xz',
+                2. Copy '/local/path/to/source.tar.xz' to
+                    '/remote/path/to/destination/source.tar.xz',
+                3. Extract the contents of the tarball, resulting in:
+                    '/remote/path/to/destination/source/',
+                4. Remove the tarball after extraction
+                    ('/remote/path/to/destination/source.tar.xz').
+
+            Final Path Structure:
+                '/remote/path/to/destination/source/'
+
+        Args:
+            source_dir: The directory on the local filesystem.
+            destination_dir: The directory path on the remote node.
+            compress_format: The compression format to use. Defaults to no compression.
+            exclude: Patterns for files or directories to exclude from the tarball.
+                These patterns are used with `fnmatch.fnmatch` to filter out files.
+        """
+
+    @abstractmethod
+    def remove_remote_file(self, remote_file_path: str | PurePath, force: bool = True) -> None:
+        """Remove remote file, by default remove forcefully.
+
+        Args:
+            remote_file_path: The file path to remove.
+            force: If :data:`True`, ignore all warnings and try to remove at all costs.
+        """
+
     @abstractmethod
     def remove_remote_dir(
         self,
@@ -213,11 +302,34 @@ def remove_remote_dir(
         """Remove remote directory, by default remove recursively and forcefully.
 
         Args:
-            remote_dir_path: The path of the directory to remove.
+            remote_dir_path: The directory path to remove.
             recursive: If :data:`True`, also remove all contents inside the directory.
             force: If :data:`True`, ignore all warnings and try to remove at all costs.
         """
 
+    @abstractmethod
+    def create_remote_tarball(
+        self,
+        remote_dir_path: str | PurePath,
+        compress_format: TarCompressionFormat = TarCompressionFormat.none,
+        exclude: str | list[str] | None = None,
+    ) -> PurePosixPath:
+        """Create a tarball from the contents of the specified remote directory.
+
+        This method creates a tarball containing all files and directories
+        within `remote_dir_path`. The tarball will be saved in the directory of
+        `remote_dir_path` and will be named based on `remote_dir_path`.
+
+        Args:
+            remote_dir_path: The directory path on the remote node.
+            compress_format: The compression format to use. Defaults to no compression.
+            exclude: Patterns for files or directories to exclude from the tarball.
+                These patterns are used with `tar`'s `--exclude` option.
+
+        Returns:
+            The path to the created tarball on the remote node.
+        """
+
     @abstractmethod
     def extract_remote_tarball(
         self,
@@ -227,7 +339,7 @@ def extract_remote_tarball(
         """Extract remote tarball in its remote directory.
 
         Args:
-            remote_tarball_path: The path of the tarball on the remote node.
+            remote_tarball_path: The tarball path on the remote node.
             expected_dir: If non-empty, check whether `expected_dir` exists after extracting
                 the archive.
         """
dts/framework/testbed_model/posix_session.py +84 -4

107 lines not on this page · raw message

dts/framework/utils.py +87 -4

146 lines not on this page · raw message

Signature · 1 line
2.43.0
#49 lore raw

PATCH v3 5/7 dts: add support for externally compiled DPDK

In reply to Luca Vizzarro

From: Tomáš Ďurovec <[email protected]>

Enable the user to use either a DPDK source tree directory or a tarball, with and without a pre-built build directory. These can be stored on either SUT node or the DTS host. The DPDK build setup or the pre-built binaries can be specified through the configuration file, the command line arguments or environment variables.

---
 dts/conf.yaml                                |  24 +-
 dts/framework/config/__init__.py             | 123 ++++++-
 dts/framework/config/conf_yaml_schema.json   |  62 +++-
 dts/framework/config/types.py                |  17 +-
 dts/framework/exception.py                   |   4 +-
 dts/framework/remote_session/dpdk_shell.py   |   2 +-
 dts/framework/runner.py                      |   8 +-
 dts/framework/settings.py                    | 200 +++++++++--
 dts/framework/test_result.py                 |  23 +-
 dts/framework/testbed_model/node.py          |  22 +-
 dts/framework/testbed_model/os_session.py    |  63 +++-
 dts/framework/testbed_model/posix_session.py |  39 ++-
 dts/framework/testbed_model/sut_node.py      | 351 +++++++++++++------
 13 files changed, 732 insertions(+), 206 deletions(-)
dts/conf.yaml +18 -6
index 814744a1fc..8a65a481d6 100644
@@ -5,12 +5,24 @@
 test_runs:
   # define one test run environment
   - dpdk_build:
-      arch: x86_64
-      os: linux
-      cpu: native
-      # the combination of the following two makes CC="ccache gcc"
-      compiler: gcc
-      compiler_wrapper: ccache
+      # dpdk_tree: Commented out because `tarball` is defined.
+      tarball: dpdk-tarball.tar.xz
+      # Either `dpdk_tree` or `tarball` can be defined, but not both.
+      remote: false # Optional, defaults to false. If it's true, the `dpdk_tree` or `tarball`
+                    # is located on the SUT node, instead of the execution host.
+
+      # precompiled_build_dir: Commented out because `build_options` is defined.
+      build_options:
+        arch: x86_64
+        os: linux
+        cpu: native
+        # the combination of the following two makes CC="ccache gcc"
+        compiler: gcc
+        compiler_wrapper: ccache # Optional.
+      # If `precompiled_build_dir` is defined, DPDK has been pre-built and the build directory is
+      # in a subdirectory of DPDK tree root directory. Otherwise, will be using the `build_options`
+      # to build the DPDK from source. Either `precompiled_build_dir` or `build_options` can be
+      # defined, but not both.
     perf: false # disable performance testing
     func: true # enable functional testing
     skip_smoke_tests: false # optional
dts/framework/config/__init__.py +118 -5

165 lines not on this page · raw message

dts/framework/config/conf_yaml_schema.json +59 -3

81 lines not on this page · raw message

dts/framework/config/types.py +16 -1
index a710c20d6a..02e738a61e 100644
@@ -86,6 +86,21 @@ class DPDKBuildConfigDict(TypedDict):
     compiler_wrapper: str
 
 
+class DPDKConfigurationDict(TypedDict):
+    """Allowed keys and values."""
+
+    #:
+    dpdk_tree: str | None
+    #:
+    tarball: str | None
+    #:
+    remote: bool
+    #:
+    precompiled_build_dir: str | None
+    #:
+    build_options: DPDKBuildConfigDict
+
+
 class TestSuiteConfigDict(TypedDict):
     """Allowed keys and values."""
 
@@ -108,7 +123,7 @@ class TestRunConfigDict(TypedDict):
     """Allowed keys and values."""
 
     #:
-    dpdk_build: DPDKBuildConfigDict
+    dpdk_build: DPDKConfigurationDict
     #:
     perf: bool
     #:
dts/framework/exception.py +2 -2
index f45f789825..d967ede09b 100644
@@ -184,8 +184,8 @@ class InteractiveCommandExecutionError(DTSError):
     severity: ClassVar[ErrorSeverity] = ErrorSeverity.REMOTE_CMD_EXEC_ERR
 
 
-class RemoteDirectoryExistsError(DTSError):
-    """A directory that exists on a remote node."""
+class RemoteFileNotFoundError(DTSError):
+    """A remote file or directory is requested but doesn’t exist."""
 
     #:
     severity: ClassVar[ErrorSeverity] = ErrorSeverity.REMOTE_CMD_EXEC_ERR
dts/framework/remote_session/dpdk_shell.py +1 -1
index c5f5c2d116..b39132cc42 100644
@@ -104,4 +104,4 @@ def _update_real_path(self, path: PurePath) -> None:
 
         Adds the remote DPDK build directory to the path.
         """
-        super()._update_real_path(self._node.remote_dpdk_build_dir.joinpath(path))
+        super()._update_real_path(PurePath(self._node.remote_dpdk_build_dir).joinpath(path))
dts/framework/runner.py +6 -2
index 55cb16df73..8bbe698eaf 100644
@@ -364,15 +364,19 @@ def _run_test_run(
             test_run_config: A test run configuration.
             test_run_result: The test run's result.
             test_suites_with_cases: The test suites with test cases to run.
+
+        Raises:
+            ConfigurationError: If the DPDK sources or build is not set up from config or settings.
         """
         self._logger.info(
             f"Running test run with SUT '{test_run_config.system_under_test_node.name}'."
         )
         test_run_result.add_sut_info(sut_node.node_info)
         try:
-            sut_node.set_up_test_run(test_run_config)
+            dpdk_location = SETTINGS.dpdk_location or test_run_config.dpdk_config.dpdk_location
+            sut_node.set_up_test_run(test_run_config, dpdk_location)
             test_run_result.add_dpdk_build_info(sut_node.get_dpdk_build_info())
-            tg_node.set_up_test_run(test_run_config)
+            tg_node.set_up_test_run(test_run_config, dpdk_location)
             test_run_result.update_setup(Result.PASS)
         except Exception as e:
             self._logger.exception("Test run setup failed.")
dts/framework/settings.py +170 -30

279 lines not on this page · raw message

dts/framework/test_result.py +1 -22
index eb199ff6c9..00263ad69e 100644
@@ -30,16 +30,7 @@
 
 from framework.testbed_model.capability import Capability
 
-from .config import (
-    OS,
-    Architecture,
-    Compiler,
-    CPUType,
-    DPDKBuildInfo,
-    NodeInfo,
-    TestRunConfiguration,
-    TestSuiteConfig,
-)
+from .config import DPDKBuildInfo, NodeInfo, TestRunConfiguration, TestSuiteConfig
 from .exception import DTSError, ErrorSeverity
 from .logger import DTSLogger
 from .settings import SETTINGS
@@ -365,10 +356,6 @@ class TestRunResult(BaseResult):
     The internal list stores the results of all test suites in a given test run.
 
     Attributes:
-        arch: The DPDK build architecture.
-        os: The DPDK build operating system.
-        cpu: The DPDK build CPU.
-        compiler: The DPDK build compiler.
         compiler_version: The DPDK build compiler version.
         dpdk_version: The built DPDK version.
         sut_os_name: The operating system of the SUT node.
@@ -376,10 +363,6 @@ class TestRunResult(BaseResult):
         sut_kernel_version: The operating system kernel version of the SUT node.
     """
 
-    arch: Architecture
-    os: OS
-    cpu: CPUType
-    compiler: Compiler
     compiler_version: str | None
     dpdk_version: str | None
     sut_os_name: str
@@ -395,10 +378,6 @@ def __init__(self, test_run_config: TestRunConfiguration):
             test_run_config: A test run configuration.
         """
         super().__init__()
-        self.arch = test_run_config.dpdk_build.arch
-        self.os = test_run_config.dpdk_build.os
-        self.cpu = test_run_config.dpdk_build.cpu
-        self.compiler = test_run_config.dpdk_build.compiler
         self.compiler_version = None
         self.dpdk_version = None
         self._config = test_run_config
dts/framework/testbed_model/node.py +6 -16
index 51443cd71f..62867fd80c 100644
@@ -15,12 +15,11 @@
 
 from abc import ABC
 from ipaddress import IPv4Interface, IPv6Interface
-from typing import Any, Callable, Union
+from typing import Union
 
-from framework.config import OS, NodeConfiguration, TestRunConfiguration
+from framework.config import OS, DPDKLocation, NodeConfiguration, TestRunConfiguration
 from framework.exception import ConfigurationError
 from framework.logger import DTSLogger, get_dts_logger
-from framework.settings import SETTINGS
 
 from .cpu import (
     LogicalCore,
@@ -95,7 +94,9 @@ def _init_ports(self) -> None:
         for port in self.ports:
             self.configure_port_state(port)
 
-    def set_up_test_run(self, test_run_config: TestRunConfiguration) -> None:
+    def set_up_test_run(
+        self, test_run_config: TestRunConfiguration, dpdk_location: DPDKLocation
+    ) -> None:
         """Test run setup steps.
 
         Configure hugepages on all DTS node types. Additional steps can be added by
@@ -104,6 +105,7 @@ def set_up_test_run(self, test_run_config: TestRunConfiguration) -> None:
         Args:
             test_run_config: A test run configuration according to which
                 the setup steps will be taken.
+            dpdk_location: The target source of the DPDK tree.
         """
         self._setup_hugepages()
 
@@ -216,18 +218,6 @@ def close(self) -> None:
         for session in self._other_sessions:
             session.close()
 
-    @staticmethod
-    def skip_setup(func: Callable[..., Any]) -> Callable[..., Any]:
-        """Skip the decorated function.
-
-        The :option:`--skip-setup` command line argument and the :envvar:`DTS_SKIP_SETUP`
-        environment variable enable the decorator.
-        """
-        if SETTINGS.skip_setup:
-            return lambda *args: None
-        else:
-            return func
-
 
 def create_session(node_config: NodeConfiguration, name: str, logger: DTSLogger) -> OSSession:
     """Factory for OS-aware sessions.
dts/framework/testbed_model/os_session.py +52 -11

81 lines not on this page · raw message

dts/framework/testbed_model/posix_session.py +33 -6
index 94e721da61..5ab7c18fb7 100644
@@ -91,6 +91,11 @@ def join_remote_path(self, *args: str | PurePath) -> PurePosixPath:
         """Overrides :meth:`~.os_session.OSSession.join_remote_path`."""
         return PurePosixPath(*args)
 
+    def remote_path_exists(self, remote_path: str | PurePath) -> bool:
+        """Overrides :meth:`~.os_session.OSSession.remote_path_exists`."""
+        result = self.send_command(f"test -e {remote_path}")
+        return not result.return_code
+
     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)
@@ -196,6 +201,32 @@ def extract_remote_tarball(
         if expected_dir:
             self.send_command(f"ls {expected_dir}", verify=True)
 
+    def is_remote_dir(self, remote_path: str) -> bool:
+        """Overrides :meth:`~.os_session.OSSession.is_remote_dir`."""
+        result = self.send_command(f"test -d {remote_path}")
+        return not result.return_code
+
+    def is_remote_tarfile(self, remote_tarball_path: str) -> bool:
+        """Overrides :meth:`~.os_session.OSSession.is_remote_tarfile`."""
+        result = self.send_command(f"tar -tvf {remote_tarball_path}")
+        return not result.return_code
+
+    def get_tarball_top_dir(
+        self, remote_tarball_path: str | PurePath
+    ) -> str | PurePosixPath | None:
+        """Overrides :meth:`~.os_session.OSSession.get_tarball_top_dir`."""
+        members = self.send_command(f"tar tf {remote_tarball_path}").stdout.split()
+
+        top_dirs = []
+        for member in members:
+            parts_of_member = PurePosixPath(member).parts
+            if parts_of_member:
+                top_dirs.append(parts_of_member[0])
+
+        if len(set(top_dirs)) == 1:
+            return top_dirs[0]
+        return None
+
     def build_dpdk(
         self,
         env_vars: dict,
@@ -301,7 +332,7 @@ def _get_dpdk_pids(self, dpdk_runtime_dirs: Iterable[str | PurePath]) -> list[in
         pid_regex = r"p(\d+)"
         for dpdk_runtime_dir in dpdk_runtime_dirs:
             dpdk_config_file = PurePosixPath(dpdk_runtime_dir, "config")
-            if self._remote_files_exists(dpdk_config_file):
+            if self.remote_path_exists(dpdk_config_file):
                 out = self.send_command(f"lsof -Fp {dpdk_config_file}").stdout
                 if out and "No such file or directory" not in out:
                     for out_line in out.splitlines():
@@ -310,10 +341,6 @@ def _get_dpdk_pids(self, dpdk_runtime_dirs: Iterable[str | PurePath]) -> list[in
                             pids.append(int(match.group(1)))
         return pids
 
-    def _remote_files_exists(self, remote_path: PurePath) -> bool:
-        result = self.send_command(f"test -e {remote_path}")
-        return not result.return_code
-
     def _check_dpdk_hugepages(self, dpdk_runtime_dirs: Iterable[str | PurePath]) -> None:
         """Check there aren't any leftover hugepages.
 
@@ -325,7 +352,7 @@ def _check_dpdk_hugepages(self, dpdk_runtime_dirs: Iterable[str | PurePath]) ->
         """
         for dpdk_runtime_dir in dpdk_runtime_dirs:
             hugepage_info = PurePosixPath(dpdk_runtime_dir, "hugepage_info")
-            if self._remote_files_exists(hugepage_info):
+            if self.remote_path_exists(hugepage_info):
                 out = self.send_command(f"lsof -Fp {hugepage_info}").stdout
                 if out and "No such file or directory" not in out:
                     self._logger.warning("Some DPDK processes did not free hugepages.")
dts/framework/testbed_model/sut_node.py +250 -101

497 lines not on this page · raw message

Signature · 1 line
2.43.0
#50 lore raw

PATCH v3 6/7 doc: update argument options for external DPDK build

In reply to Luca Vizzarro

From: Tomáš Ďurovec <[email protected]>

By adding support for external build, we extend the argument documentation for supported options.

---
 doc/guides/tools/dts.rst | 75 ++++++++++++++++++++++++----------------
 1 file changed, 45 insertions(+), 30 deletions(-)
doc/guides/tools/dts.rst +45 -30
index 65cce9e5ed..7b90c4856e 100644
@@ -195,10 +195,10 @@ Running DTS
 -----------
 
 DTS needs to know which nodes to connect to and what hardware to use on those nodes.
-Once that's configured, either a DPDK source code tarball or a Git revision ID
-of choice needs to be supplied.
-DTS will use this to compile DPDK on the SUT node
-and then run the tests with the newly built binaries.
+Once that's configured, either a DPDK source code tarball or tree folder need to be supplied whether
+these are on your DTS host machine or the SUT node.
+DTS can accept a pre-compiled build placed in a subdirectory, or it will compile DPDK on the SUT
+node, and then run the tests with the newly built binaries.
 
 
 Configuring DTS
@@ -221,44 +221,59 @@ DTS is run with ``main.py`` located in the ``dts`` directory after entering Poet
 .. code-block:: console
 
    (dts-py3.10) $ ./main.py --help
-   usage: main.py [-h] [--config-file FILE_PATH] [--output-dir DIR_PATH] [-t SECONDS] [-v] [-s] (--tarball FILE_PATH | --revision ID)
-                  [--compile-timeout SECONDS] [--test-suite TEST_SUITE [TEST_CASES ...]] [--re-run N_TIMES]
+   usage: main.py [-h] [--config-file FILE_PATH] [--output-dir DIR_PATH] [-t SECONDS] [-v] [--dpdk-tree DIR_PATH | --tarball FILE_PATH] [--remote-source]
+                  [--precompiled-build-dir DIR_NAME] [--compile-timeout SECONDS] [--test-suite TEST_SUITE [TEST_CASES ...]] [--re-run N_TIMES]
+                  [--random-seed NUMBER]
 
-   Run DPDK test suites. All options may be specified with the environment variables provided in brackets. Command line arguments have higher
-   priority.
+   Run DPDK test suites. All options may be specified with the environment variables provided in brackets. Command line arguments have higher priority.
 
    options:
-     -h, --help            show this help message and exit
-     --config-file FILE_PATH
-                           [DTS_CFG_FILE] The configuration file that describes the test cases, SUTs and targets. (default: conf.yaml)
-     --output-dir DIR_PATH, --output DIR_PATH
+   -h, --help            show this help message and exit
+   --config-file FILE_PATH
+                           [DTS_CFG_FILE] The configuration file that describes the test cases, SUTs and DPDK build configs. (default:
+                           /home/lucviz01/dpdk/dts/conf.yaml)
+   --output-dir DIR_PATH, --output DIR_PATH
                            [DTS_OUTPUT_DIR] Output directory where DTS logs and results are saved. (default: output)
-     -t SECONDS, --timeout SECONDS
+   -t SECONDS, --timeout SECONDS
                            [DTS_TIMEOUT] The default timeout for all DTS operations except for compiling DPDK. (default: 15)
-     -v, --verbose         [DTS_VERBOSE] Specify to enable verbose output, logging all messages to the console. (default: False)
-     -s, --skip-setup      [DTS_SKIP_SETUP] Specify to skip all setup steps on SUT and TG nodes. (default: False)
-     --tarball FILE_PATH, --snapshot FILE_PATH
-                           [DTS_DPDK_TARBALL] Path to DPDK source code tarball to test. (default: None)
-     --revision ID, --rev ID, --git-ref ID
+   -v, --verbose           [DTS_VERBOSE] Specify to enable verbose output, logging all messages to the console. (default: False)
+   --revision ID, --rev ID, --git-ref ID
                            [DTS_DPDK_REVISION_ID] Git revision ID to test. Could be commit, tag, tree ID etc. To test local changes, first
                            commit them, then use their commit ID. (default: None)
-     --compile-timeout SECONDS
+   --compile-timeout SECONDS
                            [DTS_COMPILE_TIMEOUT] The timeout for compiling DPDK. (default: 1200)
-     --test-suite TEST_SUITE [TEST_CASES ...]
-                           [DTS_TEST_SUITES] A list containing a test suite with test cases. The first parameter is the test suite name, and
-                           the rest are test case names, which are optional. May be specified multiple times. To specify multiple test suites
-                           in the environment variable, join the lists with a comma. Examples: --test-suite suite case case --test-suite
-                           suite case ... | DTS_TEST_SUITES='suite case case, suite case, ...' | --test-suite suite --test-suite suite case
-                           ... | DTS_TEST_SUITES='suite, suite case, ...' (default: [])
-     --re-run N_TIMES, --re_run N_TIMES
+   --test-suite TEST_SUITE [TEST_CASES ...]
+                           [DTS_TEST_SUITES] A list containing a test suite with test cases. The first parameter is the test suite name, and the rest are
+                           test case names, which are optional. May be specified multiple times. To specify multiple test suites in the environment
+                           variable, join the lists with a comma. Examples: --test-suite suite case case --test-suite suite case ... |
+                           DTS_TEST_SUITES='suite case case, suite case, ...' | --test-suite suite --test-suite suite case ... | DTS_TEST_SUITES='suite,
+                           suite case, ...' (default: [])
+   --re-run N_TIMES, --re_run N_TIMES
                            [DTS_RERUN] Re-run each test case the specified number of times if a test failure occurs. (default: 0)
-     --random-seed NUMBER  [DTS_RANDOM_SEED] The seed to use with the pseudo-random generator. If not specified, the configuration value is
-                           used instead. If that's also not specified, a random seed is generated. (default: None)
+   --random-seed NUMBER  [DTS_RANDOM_SEED] The seed to use with the pseudo-random generator. If not specified, the configuration value is used instead.
+                           If that's also not specified, a random seed is generated. (default: None)
+
+   DPDK Build Options:
+   Arguments in this group (and subgroup) will be applied to a DPDKLocation when the DPDK tree, tarball or revision will be provided, other arguments
+   like remote source and build dir are optional. A DPDKLocation from settings are used instead of from config if construct successful.
+
+   --dpdk-tree DIR_PATH  [DTS_DPDK_TREE] The path to the DPDK source tree directory to test. Cannot be used in conjunction with --tarball. (default:
+                           None)
+   --tarball FILE_PATH, --snapshot FILE_PATH
+                           [DTS_DPDK_TARBALL] The path to the DPDK source tarball to test. DPDK must be contained in a folder with the same name as the
+                           tarball file. Cannot be used in conjunction with --dpdk-tree. (default: None)
+   --remote-source       [DTS_REMOTE_SOURCE] Set this option if either the DPDK source tree or tarball to be used are located on the SUT node. Can only
+                           be used with --dpdk-tree or --tarball. (default: False)
+   --precompiled-build-dir DIR_NAME
+                           [DTS_PRECOMPILED_BUILD_DIR] Define the subdirectory under the DPDK tree root directory where the pre-compiled binaries are
+                           located. If set, DTS will build DPDK under the `build` directory instead. Can only be used with --dpdk-tree or --tarball.
+                           (default: None)
 
 
 The brackets contain the names of environment variables that set the same thing.
-The minimum DTS needs is a config file and a DPDK tarball or git ref ID.
-You may pass those to DTS using the command line arguments or use the default paths.
+The minimum DTS needs is a config file and a pre-built DPDK or DPDK
+sources location which can be specified in said config file or on the
+command line or environment variables.
 
 Example command for running DTS with the template configuration and DPDK tag v23.11:
 
Signature · 1 line
2.43.0
#51 lore raw

PATCH v3 7/7 dts: remove git ref option

In reply to Luca Vizzarro

From: Tomáš Ďurovec <[email protected]>

Given the whole DPDK tree directory can now be copied to the nodes, there is no more need to use the git ref option, as the tree can be controlled directly by the user.

---
 doc/guides/tools/dts.rst  |   9 ---
 dts/framework/settings.py |  48 ++-------------
 dts/framework/utils.py    | 119 +-------------------------------------
 3 files changed, 7 insertions(+), 169 deletions(-)
doc/guides/tools/dts.rst +0 -9
index 7b90c4856e..a00d987ece 100644
@@ -237,9 +237,6 @@ DTS is run with ``main.py`` located in the ``dts`` directory after entering Poet
    -t SECONDS, --timeout SECONDS
                            [DTS_TIMEOUT] The default timeout for all DTS operations except for compiling DPDK. (default: 15)
    -v, --verbose           [DTS_VERBOSE] Specify to enable verbose output, logging all messages to the console. (default: False)
-   --revision ID, --rev ID, --git-ref ID
-                           [DTS_DPDK_REVISION_ID] Git revision ID to test. Could be commit, tag, tree ID etc. To test local changes, first
-                           commit them, then use their commit ID. (default: None)
    --compile-timeout SECONDS
                            [DTS_COMPILE_TIMEOUT] The timeout for compiling DPDK. (default: 1200)
    --test-suite TEST_SUITE [TEST_CASES ...]
@@ -275,12 +272,6 @@ The minimum DTS needs is a config file and a pre-built DPDK or DPDK
 sources location which can be specified in said config file or on the
 command line or environment variables.
 
-Example command for running DTS with the template configuration and DPDK tag v23.11:
-
-.. code-block:: console
-
-   (dts-py3.10) $ ./main.py --git-ref v23.11
-
 
 DTS Results
 ~~~~~~~~~~~
dts/framework/settings.py +6 -42

100 lines not on this page · raw message

dts/framework/utils.py +1 -118

149 lines not on this page · raw message

Signature · 1 line
2.43.0