mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
move a test to passing
This commit is contained in:
24
tests/passing_tests/vmlinux/i32_test_fail_2.py
Normal file
24
tests/passing_tests/vmlinux/i32_test_fail_2.py
Normal file
@ -0,0 +1,24 @@
|
||||
from ctypes import c_int64
|
||||
from pythonbpf import bpf, section, bpfglobal, compile, compile_to_ir
|
||||
from vmlinux import struct_xdp_md
|
||||
from vmlinux import XDP_PASS
|
||||
import logging
|
||||
|
||||
|
||||
@bpf
|
||||
@section("xdp")
|
||||
def print_xdp_data(ctx: struct_xdp_md) -> c_int64:
|
||||
data = c_int64(ctx.data) # 32-bit field: packet start pointer
|
||||
something = 2 + data
|
||||
print(f"ctx->data = {something}")
|
||||
return c_int64(XDP_PASS)
|
||||
|
||||
|
||||
@bpf
|
||||
@bpfglobal
|
||||
def LICENSE() -> str:
|
||||
return "GPL"
|
||||
|
||||
|
||||
compile_to_ir("i32_test_fail_2.py", "i32_test_fail_2.ll")
|
||||
compile(logging.INFO)
|
||||
Reference in New Issue
Block a user