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

selftests/bpf: Add tests for ring__avail_data_size

Add test for the new API ring__avail_data_size.
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-9-martin.kelly@crowdstrike.com
parent 3b34d297
......@@ -92,7 +92,7 @@ static void ringbuf_subtest(void)
int page_size = getpagesize();
void *mmap_ptr, *tmp_ptr;
struct ring *ring;
unsigned long cons_pos, prod_pos;
unsigned long avail_data, cons_pos, prod_pos;
skel = test_ringbuf_lskel__open();
if (CHECK(!skel, "skel_open", "skeleton open failed\n"))
......@@ -185,6 +185,8 @@ static void ringbuf_subtest(void)
/* verify getting this data directly via the ring object yields the same
* results
*/
avail_data = ring__avail_data_size(ring);
ASSERT_EQ(avail_data, 3 * rec_sz, "ring_avail_size");
cons_pos = ring__consumer_pos(ring);
ASSERT_EQ(cons_pos, 0, "ring_cons_pos");
prod_pos = ring__producer_pos(ring);
......
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