selftests/bpf: test for bpf_fd2path() from raw tracepoint
Subsystems (5)
PATCH 1/1 selftests/bpf: test for bpf_fd2path() from raw tracepoint
trace fstat events by raw tracepoint sys_enter:newfstat, and handle events only produced by fd2path_loadgen, the fd2path_loadgen call fstat on several different types of files to test bpf_fd2path's feature.
Signed-off-by Wenbo Zhang <[email protected]>
--- tools/testing/selftests/bpf/Makefile | 8 +- tools/testing/selftests/bpf/fd2path_loadgen.c | 75 ++++++++++ .../selftests/bpf/prog_tests/fd2path.c | 130 ++++++++++++++++++ .../selftests/bpf/progs/test_fd2path.c | 58 ++++++++ 4 files changed, 269 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/bpf/fd2path_loadgen.c create mode 100644 tools/testing/selftests/bpf/prog_tests/fd2path.c create mode 100644 tools/testing/selftests/bpf/progs/test_fd2path.c
tools/testing/selftests/bpf/Makefile +6 -2
@@ -72,7 +72,7 @@ TEST_GEN_PROGS_EXTENDED = test_sock_addr test_skb_cgroup_id_user \ flow_dissector_load test_flow_dissector test_tcp_check_syncookie_user \ test_lirc_mode2_user -TEST_CUSTOM_PROGS = urandom_read +TEST_CUSTOM_PROGS = urandom_read fd2path_loadgen include ../lib.mk
@@ -89,6 +89,9 @@ $(notdir $(TEST_GEN_PROGS) \ $(OUTPUT)/urandom_read: urandom_read.c $(CC) -o $@ $< -Wl,--build-id +$(OUTPUT)/fd2path_loadgen: fd2path_loadgen.c + $(CC) -o $@ $< -Wl,--build-id + BPFOBJ := $(OUTPUT)/libbpf.a $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/test_stub.o $(BPFOBJ)
@@ -258,7 +261,8 @@ TRUNNER_TESTS_DIR := prog_tests TRUNNER_BPF_PROGS_DIR := progs TRUNNER_EXTRA_SOURCES := test_progs.c cgroup_helpers.c trace_helpers.c \ flow_dissector_load.h -TRUNNER_EXTRA_FILES := $(OUTPUT)/urandom_read \ +TRUNNER_EXTRA_FILES := $(OUTPUT)/urandom_read \ + $(OUTPUT)/fd2path_loadgen \ $(wildcard progs/btf_dump_test_case_*.c) TRUNNER_BPF_BUILD_RULE := CLANG_BPF_BUILD_RULE TRUNNER_BPF_CFLAGS := -I. -I$(OUTPUT) $(BPF_CFLAGS) $(CLANG_CFLAGS)
tools/testing/selftests/bpf/fd2path_loadgen.c new file +75 -0
75 lines not on this page · raw message
tools/testing/selftests/bpf/prog_tests/fd2path.c new file +130 -0
130 lines not on this page · raw message
tools/testing/selftests/bpf/progs/test_fd2path.c new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
2.17.1