diff options
author | Martin Kelly <martin.kelly@crowdstrike.com> | 2023-09-26 00:50:45 +0300 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2023-09-26 02:22:43 +0300 |
commit | cb3d7dd2d0dbe92ff3ebdd87fefc254f1c89aeeb (patch) | |
tree | 9e1a34b4d5b660644fd67a635d69cb074f864d66 | |
parent | 16058ff28b7eedd62f1643beb841e3bd611674fe (diff) | |
download | linux-cb3d7dd2d0dbe92ff3ebdd87fefc254f1c89aeeb.tar.xz |
selftests/bpf: Add tests for ring__consume
Add tests for new API ring__consume.
Signed-off-by: Martin Kelly <martin.kelly@crowdstrike.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20230925215045.2375758-15-martin.kelly@crowdstrike.com
-rw-r--r-- | tools/testing/selftests/bpf/prog_tests/ringbuf.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/ringbuf.c b/tools/testing/selftests/bpf/prog_tests/ringbuf.c index c23f6c54b373..48c5695b7abf 100644 --- a/tools/testing/selftests/bpf/prog_tests/ringbuf.c +++ b/tools/testing/selftests/bpf/prog_tests/ringbuf.c @@ -304,6 +304,10 @@ static void ringbuf_subtest(void) err = ring_buffer__consume(ringbuf); CHECK(err < 0, "rb_consume", "failed: %d\b", err); + /* also consume using ring__consume to make sure it works the same */ + err = ring__consume(ring); + ASSERT_GE(err, 0, "ring_consume"); + /* 3 rounds, 2 samples each */ cnt = atomic_xchg(&sample_cnt, 0); CHECK(cnt != 6, "cnt", "exp %d samples, got %d\n", 6, cnt); |