[v1,3/3] dts: add vf_smoke tests suite

Message ID 20240906173709.17487-4-jspewock@iol.unh.edu (mailing list archive)
State Superseded
Delegated to: Juraj Linkeš
Headers
Series dts: port vf_smoke to new DTS |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation warning apply issues

Commit Message

Jeremy Spewock Sept. 6, 2024, 5:37 p.m. UTC
From: Jeremy Spewock <jspewock@iol.unh.edu>

VFs should be tested against the same criteria as PFs, therefore the
smoke testing suite for VFs inherits the same test cases and testing
coverage from the PF smoke testing suite. The primary difference between
the two suites is that VF smoke initially creates virtual functions to
use for testing, and then tears them down at the end of testing and
resets the state of the PFs.

Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
---
 dts/framework/config/conf_yaml_schema.json |  3 ++-
 dts/tests/TestSuite_vf_smoke_tests.py      | 28 ++++++++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 dts/tests/TestSuite_vf_smoke_tests.py
  

Patch

diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json
index 910134f9e4..1a9d497fbf 100644
--- a/dts/framework/config/conf_yaml_schema.json
+++ b/dts/framework/config/conf_yaml_schema.json
@@ -188,7 +188,8 @@ 
         "hello_world",
         "os_udp",
         "pmd_buffer_scatter",
-        "pf_smoke_tests"
+        "pf_smoke_tests",
+        "vf_smoke_tests"
       ]
     },
     "test_target": {
diff --git a/dts/tests/TestSuite_vf_smoke_tests.py b/dts/tests/TestSuite_vf_smoke_tests.py
new file mode 100644
index 0000000000..f9b6098111
--- /dev/null
+++ b/dts/tests/TestSuite_vf_smoke_tests.py
@@ -0,0 +1,28 @@ 
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2024 University of New Hampshire
+"""Virtual Function (VF) smoke testing suite.
+
+The same common DPDK functionality that is tested on physical functions (PFs) in
+:class:`.TestSuite_pf_smoke_tests.TestPfSmokeTests` should be tested on VFs. Therefore, this test
+suite inherits its test cases from the PF smoke testing suite. The primary difference in this
+testing suite is that it creates virtual functions prior to running its test cases and then removes
+them and resets the state of the PFs after it is finished.
+"""
+from .TestSuite_pf_smoke_tests import TestPfSmokeTests  # type: ignore[import-untyped]
+
+
+class TestVfSmokeTests(TestPfSmokeTests):
+    """VF smoke testing suite."""
+
+    def set_up_suite(self) -> None:
+        """Extends :meth:`TestPfSmokeTests.set_up_suite` with methods to create Rx/Tx VFs."""
+        super().set_up_suite()
+        self.sut_egress_port = self.sut_node.create_virtual_functions(1, self._sut_port_egress)[0]
+        self.sut_ingress_port = self.sut_node.create_virtual_functions(1, self._sut_port_ingress)[0]
+
+    def tear_down_suite(self) -> None:
+        """Extends :meth:`TestPfSmokeTests.tear_down_suite` with VF cleanup and PF rebinding."""
+        super().tear_down_suite()
+        self.sut_node.remove_virtual_functions(self._sut_port_egress)
+        self.sut_node.remove_virtual_functions(self._sut_port_ingress)
+        self.sut_node.bind_all_ports_to_driver()