@@ -92,7 +92,7 @@ static void ringbuf_subtest(void)
int page_size = getpagesize();
void *mmap_ptr, *tmp_ptr;
struct ring *ring;
- unsigned long avail_data, cons_pos, prod_pos;
+ unsigned long avail_data, ring_size, cons_pos, prod_pos;
skel = test_ringbuf_lskel__open();
if (CHECK(!skel, "skel_open", "skeleton open failed\n"))
@@ -189,6 +189,10 @@ static void ringbuf_subtest(void)
CHECK(avail_data != 3 * rec_sz,
"err_ring_avail_size", "exp %ld, got %ld\n",
3L * rec_sz, avail_data);
+ ring_size = ring__size(ring);
+ CHECK(ring_size != page_size,
+ "err_ring_ring_size", "exp %ld, got %ld\n",
+ (long)page_size, ring_size);
cons_pos = ring__consumer_pos(ring);
CHECK(cons_pos != 0,
"err_ring_cons_pos", "exp %ld, got %ld\n",
Add tests for the new API ring__size. Signed-off-by: Martin Kelly <martin.kelly@crowdstrike.com> --- tools/testing/selftests/bpf/prog_tests/ringbuf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)