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 <[email protected]> --- 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 c8035fccf0..3eaffc2aa4 100644 --- a/dts/configurations/test_run.example.yaml +++ b/dts/configurations/test_run.example.yaml @@ -31,6 +31,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 # optional # by removing the `test_suites` field, this test run will run every test suite available 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 36e6c5a44c..ada628c59e 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_vf_ports() test_run.ctx.topology.configure_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 ef8fb026c2..10e3c7ff5e 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]] = [ @@ -142,7 +142,7 @@ def _verify_throughput( result_list.append(result_dict) return result_list - @func_test + @crypto_test def aes_cbc(self) -> None: """aes_cbc test. @@ -172,6 +172,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. @@ -204,6 +205,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. @@ -237,7 +239,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. @@ -271,7 +273,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. @@ -303,7 +305,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_docsiscpi test. @@ -363,7 +365,7 @@ def aes_sha1(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. @@ -398,7 +400,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. @@ -433,7 +435,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. @@ -469,7 +471,7 @@ def kasumi_f8_kasumi_f9(self) -> None: # BEGIN VDEV TESTS - + @crypto_test def aesni_mb_vdev(self) -> None: """aesni_mb virtual device test. @@ -505,7 +507,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. @@ -541,7 +543,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. @@ -577,7 +579,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. @@ -616,7 +618,7 @@ def snow3g_vdev(self) -> None: f"Gbps and MOps were {result["gbps delta"]} below baseline", ) - @func_test + @crypto_test def zuc_vdev(self) -> None: """Zuc virtual device test. @@ -652,7 +654,7 @@ def zuc_vdev(self) -> None: for result in results: verify(result["passed"] == "PASS", "gpbs fell below delta tolerance") - @func_test + @crypto_test def open_ssl_vdev(self) -> None: """open_ssl virtual device test. -- 2.50.1

