selftests/bpf: Add trace_vprintk test prog
authorDave Marchevsky <davemarchevsky@fb.com>
Fri, 17 Sep 2021 18:29:10 +0000 (11:29 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 17 Sep 2021 21:02:06 +0000 (14:02 -0700)
commit7606729fe24e163923430a5df9d50a246b22d287
tree3ef4883927fe379215ff359f4a6d226c672e8b86
parentd313d45a226fdc59739c3da05bbd065f71bae5a6
selftests/bpf: Add trace_vprintk test prog

This commit adds a test prog for vprintk which confirms that:
  * bpf_trace_vprintk is writing to /sys/kernel/debug/tracing/trace_pipe
  * __bpf_vprintk macro works as expected
  * >3 args are printed
  * bpf_printk w/ 0 format args compiles
  * bpf_trace_vprintk call w/ a fmt specifier but NULL fmt data fails

Approach and code are borrowed from trace_printk test.

Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210917182911.2426606-9-davemarchevsky@fb.com
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/prog_tests/trace_vprintk.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/trace_vprintk.c [new file with mode: 0644]