MCPcopy Create free account
hub / github.com/axboe/liburing / test_readv

Function test_readv

test/vec-regbuf.c:612–650  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

610}
611
612static int test_readv(struct buf_desc *bd)
613{
614 void *p = bd->buf_wr;
615 int ret;
616 struct iovec iov_page = { .iov_base = p, .iov_len = page_sz };
617 struct iovec iov_multi[] = {
618 { .iov_base = p, .iov_len = page_sz },
619 { .iov_base = p + page_sz, .iov_len = page_sz },
620 { .iov_base = p + page_sz * 2, .iov_len = page_sz },
621 };
622 struct iovec iov_unalign = { .iov_base = p + 1, .iov_len = page_sz - 1 };
623
624 reinit_ring(bd);
625
626 /* Single page read */
627 ret = test_readv_fixed(bd, &iov_page, 1);
628 if (ret) {
629 fprintf(stderr, "readv_fixed: single page failed\n");
630 return ret;
631 }
632
633 /* Multi-segment read */
634 reinit_ring(bd);
635 ret = test_readv_fixed(bd, iov_multi, 3);
636 if (ret) {
637 fprintf(stderr, "readv_fixed: multi-segment failed\n");
638 return ret;
639 }
640
641 /* Unaligned read */
642 reinit_ring(bd);
643 ret = test_readv_fixed(bd, &iov_unalign, 1);
644 if (ret) {
645 fprintf(stderr, "readv_fixed: unaligned failed\n");
646 return ret;
647 }
648
649 return 0;
650}
651
652static void test_fail(struct buf_desc *bd)
653{

Callers 1

mainFunction · 0.85

Calls 2

reinit_ringFunction · 0.85
test_readv_fixedFunction · 0.85

Tested by

no test coverage detected