<div dir="ltr"><div style="font-family:arial,sans-serif" class="gmail_default">Reviewed-by: Jeremy Spewock <<a href="mailto:jspewock@iol.unh.edu">jspewock@iol.unh.edu</a>></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Dec 4, 2023 at 5:24 AM Juraj Linkeš <juraj.linkes@pantheon.tech> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Format according to the Google format and PEP257, with slight<br>
deviations.<br>
<br>
Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech><br>
---<br>
dts/tests/TestSuite_hello_world.py | 16 +++++---<br>
dts/tests/TestSuite_os_udp.py | 20 ++++++----<br>
dts/tests/TestSuite_smoke_tests.py | 61 ++++++++++++++++++++++++------<br>
3 files changed, 72 insertions(+), 25 deletions(-)<br>
<br>
diff --git a/dts/tests/TestSuite_hello_world.py b/dts/tests/TestSuite_hello_world.py<br>
index 768ba1cfa8..fd7ff1534d 100644<br>
--- a/dts/tests/TestSuite_hello_world.py<br>
+++ b/dts/tests/TestSuite_hello_world.py<br>
@@ -1,7 +1,8 @@<br>
# SPDX-License-Identifier: BSD-3-Clause<br>
# Copyright(c) 2010-2014 Intel Corporation<br>
<br>
-"""<br>
+"""The DPDK hello world app test suite.<br>
+<br>
Run the helloworld example app and verify it prints a message for each used core.<br>
No other EAL parameters apart from cores are used.<br>
"""<br>
@@ -15,22 +16,25 @@<br>
<br>
<br>
class TestHelloWorld(TestSuite):<br>
+ """DPDK hello world app test suite."""<br>
+<br>
def set_up_suite(self) -> None:<br>
- """<br>
+ """Set up the test suite.<br>
+<br>
Setup:<br>
Build the app we're about to test - helloworld.<br>
"""<br>
self.app_helloworld_path = self.sut_node.build_dpdk_app("helloworld")<br>
<br>
def test_hello_world_single_core(self) -> None:<br>
- """<br>
+ """Single core test case.<br>
+<br>
Steps:<br>
Run the helloworld app on the first usable logical core.<br>
Verify:<br>
The app prints a message from the used core:<br>
"hello from core <core_id>"<br>
"""<br>
-<br>
# get the first usable core<br>
lcore_amount = LogicalCoreCount(1, 1, 1)<br>
lcores = LogicalCoreCountFilter(self.sut_node.lcores, lcore_amount).filter()<br>
@@ -42,14 +46,14 @@ def test_hello_world_single_core(self) -> None:<br>
)<br>
<br>
def test_hello_world_all_cores(self) -> None:<br>
- """<br>
+ """All cores test case.<br>
+<br>
Steps:<br>
Run the helloworld app on all usable logical cores.<br>
Verify:<br>
The app prints a message from all used cores:<br>
"hello from core <core_id>"<br>
"""<br>
-<br>
# get the maximum logical core number<br>
eal_para = self.sut_node.create_eal_parameters(<br>
lcore_filter_specifier=LogicalCoreList(self.sut_node.lcores)<br>
diff --git a/dts/tests/TestSuite_os_udp.py b/dts/tests/TestSuite_os_udp.py<br>
index bf6b93deb5..2cf29d37bb 100644<br>
--- a/dts/tests/TestSuite_os_udp.py<br>
+++ b/dts/tests/TestSuite_os_udp.py<br>
@@ -1,7 +1,8 @@<br>
# SPDX-License-Identifier: BSD-3-Clause<br>
# Copyright(c) 2023 PANTHEON.tech s.r.o.<br>
<br>
-"""<br>
+"""Basic IPv4 OS routing test suite.<br>
+<br>
Configure SUT node to route traffic from if1 to if2.<br>
Send a packet to the SUT node, verify it comes back on the second port on the TG node.<br>
"""<br>
@@ -13,24 +14,26 @@<br>
<br>
<br>
class TestOSUdp(TestSuite):<br>
+ """IPv4 UDP OS routing test suite."""<br>
+<br>
def set_up_suite(self) -> None:<br>
- """<br>
+ """Set up the test suite.<br>
+<br>
Setup:<br>
- Configure SUT ports and SUT to route traffic from if1 to if2.<br>
+ Bind the SUT ports to the OS driver, configure the ports and configure the SUT<br>
+ to route traffic from if1 to if2.<br>
"""<br>
-<br>
- # This test uses kernel drivers<br>
self.sut_node.bind_ports_to_driver(for_dpdk=False)<br>
self.configure_testbed_ipv4()<br>
<br>
def test_os_udp(self) -> None:<br>
- """<br>
+ """Basic UDP IPv4 traffic test case.<br>
+<br>
Steps:<br>
Send a UDP packet.<br>
Verify:<br>
The packet with proper addresses arrives at the other TG port.<br>
"""<br>
-<br>
packet = Ether() / IP() / UDP()<br>
<br>
received_packets = self.send_packet_and_capture(packet)<br>
@@ -40,7 +43,8 @@ def test_os_udp(self) -> None:<br>
self.verify_packets(expected_packet, received_packets)<br>
<br>
def tear_down_suite(self) -> None:<br>
- """<br>
+ """Tear down the test suite.<br>
+<br>
Teardown:<br>
Remove the SUT port configuration configured in setup.<br>
"""<br>
diff --git a/dts/tests/TestSuite_smoke_tests.py b/dts/tests/TestSuite_smoke_tests.py<br>
index 8958f58dac..5e2bac14bd 100644<br>
--- a/dts/tests/TestSuite_smoke_tests.py<br>
+++ b/dts/tests/TestSuite_smoke_tests.py<br>
@@ -1,6 +1,17 @@<br>
# SPDX-License-Identifier: BSD-3-Clause<br>
# Copyright(c) 2023 University of New Hampshire<br>
<br>
+"""Smoke test suite.<br>
+<br>
+Smoke tests are a class of tests which are used for validating a minimal set of important features.<br>
+These are the most important features without which (or when they're faulty) the software wouldn't<br>
+work properly. Thus, if any failure occurs while testing these features,<br>
+there isn't that much of a reason to continue testing, as the software is fundamentally broken.<br>
+<br>
+These tests don't have to include only DPDK tests, as the reason for failures could be<br>
+in the infrastructure (a faulty link between NICs or a misconfiguration).<br>
+"""<br>
+<br>
import re<br>
<br>
from framework.config import PortConfig<br>
@@ -11,23 +22,39 @@<br>
<br>
<br>
class SmokeTests(TestSuite):<br>
+ """DPDK and infrastructure smoke test suite.<br>
+<br>
+ The test cases validate the most basic DPDK functionality needed for all other test suites.<br>
+ The infrastructure also needs to be tested, as that is also used by all other test suites.<br>
+<br>
+ Attributes:<br>
+ is_blocking: This test suite will block the execution of all other test suites<br>
+ in the build target after it.<br>
+ nics_in_node: The NICs present on the SUT node.<br>
+ """<br>
+<br>
is_blocking = True<br>
# dicts in this list are expected to have two keys:<br>
# "pci_address" and "current_driver"<br>
nics_in_node: list[PortConfig] = []<br>
<br>
def set_up_suite(self) -> None:<br>
- """<br>
+ """Set up the test suite.<br>
+<br>
Setup:<br>
- Set the build directory path and generate a list of NICs in the SUT node.<br>
+ Set the build directory path and a list of NICs in the SUT node.<br>
"""<br>
self.dpdk_build_dir_path = self.sut_node.remote_dpdk_build_dir<br>
self.nics_in_node = self.sut_node.config.ports<br>
<br>
def test_unit_tests(self) -> None:<br>
- """<br>
+ """DPDK meson ``fast-tests`` unit tests.<br>
+<br>
+ Test that all unit test from the ``fast-tests`` suite pass.<br>
+ The suite is a subset with only the most basic tests.<br>
+<br>
Test:<br>
- Run the fast-test unit-test suite through meson.<br>
+ Run the ``fast-tests`` unit test suite through meson.<br>
"""<br>
self.sut_node.main_session.send_command(<br>
f"meson test -C {self.dpdk_build_dir_path} --suite fast-tests -t 60",<br>
@@ -37,9 +64,14 @@ def test_unit_tests(self) -> None:<br>
)<br>
<br>
def test_driver_tests(self) -> None:<br>
- """<br>
+ """DPDK meson ``driver-tests`` unit tests.<br>
+<br>
+ Test that all unit test from the ``driver-tests`` suite pass.<br>
+ The suite is a subset with driver tests. This suite may be run with virtual devices<br>
+ configured in the test run configuration.<br>
+<br>
Test:<br>
- Run the driver-test unit-test suite through meson.<br>
+ Run the ``driver-tests`` unit test suite through meson.<br>
"""<br>
vdev_args = ""<br>
for dev in self.sut_node.virtual_devices:<br>
@@ -60,9 +92,12 @@ def test_driver_tests(self) -> None:<br>
)<br>
<br>
def test_devices_listed_in_testpmd(self) -> None:<br>
- """<br>
+ """Testpmd device discovery.<br>
+<br>
+ Test that the devices configured in the test run configuration are found in testpmd.<br>
+<br>
Test:<br>
- Uses testpmd driver to verify that devices have been found by testpmd.<br>
+ List all devices found in testpmd and verify the configured devices are among them.<br>
"""<br>
testpmd_driver = self.sut_node.create_interactive_shell(TestPmdShell, privileged=True)<br>
dev_list = [str(x) for x in testpmd_driver.get_devices()]<br>
@@ -74,10 +109,14 @@ def test_devices_listed_in_testpmd(self) -> None:<br>
)<br>
<br>
def test_device_bound_to_driver(self) -> None:<br>
- """<br>
+ """Device driver in OS.<br>
+<br>
+ Test that the devices configured in the test run configuration are bound to<br>
+ the proper driver.<br>
+<br>
Test:<br>
- Ensure that all drivers listed in the config are bound to the correct<br>
- driver.<br>
+ List all devices with the ``dpdk-devbind.py`` script and verify that<br>
+ the configured devices are bound to the proper driver.<br>
"""<br>
path_to_devbind = self.sut_node.path_to_devbind_script<br>
<br>
-- <br>
2.34.1<br>
<br>
</blockquote></div>