From f207cf3a9909835b51338b0ba481725a72becdbc Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Thu, 12 Oct 2023 16:12:36 +0200 Subject: sys/linux/test: test case for bpf_trace_printk description This commit adds a new test case for the bpf_trace_printk description introduced in the previous commit. It corresponds to the code: bpf_trace_printk("%d ", 8, 0x1234); exit 0; in a BPF program that is then executed via BPF_PROG_TEST_RUN. Signed-off-by: Paul Chaignon --- sys/linux/test/bpf_helpers | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 sys/linux/test/bpf_helpers (limited to 'sys/linux') diff --git a/sys/linux/test/bpf_helpers b/sys/linux/test/bpf_helpers new file mode 100644 index 000000000..9e65ffc55 --- /dev/null +++ b/sys/linux/test/bpf_helpers @@ -0,0 +1,5 @@ +# Load and execute a BPF program that simply calls bpf_trace_printk + +r1 = bpf$PROG_LOAD(AUTO, &AUTO={0x3, AUTO, &AUTO=@framed={{AUTO, AUTO, AUTO, AUTO, 0x0, AUTO, AUTO, AUTO, 0x0}, [@printk={@integer={AUTO, AUTO, AUTO, AUTO, AUTO, AUTO, AUTO, AUTO, AUTO}, {AUTO, AUTO, AUTO, AUTO, AUTO, AUTO, AUTO}, {AUTO, AUTO, AUTO, AUTO, AUTO, AUTO, AUTO}, {AUTO, AUTO, AUTO, AUTO, AUTO, AUTO, AUTO}, {AUTO, AUTO, AUTO, AUTO, AUTO, AUTO, AUTO}, {AUTO, AUTO, AUTO, AUTO, AUTO, AUTO, 0x1234}, {AUTO, AUTO, AUTO, AUTO}}], {AUTO, AUTO, AUTO, AUTO}}, &AUTO='GPL\x00', 0x0, 0x0, 0x0, 0x0, 0x0, "00000000000000000000000000000000", 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 0xa0) + +r2 = bpf$BPF_PROG_TEST_RUN(AUTO, &AUTO={r1, AUTO, 0x10, 0x10, &AUTO="0000000000000000", &AUTO="0000000000000000", 0x1, AUTO, 0x0, 0x0, 0x0, 0x0, 0x0, AUTO, 0x0}, 0x4c) -- cgit mrf-deployment