Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 63 additions & 5 deletions lisa/microsoft/testsuites/xdp/xdptools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the MIT license.
import re
from pathlib import PurePath
from typing import Any, Dict
from typing import Any, Dict, Set

from lisa import (
LisaException,
Expand All @@ -11,7 +11,7 @@
UnsupportedOperationException,
)
from lisa.executable import Tool
from lisa.operating_system import AlmaLinux, CentOs, Debian, Fedora
from lisa.operating_system import AlmaLinux, CentOs, Debian, Fedora, Ubuntu
from lisa.tools import Ethtool, Git, Make
from lisa.tools.ethtool import DeviceGroLroSettings
from lisa.util import find_groups_in_lines
Expand All @@ -35,6 +35,22 @@ def can_install(node: Node) -> bool:
return True


# Upstream xdp-tools tests known to fail on Ubuntu 24.04+ (Linux kernel 6.8+).
# The upstream test harness's promiscuous-mode detection logic is incompatible
# with the newer kernel behaviour; this is not a LISA, Azure, or driver bug.
# Re-evaluate this allowlist whenever `_xdp_tools_tag` below is bumped past
# v1.4.1, as the upstream fix may already be included.
_KNOWN_UPSTREAM_FAILURES: Set[str] = {
"test_promiscuous_selfload",
"test_promiscuous_preload",
}
Comment on lines +43 to +46

Copilot AI Apr 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description says these failures are specific to Ubuntu 24.04+ (kernel 6.8+), but the code unconditionally ignores them on all distros/kernels. This risks masking real regressions on other platforms. Consider gating the allowlist by OS/version and/or kernel version (e.g., only apply when running on Ubuntu >= 24.04 or kernel >= 6.8), and otherwise treat these as unexpected failures.

Copilot uses AI. Check for mistakes.

# `make test` exits with 2 when the build/run succeeds but tests fail.
# Any other non-zero code indicates a runner failure (timeout, OOM, missing
# deps, etc.) that must not be silently masked.
_MAKE_TEST_FAILED_EXIT_CODE = 2


class XdpTool(Tool):
"""
The community xdp tools, it's used to verify XDP by community test cases.
Expand Down Expand Up @@ -71,12 +87,54 @@ def run_full_test(self) -> None:
):
if item["result"] not in ["PASS", "SKIPPED"]:
abnormal_results[item["name"]] = item["result"]
if abnormal_results:
raise LisaException(f"found failed tests: {abnormal_results}")

# Always reject exit codes that don't correspond to a normal
# make-test run (success or tests-failed). This guards against
# runner crashes, timeouts, or missing dependencies being masked
# by the upstream-failure allowlist below.
result.assert_exit_code(
0, "unknown error on xdp tests, please check log for more details."
[0, _MAKE_TEST_FAILED_EXIT_CODE],
"unknown error on xdp tests, please check log for more details.",
)

Comment on lines 95 to 99
# The upstream-failure allowlist only applies to the distro/kernel
# combinations where these failures are known to be benign.
if self._allow_known_upstream_failures():
known = {
k: v
for k, v in abnormal_results.items()
if k in _KNOWN_UPSTREAM_FAILURES
}
unexpected = {
k: v
for k, v in abnormal_results.items()
if k not in _KNOWN_UPSTREAM_FAILURES
}
if known:
self.node.log.warning(
f"ignoring known upstream xdp-tools failures: {known}"
)
else:
unexpected = abnormal_results

if unexpected:
raise LisaException(f"found failed tests: {unexpected}")

def _allow_known_upstream_failures(self) -> bool:
# Limit the allowlist to Ubuntu running kernel 6.8 or newer, which
# is the only environment where the upstream issue reproduces.
if not isinstance(self.node.os, Ubuntu):
return False
try:
kernel_version = self.node.os.get_kernel_information().version
except Exception as ex: # noqa: BLE001 - defensive: kernel info missing
self.node.log.debug(
f"could not detect kernel version, "
f"disabling xdp-tools allowlist: {ex}"
)
Comment on lines +120 to +134

Copilot AI Apr 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When known is non-empty, the code skips checking result's exit code entirely. That can allow non-test-related failures (e.g., runner crash, bad invocation, missing deps) to pass as long as the parsed test list only contains known failures. A safer approach is to still validate the exit code in the known case—e.g., allow only the specific failure exit code(s) that correspond to test failures, and fail on any other non-zero exit code.

Copilot uses AI. Check for mistakes.
return False
Comment on lines +128 to +135
return bool(kernel_version >= "6.8.0")

def _initialize(self, *args: Any, **kwargs: Any) -> None:
super()._initialize(*args, **kwargs)
self._command: PurePath = PurePath(self._default_command)
Expand Down
Loading