[PATCH v1 4/5] dts: add crypto test decorator
Andrew Bailey
abailey at iol.unh.edu
Thu Jan 22 22:44:23 CET 2026
Currently, a test case is decorated to signify whether to use Scapy or
TREX. This change allows test suites that do not use a traffic generator
to avoid the overhead of initializing either one.
Signed-off-by: Andrew Bailey <abailey at iol.unh.edu>
---
dts/framework/config/test_run.py | 3 +++
dts/framework/test_suite.py | 4 +++
dts/framework/testbed_model/linux_session.py | 27 +-------------------
dts/framework/testbed_model/os_session.py | 4 ---
dts/tests/TestSuite_cryptodev_throughput.py | 16 ++++++------
5 files changed, 16 insertions(+), 38 deletions(-)
diff --git a/dts/framework/config/test_run.py b/dts/framework/config/test_run.py
index 6c292a3675..39f2c7cdf6 100644
--- a/dts/framework/config/test_run.py
+++ b/dts/framework/config/test_run.py
@@ -481,6 +481,8 @@ class TestRunConfiguration(FrozenModel):
perf: bool
#: Whether to run functional tests.
func: bool
+ #: Whether to run cryptography tests.
+ crypto: bool
#: Whether to run the testing with virtual functions instead of physical functions
use_virtual_functions: bool
#: Whether to skip smoke tests.
@@ -522,6 +524,7 @@ def filter_tests(
for tt in t.test_cases
if (tt.test_type is TestCaseType.FUNCTIONAL and self.func)
or (tt.test_type is TestCaseType.PERFORMANCE and self.perf)
+ or (tt.test_type is TestCaseType.CRYPTO and self.crypto)
),
)
for t in test_suites
diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py
index 856dae0a85..e86096cefe 100644
--- a/dts/framework/test_suite.py
+++ b/dts/framework/test_suite.py
@@ -281,6 +281,8 @@ class TestCaseType(Enum):
FUNCTIONAL = auto()
#:
PERFORMANCE = auto()
+ #:
+ CRYPTO = auto()
class TestCase(TestProtocol, Protocol[TestSuiteMethodType]):
@@ -333,6 +335,8 @@ def _decorator(func: TestSuiteMethodType) -> type[TestCase]:
func_test: Callable = TestCase.make_decorator(TestCaseType.FUNCTIONAL)
#: The decorator for performance test cases.
perf_test: Callable = TestCase.make_decorator(TestCaseType.PERFORMANCE)
+#: The decorator for cryptography test cases.
+crypto_test: Callable = TestCase.make_decorator(TestCaseType.CRYPTO)
@dataclass
diff --git a/dts/framework/testbed_model/linux_session.py b/dts/framework/testbed_model/linux_session.py
index fb6081ab37..8d678c5b5d 100644
--- a/dts/framework/testbed_model/linux_session.py
+++ b/dts/framework/testbed_model/linux_session.py
@@ -194,8 +194,7 @@ def bind_ports_to_driver(self, ports: list[Port], driver_name: str) -> None:
verify=True,
)
- if self._lshw_net_info:
- del self._lshw_net_info
+ del self._lshw_net_info
def bring_up_link(self, ports: Iterable[Port]) -> None:
"""Overrides :meth:`~.os_session.OSSession.bring_up_link`."""
@@ -225,30 +224,6 @@ def devbind_script_path(self) -> PurePath:
"""
raise InternalError("Accessed devbind script path before setup.")
- def load_vfio(self, pf_port: Port) -> None:
- """Overrides :meth:'~os_session.OSSession,load_vfio`."""
- cmd_result = self.send_command(f"lspci -nn -s {pf_port.pci}")
- device = re.search(r":([0-9a-fA-F]{4})\]", cmd_result.stdout)
- if device and device.group(1) in ["37c8", "0435", "19e2"]:
- self.send_command(
- "modprobe -r vfio_iommu_type1; modprobe -r vfio_pci",
- privileged=True,
- )
- self.send_command(
- "modprobe -r vfio_virqfd; modprobe -r vfio",
- privileged=True,
- )
- self.send_command(
- "modprobe vfio-pci disable_denylist=1 enable_sriov=1", privileged=True
- )
- self.send_command(
- "echo 1 | tee /sys/module/vfio/parameters/enable_unsafe_noiommu_mode",
- privileged=True,
- )
- else:
- self.send_command("modprobe vfio-pci")
- self.refresh_lshw()
-
def create_crypto_vfs(self, pf_port: list[Port]) -> None:
"""Overrides :meth:`~os_session.OSSession.create_crypto_vfs`.
diff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py
index 4a4fc1f34a..2eeeea6967 100644
--- a/dts/framework/testbed_model/os_session.py
+++ b/dts/framework/testbed_model/os_session.py
@@ -615,10 +615,6 @@ def configure_port_mtu(self, mtu: int, port: Port) -> None:
port: Port to set `mtu` on.
"""
- @abstractmethod
- def load_vfio(self, pf_port: Port) -> None:
- """Load the vfio module according to the device type of the given port."""
-
@abstractmethod
def create_crypto_vfs(self, pf_ports: list[Port]) -> None:
"""Creatues virtual functions for each port in 'pf_ports'.
diff --git a/dts/tests/TestSuite_cryptodev_throughput.py b/dts/tests/TestSuite_cryptodev_throughput.py
index b75b41e532..f18a051299 100644
--- a/dts/tests/TestSuite_cryptodev_throughput.py
+++ b/dts/tests/TestSuite_cryptodev_throughput.py
@@ -29,7 +29,7 @@
CryptodevResults,
)
from api.test import verify
-from framework.test_suite import BaseConfig, TestSuite, func_test
+from framework.test_suite import BaseConfig, TestSuite, crypto_test
class Config(BaseConfig):
@@ -140,7 +140,7 @@ def _verify_throughput(
result_list.append(result_dict)
return result_list
- @func_test
+ @crypto_test
def qat_cipher_then_auth_aes_cbc_encrypt(self) -> None:
"""Test throughput on crypto_qat device type with aes-cbc and sha2-256-hmac algorithms.
@@ -177,7 +177,7 @@ def qat_cipher_then_auth_aes_cbc_encrypt(self) -> None:
\nMOps was {result["mops delta"]} below baseline""",
)
- @func_test
+ @crypto_test
def qat_aead_aes_gcm_encrypt(self) -> None:
"""Test throughput on a crypto_qat device type with aes-gcm algorithm.
@@ -211,7 +211,7 @@ def qat_aead_aes_gcm_encrypt(self) -> None:
f"Gbps and MOps were {result["gbps delta"]} below baseline",
)
- @func_test
+ @crypto_test
def qat_cipher_aes_docsisbpi_decrypt(self) -> None:
"""Test throughput on a crypto_qat devtype with aes-docsibpi algorithm.
@@ -243,7 +243,7 @@ def qat_cipher_aes_docsisbpi_decrypt(self) -> None:
f"Gbps and MOps were {result["gbps delta"]} below baseline",
)
- @func_test
+ @crypto_test
def qat_cipher_aes_docsisbpi_encrypt(self) -> None:
"""Test throughput on a crypto_qat device type with aes-docsibpi algorithm.
@@ -275,7 +275,7 @@ def qat_cipher_aes_docsisbpi_encrypt(self) -> None:
f"Gbps and MOps were {result["gbps delta"]} below baseline",
)
- @func_test
+ @crypto_test
def qat_cipher_then_auth_kasumi_f8_encrypt(self) -> None:
"""Test throughput on a crypto_qat device type with kasumi-f8 and kasumi-f9 algorithms.
@@ -311,7 +311,7 @@ def qat_cipher_then_auth_kasumi_f8_encrypt(self) -> None:
f"Gbps and MOps were {result["gbps delta"]} below baseline",
)
- @func_test
+ @crypto_test
def qat_cipher_then_auth_snow3g_uea2_encrpyt(self) -> None:
"""Test throughput on a crypto_qat device type with snow3g-uea2 and snow3g-uia2 algorithms.
@@ -348,7 +348,7 @@ def qat_cipher_then_auth_snow3g_uea2_encrpyt(self) -> None:
f"Gbps and MOps were {result["gbps delta"]} below baseline",
)
- @func_test
+ @crypto_test
def qat_cipher_then_auth_zuc_eea3_encrypt(self) -> None:
"""Test throughput on a crypto_qat device type with zuc-eea3 and zuc-eia3 algorithms.
--
2.50.1
More information about the dev
mailing list