]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
selftests/bpf: Add hashmap test for bpf_for_each_map_elem() helper
authorYonghong Song <yhs@fb.com>
Fri, 26 Feb 2021 20:49:33 +0000 (12:49 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 26 Feb 2021 21:23:53 +0000 (13:23 -0800)
commit9de7f0fdab326a37c9f741f0f6c0f1cbc320a5ab
treea7d45e3feb55995cead702f1a7aceb0e5dad9f33
parentf1f9f0d8d737b9a1c5d15635bf5696643626fd39
selftests/bpf: Add hashmap test for bpf_for_each_map_elem() helper

A test case is added for hashmap and percpu hashmap. The test
also exercises nested bpf_for_each_map_elem() calls like
    bpf_prog:
      bpf_for_each_map_elem(func1)
    func1:
      bpf_for_each_map_elem(func2)
    func2:

  $ ./test_progs -n 45
  #45/1 hash_map:OK
  #45 for_each:OK
  Summary: 1/1 PASSED, 0 SKIPPED, 0 FAILED

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210226204933.3885657-1-yhs@fb.com
tools/testing/selftests/bpf/prog_tests/for_each.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/for_each_hash_map_elem.c [new file with mode: 0644]
tools/testing/selftests/bpf/test_progs.h