mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2026-12-06 09:58:34 +00:00
failing_tests/vmlinux/assignment_handling.py pinned exactly this gap
("This gives an error, but / this does not"); it moves to the passing
suite and its xfail entry goes. enum_to_local.py adds the C shape
`int act = XDP_PASS; if (...) act = XDP_DROP; return act;`.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
23 lines
581 B
Python
23 lines
581 B
Python
from vmlinux import XDP_PASS
|
|
from pythonbpf import bpf, section, bpfglobal, compile_to_ir
|
|
import logging
|
|
from ctypes import c_int64, c_void_p
|
|
|
|
|
|
@bpf
|
|
@section("kprobe/blk_mq_start_request")
|
|
def example(ctx: c_void_p) -> c_int64:
|
|
d = XDP_PASS # bare enum constant: used to be rejected at allocation
|
|
e = XDP_PASS + 0 # through a binop: always worked; the two must agree
|
|
print(f"test1 {e} test2 {d}")
|
|
return c_int64(0)
|
|
|
|
|
|
@bpf
|
|
@bpfglobal
|
|
def LICENSE() -> str:
|
|
return "GPL"
|
|
|
|
|
|
compile_to_ir("assignment_handling.py", "assignment_handling.ll", loglevel=logging.INFO)
|