Commit d96d4276 authored by Yonghong Song's avatar Yonghong Song Committed by Alexei Starovoitov

selftests/bpf: Fix bpftool synctypes checking failure

kernel-patches/bpf failed with error:
  Running bpftool checks...
  Comparing /data/users/ast/net-next/tools/include/uapi/linux/bpf.h (bpf_map_type) and
            /data/users/ast/net-next/tools/bpf/bpftool/map.c (do_help() TYPE):
            {'cgroup_storage_deprecated', 'cgroup_storage'}
  Comparing /data/users/ast/net-next/tools/include/uapi/linux/bpf.h (bpf_map_type) and
            /data/users/ast/net-next/tools/bpf/bpftool/Documentation/bpftool-map.rst (TYPE):
            {'cgroup_storage_deprecated', 'cgroup_storage'}
The selftests/bpf/test_bpftool_synctypes.py runs checking in the above.

The failure is introduced by Commit c4bcfb38("bpf: Implement cgroup storage available
to non-cgroup-attached bpf progs"). The commit introduced BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED
which has the same enum value as BPF_MAP_TYPE_CGROUP_STORAGE.

In test_bpftool_synctypes.py, one test is to compare uapi bpf.h map types and
bpftool supported maps. The tool picks 'cgroup_storage_deprecated' from bpf.h
while bpftool supported map is displayed as 'cgroup_storage'. The test failure
can be fixed by explicitly replacing 'cgroup_storage_deprecated' with 'cgroup_storage'
in uapi bpf.h map types.
Signed-off-by: default avatarYonghong Song <yhs@fb.com>
Reviewed-by: default avatarQuentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/r/20221026163014.470732-1-yhs@fb.comSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 5ed88f81
......@@ -501,6 +501,14 @@ def main():
source_map_types = set(bpf_info.get_map_type_map().values())
source_map_types.discard('unspec')
# BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED and BPF_MAP_TYPE_CGROUP_STORAGE
# share the same enum value and source_map_types picks
# BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED/cgroup_storage_deprecated.
# Replace 'cgroup_storage_deprecated' with 'cgroup_storage'
# so it aligns with what `bpftool map help` shows.
source_map_types.remove('cgroup_storage_deprecated')
source_map_types.add('cgroup_storage')
help_map_types = map_info.get_map_help()
help_map_options = map_info.get_options()
map_info.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment