summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/prog_tests/ringbuf.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2020-11-30 14:33:35 -0800
committerAlexei Starovoitov <ast@kernel.org>2020-12-01 20:21:45 -0800
commitf6a8250ea1e42ad1f4f3bab01c851ec5fd48f0e7 (patch)
tree8ac1c6128617881180417463ec9ac139bf4a80c8 /tools/testing/selftests/bpf/prog_tests/ringbuf.c
parented1182dc004dbcc7cfe64fb0e8ac520b25431715 (diff)
downloadlinux-f6a8250ea1e42ad1f4f3bab01c851ec5fd48f0e7.tar.bz2
libbpf: Fix ring_buffer__poll() to return number of consumed samples
Fix ring_buffer__poll() to return the number of non-discarded records consumed, just like its documentation states. It's also consistent with ring_buffer__consume() return. Fix up selftests with wrong expected results. Fixes: bf99c936f947 ("libbpf: Add BPF ring buffer support") Fixes: cb1c9ddd5525 ("selftests/bpf: Add BPF ringbuf selftests") Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20201130223336.904192-1-andrii@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/ringbuf.c')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/ringbuf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/ringbuf.c b/tools/testing/selftests/bpf/prog_tests/ringbuf.c
index c1650548433c..1a48c6f7f54e 100644
--- a/tools/testing/selftests/bpf/prog_tests/ringbuf.c
+++ b/tools/testing/selftests/bpf/prog_tests/ringbuf.c
@@ -217,7 +217,7 @@ void test_ringbuf(void)
if (CHECK(err, "join_bg", "err %d\n", err))
goto cleanup;
- if (CHECK(bg_ret != 1, "bg_ret", "epoll_wait result: %ld", bg_ret))
+ if (CHECK(bg_ret <= 0, "bg_ret", "epoll_wait result: %ld", bg_ret))
goto cleanup;
/* 3 rounds, 2 samples each */