Skip to content

Commit

Permalink
DPDK: symmetric_mp test
Browse files Browse the repository at this point in the history
  • Loading branch information
mcgov committed Jan 30, 2025
1 parent ca4b648 commit e286ad8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
44 changes: 27 additions & 17 deletions microsoft/testsuites/dpdk/dpdksuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
Lsmod,
Make,
Modprobe,
Ping,
Timeout,
)
from lisa.tools.hugepages import HugePageSize
Expand Down Expand Up @@ -142,6 +143,8 @@ def verify_dpdk_symmetric_mp(
nics = [node.nics.get_nic("eth1"), node.nics.get_nic("eth2")]
test_nic = node.nics.get_secondary_nic()
extra_nics = [nic for nic in nics if nic.name != test_nic.name]
ping = node.tools[Ping]
ping.install()
try:
test_kit = initialize_node_resources(
node,
Expand All @@ -158,17 +161,19 @@ def verify_dpdk_symmetric_mp(
# The Testpmd tool doesn't get re-initialized
# even if you invoke it with new arguments.
raise SkippedException(
"DPDK ring_ping test is not implemented for "
"DPDK symmetric_mp test is not implemented for "
" package manager installation."
)
symmetric_mp_path = testpmd.get_example_app_path("dpdk-symmetric_mp")
node.log.debug("\n".join([str(nic) for nic in nics]))

nic_args = (
f'--vdev="{test_nic.pci_slot},'
f"mac={test_nic.mac_addr},"
f'mac={extra_nics[0].mac_addr}"'
)
if node.nics.is_mana_device_present():
nic_args = (
f'--vdev="{test_nic.pci_slot},'
f"mac={test_nic.mac_addr},"
f'mac={extra_nics[0].mac_addr}"'
)
else:
nic_args = f"-b {node.nics.get_primary_nic().pci_slot}"

output = node.execute(
f"{str(testpmd.get_example_app_path('dpdk-devname'))} {nic_args}",
Expand All @@ -193,23 +198,28 @@ def verify_dpdk_symmetric_mp(
f"-- -p {hex(port_mask)[2:]} --num-procs 2"
)
primary = node.tools[Timeout].start_with_timeout(
command=f"{str(symmetric_mp_path)} -l 1,2 {symmetric_mp_args} --proc-id 0",
timeout=30,
command=f"{str(symmetric_mp_path)} -l 1 {symmetric_mp_args} --proc-id 0",
timeout=150,
signal=SIGINT,
kill_timeout=30,
)
primary.wait_output("APP: Finished Process Init")
secondary = node.tools[Timeout].run_with_timeout(
command=f"{str(symmetric_mp_path)} -l 3,4 {symmetric_mp_args} --proc-id 1",
timeout=30,
secondary = node.tools[Timeout].start_with_timeout(
command=f"{str(symmetric_mp_path)} -l 2 {symmetric_mp_args} --proc-id 1",
timeout=120,
signal=SIGINT,
kill_timeout=35,
)
assert_that(secondary.exit_code).described_as(
f"Secondary process failure: {secondary.stdout}"
_ = ping.ping_async(
target=test_nic.ip_addr,
nic_name=node.nics.get_primary_nic().name,
count=100,
)
secondary_exit = secondary.wait_result()
assert_that(secondary_exit.exit_code).described_as(
f"Secondary process failure: {secondary_exit.stdout}"
).is_zero()
process_result = primary.wait_result(
timeout=30,
expected_exit_code=0,
expected_exit_code_failure_message="Primary process failed to exit with 0",
)
Expand All @@ -218,8 +228,8 @@ def verify_dpdk_symmetric_mp(
f"\nprimary stderr:\n{process_result.stderr}"
)
node.log.debug(
f"Secondary system:\n\n{secondary.stdout}\n"
f"secondary stderr:\n{secondary.stderr}"
f"Secondary system:\n\n{secondary_exit.stdout}\n"
f"secondary stderr:\n{secondary_exit.stderr}"
)

@TestCaseMetadata(
Expand Down
2 changes: 1 addition & 1 deletion microsoft/testsuites/dpdk/dpdktestpmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def get_installed_version(self) -> VersionInfo:

def _install(self) -> None:
super()._install()
devname_path = self._node.tools[Git].clone(
_ = self._node.tools[Git].clone(
url="https://github.com/mcgov/devname.git",
cwd=self.asset_path.joinpath("examples"),
dir_name="devname",
Expand Down

0 comments on commit e286ad8

Please sign in to comment.