Skip to content

Commit cb3d7dd

Browse files
Martin Kellyanakryiko
authored andcommitted
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
1 parent 16058ff commit cb3d7dd

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • tools/testing/selftests/bpf/prog_tests

tools/testing/selftests/bpf/prog_tests/ringbuf.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,10 @@ static void ringbuf_subtest(void)
304304
err = ring_buffer__consume(ringbuf);
305305
CHECK(err < 0, "rb_consume", "failed: %d\b", err);
306306

307+
/* also consume using ring__consume to make sure it works the same */
308+
err = ring__consume(ring);
309+
ASSERT_GE(err, 0, "ring_consume");
310+
307311
/* 3 rounds, 2 samples each */
308312
cnt = atomic_xchg(&sample_cnt, 0);
309313
CHECK(cnt != 6, "cnt", "exp %d samples, got %d\n", 6, cnt);

0 commit comments

Comments
 (0)