mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
add failing test
This commit is contained in:
33
tests/failing_tests/condition_issue.py
Normal file
33
tests/failing_tests/condition_issue.py
Normal file
@ -0,0 +1,33 @@
|
||||
from pythonbpf import bpf, map, bpfglobal, section, compile, compile_to_ir, BPF
|
||||
from pythonbpf.maps import RingBuf
|
||||
from ctypes import c_int32, c_void_p
|
||||
|
||||
|
||||
# Define a map
|
||||
@bpf
|
||||
@map
|
||||
def mymap() -> RingBuf:
|
||||
return RingBuf(max_entries=(1024))
|
||||
|
||||
@bpf
|
||||
@section("tracepoint/syscalls/sys_enter_clone")
|
||||
def random_section(ctx: c_void_p) -> c_int32:
|
||||
e: c_int32 = mymap().reserve(64)
|
||||
if e == 0: # here is the issue i think
|
||||
return c_int32(0)
|
||||
mymap().submit(e)
|
||||
return c_int32(0)
|
||||
|
||||
|
||||
@bpf
|
||||
@bpfglobal
|
||||
def LICENSE() -> str:
|
||||
return "GPL"
|
||||
|
||||
|
||||
compile_to_ir("ringbuf.py", "ringbuf.ll")
|
||||
compile()
|
||||
b = BPF()
|
||||
b.load_and_attach()
|
||||
while True:
|
||||
print("running")
|
||||
Reference in New Issue
Block a user