[PATCH v5 5/5] dts: add crypto test decorator
Andrew Bailey
abailey at iol.unh.edu
Fri Mar 6 17:40:27 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/configurations/test_run.example.yaml | 1 +
dts/framework/config/test_run.py | 3 +++
dts/framework/test_run.py | 2 +-
dts/framework/test_suite.py | 6 +++++
dts/tests/TestSuite_cryptodev_throughput.py | 30 +++++++++++----------
5 files changed, 27 insertions(+), 15 deletions(-)
diff --git a/dts/configurations/test_run.example.yaml b/dts/configurations/test_run.example.yaml
index 707a3104ed..ee641f5dce 100644
--- a/dts/configurations/test_run.example.yaml
+++ b/dts/configurations/test_run.example.yaml
@@ -48,6 +48,7 @@ func_traffic_generator:
# config: "/opt/trex_config/trex_config.yaml" # Additional configuration files. (Leave blank if not required)
perf: false # disable performance testing
func: true # enable functional testing
+crypto: false # disable cryptographic testing
use_virtual_functions: false # use virtual functions (VFs) instead of physical functions
skip_smoke_tests: true # see `Optional Fields`
test_suites: # see `Optional Fields`; the following test suites will be run in their entirety
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_run.py b/dts/framework/test_run.py
index 494eb40046..94dc6023a7 100644
--- a/dts/framework/test_run.py
+++ b/dts/framework/test_run.py
@@ -349,7 +349,7 @@ def next(self) -> State | None:
if test_run.config.use_virtual_functions:
test_run.ctx.topology.instantiate_vf_ports()
- if test_run.ctx.sut_node.cryptodevs:
+ if test_run.ctx.sut_node.cryptodevs and test_run.config.crypto:
test_run.ctx.topology.instantiate_crypto_ports()
test_run.ctx.topology.bind_cryptodevs("dpdk")
diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py
index 9c57e343ac..e86096cefe 100644
--- a/dts/framework/test_suite.py
+++ b/dts/framework/test_suite.py
@@ -174,6 +174,8 @@ def filter_test_cases(
perf_test_cases.add(test_case)
case TestCaseType.FUNCTIONAL:
func_test_cases.add(test_case)
+ case TestCaseType.CRYPTO:
+ pass
if test_case_sublist_copy:
raise ConfigurationError(
@@ -279,6 +281,8 @@ class TestCaseType(Enum):
FUNCTIONAL = auto()
#:
PERFORMANCE = auto()
+ #:
+ CRYPTO = auto()
class TestCase(TestProtocol, Protocol[TestSuiteMethodType]):
@@ -331,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/tests/TestSuite_cryptodev_throughput.py b/dts/tests/TestSuite_cryptodev_throughput.py
index 638a52ac74..af0a5680ab 100644
--- a/dts/tests/TestSuite_cryptodev_throughput.py
+++ b/dts/tests/TestSuite_cryptodev_throughput.py
@@ -32,7 +32,7 @@
from api.test import verify
from framework.context import get_ctx
from framework.exception import SkippedTestException
-from framework.test_suite import BaseConfig, TestSuite, func_test
+from framework.test_suite import BaseConfig, TestSuite, crypto_test
from framework.testbed_model.virtual_device import VirtualDevice
config_list: list[dict[str, int | float | str]] = [
@@ -145,7 +145,7 @@ def _verify_throughput(
)
return result_list
- @func_test
+ @crypto_test
def aes_cbc(self) -> None:
"""aes_cbc test.
@@ -175,6 +175,7 @@ def aes_cbc(self) -> None:
for result in results:
verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")
+ @crypto_test
def aes_cbc_sha1(self) -> None:
"""aes_cbc_sha1 test.
@@ -209,6 +210,7 @@ def aes_cbc_sha1(self) -> None:
for result in results:
verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")
+ @crypto_test
def aes_cbc_sha2(self) -> None:
"""aes_cbc_sha2 test.
@@ -242,7 +244,7 @@ def aes_cbc_sha2(self) -> None:
for result in results:
verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")
- @func_test
+ @crypto_test
def aes_cbc_sha2_digest_16(self) -> None:
"""aes_cbc_sha2_digest_16 test.
@@ -276,7 +278,7 @@ def aes_cbc_sha2_digest_16(self) -> None:
for result in results:
verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")
- @func_test
+ @crypto_test
def aead_aes_gcm(self) -> None:
"""aead_aes_gcm test.
@@ -308,7 +310,7 @@ def aead_aes_gcm(self) -> None:
for result in results:
verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")
- @func_test
+ @crypto_test
def aes_docsisbpi(self) -> None:
"""aes_docsisbpi test.
@@ -369,7 +371,7 @@ def sha1_hmac(self) -> None:
for result in results:
verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")
- @func_test
+ @crypto_test
def snow3g_uea2_snow3g_uia2(self) -> None:
"""snow3g_uea2_snow3g_uia2 test.
@@ -404,7 +406,7 @@ def snow3g_uea2_snow3g_uia2(self) -> None:
for result in results:
verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")
- @func_test
+ @crypto_test
def zuc_eea3_zuc_eia3(self) -> None:
"""zuc_eea3_zuc_eia3 test.
@@ -439,7 +441,7 @@ def zuc_eea3_zuc_eia3(self) -> None:
for result in results:
verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")
- @func_test
+ @crypto_test
def kasumi_f8_kasumi_f9(self) -> None:
"""kasumi_f8 kasumi_f9 test.
@@ -476,7 +478,7 @@ def kasumi_f8_kasumi_f9(self) -> None:
# BEGIN VDEV TESTS
-
+ @crypto_test
def aesni_mb_vdev(self) -> None:
"""aesni_mb virtual device test.
@@ -513,7 +515,7 @@ def aesni_mb_vdev(self) -> None:
for result in results:
verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")
- @func_test
+ @crypto_test
def aesni_gcm_vdev(self):
"""aesni_gcm virtual device test.
@@ -546,7 +548,7 @@ def aesni_gcm_vdev(self):
for result in results:
verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")
- @func_test
+ @crypto_test
def kasumi_vdev(self) -> None:
"""Kasmumi virtual device test.
@@ -582,7 +584,7 @@ def kasumi_vdev(self) -> None:
for result in results:
verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")
- @func_test
+ @crypto_test
def snow3g_vdev(self) -> None:
"""snow3g virtual device test.
@@ -619,7 +621,7 @@ def snow3g_vdev(self) -> None:
for result in results:
verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")
- @func_test
+ @crypto_test
def zuc_vdev(self) -> None:
"""Zuc virtual device test.
@@ -656,7 +658,7 @@ def zuc_vdev(self) -> None:
for result in results:
verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")
- @func_test
+ @crypto_test
def open_ssl_vdev(self) -> None:
"""open_ssl virtual device test.
--
2.50.1
More information about the dev
mailing list