selftests/bpf: Add bpf_{update, delete}_map_elem in hashmap iter program
authorYonghong Song <yhs@fb.com>
Wed, 2 Sep 2020 23:53:41 +0000 (16:53 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 4 Sep 2020 00:36:41 +0000 (17:36 -0700)
commit4daab7132731ac5ec9384c8a070cdb9607dc38c8
tree1b6e2a0484ce01d82c58a29824b8c251a334fc8d
parentdc0988bbe1bd41e2fa555e4a6f890b819a34b49b
selftests/bpf: Add bpf_{update, delete}_map_elem in hashmap iter program

Added bpf_{updata,delete}_map_elem to the very map element the
iter program is visiting. Due to rcu protection, the visited map
elements, although stale, should still contain correct values.
  $ ./test_progs -n 4/18
  #4/18 bpf_hash_map:OK
  #4 bpf_iter: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>
Link: https://lore.kernel.org/bpf/20200902235341.2001534-1-yhs@fb.com
tools/testing/selftests/bpf/progs/bpf_iter_bpf_hash_map.c