selftests/bpf: Add bpf_timer test.
authorAlexei Starovoitov <ast@kernel.org>
Thu, 15 Jul 2021 00:54:16 +0000 (17:54 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 15 Jul 2021 20:31:11 +0000 (22:31 +0200)
commit3540f7c6b96a62b581da5aa3d4c5af9408927bef
tree771b22cf946ec9d17b6d2fbdcb0f166995ba9283
parent7ddc80a476c2d599246028af5808d15f9e24c109
selftests/bpf: Add bpf_timer test.

Add bpf_timer test that creates timers in preallocated and
non-preallocated hash, in array and in lru maps.
Let array timer expire once and then re-arm it for 35 seconds.
Arm lru timer into the same callback.
Then arm and re-arm hash timers 10 times each.
At the last invocation of prealloc hash timer cancel the array timer.
Force timer free via LRU eviction and direct bpf_map_delete_elem.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/bpf/20210715005417.78572-11-alexei.starovoitov@gmail.com
tools/testing/selftests/bpf/prog_tests/timer.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/timer.c [new file with mode: 0644]