OSDN Git Service

selftests/bpf: Add testcase for xdp attaching failure tracepoint
authorLeon Hwang <hffilwlqm@gmail.com>
Tue, 1 Aug 2023 14:26:21 +0000 (22:26 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 2 Aug 2023 21:21:12 +0000 (14:21 -0700)
commit7fedbf32fcc779a07abdba1347e759ad52bded2c
tree48d166244fee603c968d23d1c6ddc55767a29566
parentbf4ea1d0b2cb2251f9e5619c81daa98591087c33
selftests/bpf: Add testcase for xdp attaching failure tracepoint

Add a test case for the tracepoint of xdp attaching failure by bpf
tracepoint when attach XDP to a device with invalid flags option.

The bpf tracepoint retrieves error message from the tracepoint, and
then put the error message to a perf buffer. The testing code receives
error message from perf buffer, and then ASSERT "Invalid XDP flags for
BPF link attachment".

Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
Link: https://lore.kernel.org/r/20230801142621.7925-3-hffilwlqm@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/xdp_attach.c
tools/testing/selftests/bpf/progs/test_xdp_attach_fail.c [new file with mode: 0644]