Skip to content

Commit

Permalink
test/fd-install: test IOSQE_ASYNC as well with creds
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
axboe committed Jan 23, 2024
1 parent bc576ca commit 919bc46
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions test/fd-install.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ static int test_working(struct io_uring *ring)
return T_EXIT_PASS;
}

static int test_creds(struct io_uring *ring)
static int test_creds(struct io_uring *ring, int async)
{
struct io_uring_sqe *sqe;
struct io_uring_cqe *cqe;
Expand All @@ -332,6 +332,8 @@ static int test_creds(struct io_uring *ring)
/* check that asking for creds fails */
sqe = io_uring_get_sqe(ring);
io_uring_prep_fixed_fd_install(sqe, 0, 0);
if (async)
sqe->flags |= IOSQE_ASYNC;
sqe->personality = cred_id;
io_uring_submit(ring);

Expand Down Expand Up @@ -409,10 +411,17 @@ int main(int argc, char *argv[])
return ret;
}

ret = test_creds(&ring);
ret = test_creds(&ring, 0);
if (ret != T_EXIT_PASS) {
if (ret == T_EXIT_FAIL)
fprintf(stderr, "test_creds failed\n");
fprintf(stderr, "test_creds 0 failed\n");
return ret;
}

ret = test_creds(&ring, 1);
if (ret != T_EXIT_PASS) {
if (ret == T_EXIT_FAIL)
fprintf(stderr, "test_creds 1 failed\n");
return ret;
}

Expand Down

0 comments on commit 919bc46

Please sign in to comment.