Tests: Skip vmlinux tests only when vmlinux.py is absent

except Exception turned every import-time defect in the generated module
into a skip of every vmlinux test, so CI could pass with no vmlinux
coverage. ImportError (no module) skips; anything else propagates.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Pragyansh Chaturvedi
2026-09-25 01:15:55 +05:30
parent 298c140ee7
commit 598e3b4efa

View File

@ -32,9 +32,13 @@ try:
VMLINUX_AVAILABLE = True
VMLINUX_SKIP_REASON = ""
except Exception as exc:
except ImportError as exc:
# No vmlinux.py: the tests that need it are skipped. Any other exception
# propagates. A vmlinux.py that exists but does not import is a defect in
# the generator, and hiding it behind skips would pass CI with no vmlinux
# coverage at all.
VMLINUX_AVAILABLE = False
VMLINUX_SKIP_REASON = f"vmlinux.py not usable for current kernel: {exc}"
VMLINUX_SKIP_REASON = f"vmlinux.py not importable: {exc}"
# ── pytest_generate_tests: parametrize on bpf_test_file ───────────────────