Re: [PATCH 8/9] selftests/bpf: Add test for d_path helper

Andrii Nakryiko
2020-05-14T22:48:33Z

On Wed, May 6, 2020 at 6:32 AM Jiri Olsa <jolsa@kernel.org> wrote:
>
> Adding test for d_path helper which is pretty much
> copied from Wenbo Zhang's test for bpf_get_fd_path,
> which never made it in.
>
> I've failed so far to compile the test with <linux/fs.h>
> kernel header, so for now adding 'struct file' with f_path
> member that has same offset as kernel's file object.
>

Switch to using vmlinux.h? It would also be nice to use skeletons
instead of bpf_object__xxx API.

> Original-patch-by: Wenbo Zhang <ethercflow@gmail.com>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
> .../testing/selftests/bpf/prog_tests/d_path.c | 196 ++++++++++++++++++
> .../testing/selftests/bpf/progs/test_d_path.c | 71 +++++++
> 2 files changed, 267 insertions(+)
> create mode 100644 tools/testing/selftests/bpf/prog_tests/d_path.c
> create mode 100644 tools/testing/selftests/bpf/progs/test_d_path.c
> …