mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2026-12-06 18:08:36 +00:00
Every xfail is strict with raises=Exception, so a verifier-level negative fixture counted any rejection as the expected one, including one caused by a codegen regression, or by bpftool failing. A verifier entry may now carry match = "..."; the harness attaches it as a verifier_match marker and test_kernel_verifier fails, through pytest.fail (not swallowed by raises=Exception), when the program is rejected for any other reason. xdp_devmap_helpers pins its documented "invalid bpf_context access". Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
33 lines
997 B
Python
33 lines
997 B
Python
from dataclasses import dataclass
|
|
from pathlib import Path
|
|
|
|
# The three test levels, in pipeline order. A test declared as failing at one
|
|
# level is also expected to fail at every later level: a program that cannot
|
|
# generate IR cannot reach llc, and one that llc rejects never reaches the
|
|
# kernel. Used by conftest to decide which items to mark xfail.
|
|
LEVELS = ("ir", "llc", "verifier")
|
|
|
|
|
|
def level_index(level: str) -> int:
|
|
"""Position of a level in the pipeline. Unknown levels sort first ("ir")."""
|
|
try:
|
|
return LEVELS.index(level)
|
|
except ValueError:
|
|
return 0
|
|
|
|
|
|
@dataclass
|
|
class BpfTestCase:
|
|
path: Path
|
|
rel_path: str
|
|
is_expected_fail: bool = False
|
|
xfail_reason: str = ""
|
|
xfail_level: str = "ir" # one of LEVELS
|
|
xfail_match: str = "" # verifier level: substring the rejection must contain
|
|
needs_vmlinux: bool = False
|
|
skip_reason: str = ""
|
|
|
|
@property
|
|
def test_id(self) -> str:
|
|
return self.rel_path.replace("/", "::")
|