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

Function test_fail

test/vec-regbuf.c:652–703  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

650}
651
652static void test_fail(struct buf_desc *bd)
653{
654 int ret, cqe_ret;
655 void *p = bd->buf_wr;
656 struct iovec iov_0len = { .iov_base = p, .iov_len = 0 };
657 struct iovec iov_0buf = { .iov_base = 0, .iov_len = 1 };
658 struct iovec iov_inv = { .iov_base = (void *)-1U, .iov_len = 1 };
659 struct iovec iov_under = { .iov_base = p - 1, .iov_len = 1 };
660 struct iovec iov_over = { .iov_base = p + bd->size, .iov_len = 1 };
661 struct iovec vecs_0[] = { iov_0len, iov_0len, iov_0len, iov_0len,
662 iov_0len, iov_0len, iov_0len, iov_0len };
663
664 reinit_ring(bd);
665 ret = test_vec(bd, vecs_0, 8, true, &cqe_ret);
666 if (ret || cqe_ret > 0) {
667 fprintf(stderr, "0 length test failed %i, cqe %i\n",
668 ret, cqe_ret);
669 exit(1);
670 }
671
672 reinit_ring(bd);
673 ret = test_vec(bd, &iov_0buf, 1, true, &cqe_ret);
674 if (ret || cqe_ret >= 0) {
675 fprintf(stderr, "0 buf test failed %i, cqe %i\n",
676 ret, cqe_ret);
677 exit(1);
678 }
679
680 reinit_ring(bd);
681 ret = test_vec(bd, &iov_inv, 1, true, &cqe_ret);
682 if (ret || cqe_ret >= 0) {
683 fprintf(stderr, "inv buf test failed %i, cqe %i\n",
684 ret, cqe_ret);
685 exit(1);
686 }
687
688 reinit_ring(bd);
689 ret = test_vec(bd, &iov_under, 1, true, &cqe_ret);
690 if (ret || cqe_ret >= 0) {
691 fprintf(stderr, "inv buf underflow failed %i, cqe %i\n",
692 ret, cqe_ret);
693 exit(1);
694 }
695
696 reinit_ring(bd);
697 ret = test_vec(bd, &iov_over, 1, true, &cqe_ret);
698 if (ret || cqe_ret >= 0) {
699 fprintf(stderr, "inv buf overflow failed %i, cqe %i\n",
700 ret, cqe_ret);
701 exit(1);
702 }
703}
704
705int main(int argc, char *argv[])
706{

Callers 1

mainFunction · 0.85

Calls 2

reinit_ringFunction · 0.85
test_vecFunction · 0.85

Tested by

no test coverage detected