Commit cb3d7dd2 authored by Martin Kelly's avatar Martin Kelly Committed by Andrii Nakryiko

selftests/bpf: Add tests for ring__consume

Add tests for new API ring__consume.
Signed-off-by: default avatarMartin Kelly <martin.kelly@crowdstrike.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20230925215045.2375758-15-martin.kelly@crowdstrike.com
parent 16058ff2
...@@ -304,6 +304,10 @@ static void ringbuf_subtest(void) ...@@ -304,6 +304,10 @@ static void ringbuf_subtest(void)
err = ring_buffer__consume(ringbuf); err = ring_buffer__consume(ringbuf);
CHECK(err < 0, "rb_consume", "failed: %d\b", err); 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 */ /* 3 rounds, 2 samples each */
cnt = atomic_xchg(&sample_cnt, 0); cnt = atomic_xchg(&sample_cnt, 0);
CHECK(cnt != 6, "cnt", "exp %d samples, got %d\n", 6, cnt); CHECK(cnt != 6, "cnt", "exp %d samples, got %d\n", 6, cnt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment