Skip to content

Commit

Permalink
test/fixed-hugepage: skip test on -ENOMEM
Browse files Browse the repository at this point in the history
User/system doesn't have enough resources, just skip the test.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
axboe committed Sep 27, 2024
1 parent b6658a9 commit 206650f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/fixed-hugepage.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ static int register_submit(struct io_uring *ring, struct iovec *iov,

ret = io_uring_register_buffers(ring, iov, nr_bufs);
if (ret) {
fprintf(stderr, "Error registering buffers: %s\n", strerror(-ret));
if (ret != -ENOMEM)
fprintf(stderr, "Error registering buffers: %s\n", strerror(-ret));
return ret;
}

Expand Down Expand Up @@ -282,6 +283,8 @@ static int test_one_hugepage(struct io_uring *ring, int fd_in, int fd_out)

ret = register_submit(ring, iov, NR_BUFS, fd_in, fd_out);
unmap(iov, NR_BUFS, 0);
if (ret == -ENOMEM)
return T_EXIT_SKIP;
return ret ? T_EXIT_FAIL : T_EXIT_PASS;
}

Expand All @@ -296,6 +299,8 @@ static int test_multi_hugepages(struct io_uring *ring, int fd_in, int fd_out)

ret = register_submit(ring, iov, NR_BUFS, fd_in, fd_out);
unmap(iov, NR_BUFS, 0);
if (ret == -ENOMEM)
return T_EXIT_SKIP;
return ret ? T_EXIT_FAIL : T_EXIT_PASS;
}

Expand All @@ -311,6 +316,8 @@ static int test_unaligned_hugepage(struct io_uring *ring, int fd_in, int fd_out)

ret = register_submit(ring, iov, NR_BUFS, fd_in, fd_out);
unmap(iov, NR_BUFS, offset);
if (ret == -ENOMEM)
return T_EXIT_SKIP;
return ret ? T_EXIT_FAIL : T_EXIT_PASS;
}

Expand All @@ -326,6 +333,8 @@ static int test_multi_unaligned_mthps(struct io_uring *ring, int fd_in, int fd_o

ret = register_submit(ring, iov, NR_BUFS, fd_in, fd_out);
free_bufs(iov, NR_BUFS, offset);
if (ret == -ENOMEM)
return T_EXIT_SKIP;
return ret ? T_EXIT_FAIL : T_EXIT_PASS;
}

Expand All @@ -341,6 +350,8 @@ static int test_page_mixture(struct io_uring *ring, int fd_in, int fd_out, int h

ret = register_submit(ring, iov, NR_BUFS, fd_in, fd_out);
unmap(iov, NR_BUFS, 0);
if (ret == -ENOMEM)
return T_EXIT_SKIP;
return ret ? T_EXIT_FAIL : T_EXIT_PASS;
}

Expand Down

0 comments on commit 206650f

Please sign in to comment.