From 1cce49f5e01db66aca9c59913db71dc4dbabc001 Mon Sep 17 00:00:00 2001 From: Pragyansh Chaturvedi Date: Tue, 7 Oct 2025 03:24:11 +0530 Subject: [PATCH] Add const_binop test for conditionals --- .../passing_tests/conditionals/const_binop.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/passing_tests/conditionals/const_binop.py diff --git a/tests/passing_tests/conditionals/const_binop.py b/tests/passing_tests/conditionals/const_binop.py new file mode 100644 index 0000000..9dffd30 --- /dev/null +++ b/tests/passing_tests/conditionals/const_binop.py @@ -0,0 +1,21 @@ +from pythonbpf import bpf, section, bpfglobal, compile +from ctypes import c_void_p, c_int64 + + +@bpf +@section("tracepoint/syscalls/sys_enter_execve") +def hello_world(ctx: c_void_p) -> c_int64: + if (0 + 1) * 0: + print("Hello, World!") + else: + print("Goodbye, World!") + return + + +@bpf +@bpfglobal +def LICENSE() -> str: + return "GPL" + + +compile()