Skip to content

Commit 283b947

Browse files
committed
Add named_arg failing test
1 parent ac49cd8 commit 283b947

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

tests/failing_tests/named_arg.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from pythonbpf import bpf, map, section, bpfglobal, compile
2+
from pythonbpf.helper import XDP_PASS
3+
from pythonbpf.maps import HashMap
4+
5+
from ctypes import c_void_p, c_int64
6+
7+
8+
@bpf
9+
@map
10+
def count() -> HashMap:
11+
return HashMap(key=c_int64, value=c_int64, max_entries=1)
12+
13+
14+
@bpf
15+
@section("xdp")
16+
def hello_world(ctx: c_void_p) -> c_int64:
17+
prev = count.lookup(0)
18+
if prev:
19+
prev = prev + 1
20+
count.update(0, prev)
21+
return XDP_PASS
22+
else:
23+
count.update(0, 1)
24+
25+
return XDP_PASS
26+
27+
28+
@bpf
29+
@bpfglobal
30+
def LICENSE() -> str:
31+
return "GPL"
32+
33+
34+
compile()

tests/passing_tests/var_rval.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22

3-
from pythonbpf import compile, bpf, section, bpfglobal, compile_to_ir
3+
from pythonbpf import compile, bpf, section, bpfglobal
44
from ctypes import c_void_p, c_int64
55

66

@@ -16,5 +16,5 @@ def sometag(ctx: c_void_p) -> c_int64:
1616
def LICENSE() -> str:
1717
return "GPL"
1818

19-
compile_to_ir("var_rval.py", "var_rval.ll")
19+
2020
compile(loglevel=logging.INFO)

0 commit comments

Comments
 (0)