selftests/bpf: Add exponential backoff to map_update_retriable in test_maps
authorYucong Sun <fallentree@fb.com>
Mon, 16 Aug 2021 17:52:50 +0000 (10:52 -0700)
committerAndrii Nakryiko <andrii@kernel.org>
Tue, 17 Aug 2021 02:13:20 +0000 (19:13 -0700)
commit3c3bd542ffbb2ac09631313ede46ae66660ae550
tree03efbc1dcc711a5cc773d714992400082777a323
parent1e1e49df0277815f2c32b2796dc8b53dfcfc38c0
selftests/bpf: Add exponential backoff to map_update_retriable in test_maps

Using a fixed delay of 1 microsecond has proven flaky in slow CPU environment,
e.g. Github Actions CI system. This patch adds exponential backoff with a cap
of 50ms to reduce the flakiness of the test. Initial delay is chosen at random
in the range [0ms, 5ms).

Signed-off-by: Yucong Sun <fallentree@fb.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20210816175250.296110-1-fallentree@fb.com
tools/testing/selftests/bpf/test_maps.c