From 0e7dcafbab6443aa63bdba7009781a9fb26c6a97 Mon Sep 17 00:00:00 2001 From: Pragyansh Chaturvedi Date: Tue, 7 Oct 2025 05:02:26 +0530 Subject: [PATCH] Add var_comp test for conditionals --- tests/passing_tests/conditionals/var_comp.py | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/passing_tests/conditionals/var_comp.py diff --git a/tests/passing_tests/conditionals/var_comp.py b/tests/passing_tests/conditionals/var_comp.py new file mode 100644 index 0000000..4f12f15 --- /dev/null +++ b/tests/passing_tests/conditionals/var_comp.py @@ -0,0 +1,22 @@ +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: + x = 2 + if x > 3: + print("Hello, World!") + else: + print("Goodbye, World!") + return + + +@bpf +@bpfglobal +def LICENSE() -> str: + return "GPL" + + +compile()