From c81aad7c6787349e2897937d2535b8f9ca09f0df Mon Sep 17 00:00:00 2001 From: Pragyansh Chaturvedi Date: Tue, 7 Oct 2025 13:42:58 +0530 Subject: [PATCH] Add failing struct_ptr test for conditionals --- .../failing_tests/conditionals/struct_ptr.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/failing_tests/conditionals/struct_ptr.py diff --git a/tests/failing_tests/conditionals/struct_ptr.py b/tests/failing_tests/conditionals/struct_ptr.py new file mode 100644 index 0000000..baee3a8 --- /dev/null +++ b/tests/failing_tests/conditionals/struct_ptr.py @@ -0,0 +1,29 @@ +from pythonbpf import bpf, struct, section, bpfglobal, compile +from ctypes import c_void_p, c_int64, c_uint64 + + +@bpf +@struct +class data_t: + pid: c_uint64 + ts: c_uint64 + + +@bpf +@section("tracepoint/syscalls/sys_enter_execve") +def hello_world(ctx: c_void_p) -> c_int64: + dat = data_t() + if dat: + print("Hello, World!") + else: + print("Goodbye, World!") + return + + +@bpf +@bpfglobal +def LICENSE() -> str: + return "GPL" + + +compile()