selftests/bpf: Add arraymap test for bpf_for_each_map_elem() helper
authorYonghong Song <yhs@fb.com>
Fri, 26 Feb 2021 20:49:34 +0000 (12:49 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 26 Feb 2021 21:23:53 +0000 (13:23 -0800)
commit6b9e3331347ee9e84fe5c71d3eba7ec204f9bb25
treeab8a104aef4dfda8e7f437a936e385b36dba4975
parent9de7f0fdab326a37c9f741f0f6c0f1cbc320a5ab
selftests/bpf: Add arraymap test for bpf_for_each_map_elem() helper

A test is added for arraymap and percpu arraymap. The test also
exercises the early return for the helper which does not
traverse all elements.
    $ ./test_progs -n 45
    #45/1 hash_map:OK
    #45/2 array_map:OK
    #45 for_each:OK
    Summary: 1/2 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/20210226204934.3885756-1-yhs@fb.com
tools/testing/selftests/bpf/prog_tests/for_each.c
tools/testing/selftests/bpf/progs/for_each_array_map_elem.c [new file with mode: 0644]