mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
add failing tests
This commit is contained in:
15
tests/failing_tests/binops.py
Normal file
15
tests/failing_tests/binops.py
Normal file
@ -0,0 +1,15 @@
|
||||
from pythonbpf import compile, bpf, section, bpfglobal
|
||||
from ctypes import c_void_p, c_int64
|
||||
|
||||
@bpf
|
||||
@section("sometag1")
|
||||
def sometag(ctx: c_void_p) -> c_int64:
|
||||
a = 1 + 2 + 1
|
||||
return c_int64(0)
|
||||
|
||||
@bpf
|
||||
@bpfglobal
|
||||
def LICENSE() -> str:
|
||||
return "GPL"
|
||||
|
||||
compile()
|
||||
16
tests/failing_tests/if.py
Normal file
16
tests/failing_tests/if.py
Normal file
@ -0,0 +1,16 @@
|
||||
from pythonbpf import compile, bpf, section, bpfglobal
|
||||
from ctypes import c_void_p, c_int64
|
||||
|
||||
@bpf
|
||||
@section("sometag1")
|
||||
def sometag(ctx: c_void_p) -> c_int64:
|
||||
if 3 + 2 == 5:
|
||||
return c_int64(5)
|
||||
return c_int64(0)
|
||||
|
||||
@bpf
|
||||
@bpfglobal
|
||||
def LICENSE() -> str:
|
||||
return "GPL"
|
||||
|
||||
compile()
|
||||
11
tests/failing_tests/license.py
Normal file
11
tests/failing_tests/license.py
Normal file
@ -0,0 +1,11 @@
|
||||
from pythonbpf import compile, bpf, section, bpfglobal
|
||||
from ctypes import c_void_p, c_int64
|
||||
|
||||
# FAILS WHEN THERE IS NO LICENSE. which is wrong.
|
||||
@bpf
|
||||
@section("sometag1")
|
||||
def sometag(ctx: c_void_p) -> c_int64:
|
||||
a = 1 + 2
|
||||
return c_int64(0)
|
||||
|
||||
compile()
|
||||
14
tests/failing_tests/return.py
Normal file
14
tests/failing_tests/return.py
Normal file
@ -0,0 +1,14 @@
|
||||
from pythonbpf import compile, bpf, section, bpfglobal
|
||||
from ctypes import c_void_p, c_int64
|
||||
|
||||
@bpf
|
||||
@section("sometag1")
|
||||
def sometag(ctx: c_void_p) -> c_int64:
|
||||
return c_int64(1 - 1)
|
||||
|
||||
@bpf
|
||||
@bpfglobal
|
||||
def LICENSE() -> str:
|
||||
return "GPL"
|
||||
|
||||
compile()
|
||||
Reference in New Issue
Block a user