selftests/bpf: support struct/union presets in veristat
Subsystems (3)
PATCH v3 1/1 selftests/bpf: support struct/union presets in veristat
From: Mykyta Yatsenko <[email protected]>
Extend commit e3c9abd0d14b ("selftests/bpf: Implement setting global variables in veristat") to support applying presets to members of the global structs or unions in veristat.
For example:
``` ./veristat set_global_vars.bpf.o -G "union1.struct3.var_u8_h = 0xBB" ```
--- .../selftests/bpf/prog_tests/test_veristat.c | 5 + tools/testing/selftests/bpf/progs/prepare.c | 1 - .../selftests/bpf/progs/set_global_vars.c | 41 +++++++ tools/testing/selftests/bpf/veristat.c | 101 ++++++++++++++++-- 4 files changed, 140 insertions(+), 8 deletions(-)
tools/testing/selftests/bpf/prog_tests/test_veristat.c +5 -0
@@ -63,6 +63,9 @@ static void test_set_global_vars_succeeds(void)" -G \"var_eb = EB2\" " \" -G \"var_ec = EC2\" " \" -G \"var_b = 1\" " \ +" -G \"struct1.struct2.u.var_u8 = 170\" " \ +" -G \"union1.struct3.var_u8_l = 0xaa\" " \ +" -G \"union1.struct3.var_u8_h = 0xaa\" " \ "-vl2 > %s", fix->veristat, fix->tmpfile);read (fix->fd, fix->output, fix->sz);
@@ -78,6 +81,8 @@ static void test_set_global_vars_succeeds(void)__CHECK_STR ("_w=12 " ,"var_eb = EB2" );__CHECK_STR ("_w=13 " ,"var_ec = EC2" );__CHECK_STR ("_w=1 " ,"var_b = 1" ); +__CHECK_STR ("_w=170 " ,"struct1.struct2.u.var_u8 = 170" ); +__CHECK_STR ("_w=0xaaaa " ,"union1.var_u16 = 0xaaaa" ); out:teardown_fixture (fix);
tools/testing/selftests/bpf/progs/prepare.c +0 -1
@@ -2,7 +2,6 @@/* Copyright (c) 2025 Meta */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> -//#include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL";
tools/testing/selftests/bpf/progs/set_global_vars.c +41 -0
52 lines not on this page · raw message
tools/testing/selftests/bpf/veristat.c +94 -7
144 lines not on this page · raw message
Signature · 1 line
2.49.0
This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:
Quoted 11 lines · On Tue, 8 Apr 2025 11:45:44 +0100 you wrote:
From: Mykyta Yatsenko <[email protected]>
Extend commit
e3c9abd0d14b("selftests/bpf: Implement setting global variables in veristat") to support applying presets to members of the global structs or unions in veristat.
For example:``` ./veristat set_global_vars.bpf.o -G "union1.struct3.var_u8_h = 0xBB" ```[...]
Here is the summary with links:
- [bpf-next,v3] selftests/bpf: support struct/union presets in veristat
https://git.kernel.org/bpf/bpf-next/c/37b1b3ed20c3
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html