summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/prog_tests/bpftool_map_dump.c
AgeCommit message (Collapse)Author
9 daysselftests/bpf: Test bpftool map dump on maps that can't be iteratedMaxim Skokov
Socket storage can't be iterated from user space. Create a BPF_MAP_TYPE_SK_STORAGE map, attach storage to a socket, pin it, and check that "bpftool map dump" fails with nothing but an error: a JSON error object with -j, no elements on stdout in plain mode, and the reason on stderr. Socket storage always has BTF, so its plain dump goes through the BTF writer and never prints an element count. Check that path with a queue map created without BTF that holds one element: its plain dump must fail without a "Found" line, which bpftool printed as "Found 0 elements" before, and give the reason on stderr. Signed-off-by: Maxim Skokov <skokovmaksimevg@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Quentin Monnet <qmo@kernel.org> Link: https://patch.msgid.link/20261016194825.230433-4-skokovmaksimevg@gmail.com