mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
Add named_arg failing test
This commit is contained in:
34
tests/failing_tests/named_arg.py
Normal file
34
tests/failing_tests/named_arg.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
from pythonbpf import bpf, map, section, bpfglobal, compile
|
||||||
|
from pythonbpf.helper import XDP_PASS
|
||||||
|
from pythonbpf.maps import HashMap
|
||||||
|
|
||||||
|
from ctypes import c_void_p, c_int64
|
||||||
|
|
||||||
|
|
||||||
|
@bpf
|
||||||
|
@map
|
||||||
|
def count() -> HashMap:
|
||||||
|
return HashMap(key=c_int64, value=c_int64, max_entries=1)
|
||||||
|
|
||||||
|
|
||||||
|
@bpf
|
||||||
|
@section("xdp")
|
||||||
|
def hello_world(ctx: c_void_p) -> c_int64:
|
||||||
|
prev = count.lookup(0)
|
||||||
|
if prev:
|
||||||
|
prev = prev + 1
|
||||||
|
count.update(0, prev)
|
||||||
|
return XDP_PASS
|
||||||
|
else:
|
||||||
|
count.update(0, 1)
|
||||||
|
|
||||||
|
return XDP_PASS
|
||||||
|
|
||||||
|
|
||||||
|
@bpf
|
||||||
|
@bpfglobal
|
||||||
|
def LICENSE() -> str:
|
||||||
|
return "GPL"
|
||||||
|
|
||||||
|
|
||||||
|
compile()
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from pythonbpf import compile, bpf, section, bpfglobal, compile_to_ir
|
from pythonbpf import compile, bpf, section, bpfglobal
|
||||||
from ctypes import c_void_p, c_int64
|
from ctypes import c_void_p, c_int64
|
||||||
|
|
||||||
|
|
||||||
@ -16,5 +16,5 @@ def sometag(ctx: c_void_p) -> c_int64:
|
|||||||
def LICENSE() -> str:
|
def LICENSE() -> str:
|
||||||
return "GPL"
|
return "GPL"
|
||||||
|
|
||||||
compile_to_ir("var_rval.py", "var_rval.ll")
|
|
||||||
compile(loglevel=logging.INFO)
|
compile(loglevel=logging.INFO)
|
||||||
|
|||||||
Reference in New Issue
Block a user