From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH liburing 2/2] tests: fail early invalid linked setups
Date: Sun, 15 Aug 2021 10:43:52 +0100 [thread overview]
Message-ID: <d2576c13100bacc00467c9ccfaedca1e71117e97.1629020550.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
We're going to fail links with invalid timeout combinations early. E.g.
op1 -> link timeout -> link timeout
Update tests to handle it.
Signed-off-by: Pavel Begunkov <[email protected]>
---
test/link-timeout.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/test/link-timeout.c b/test/link-timeout.c
index 8c3e203..c8c289c 100644
--- a/test/link-timeout.c
+++ b/test/link-timeout.c
@@ -63,7 +63,7 @@ static int test_fail_two_link_timeouts(struct io_uring *ring)
struct __kernel_timespec ts;
struct io_uring_cqe *cqe;
struct io_uring_sqe *sqe;
- int ret, i;
+ int ret, i, nr_wait;
ts.tv_sec = 1;
ts.tv_nsec = 0;
@@ -114,12 +114,13 @@ static int test_fail_two_link_timeouts(struct io_uring *ring)
sqe->user_data = 4;
ret = io_uring_submit(ring);
- if (ret != 4) {
+ if (ret < 3) {
printf("sqe submit failed: %d\n", ret);
goto err;
}
+ nr_wait = ret;
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < nr_wait; i++) {
ret = io_uring_wait_cqe(ring, &cqe);
if (ret < 0) {
printf("wait completion %d\n", ret);
@@ -981,14 +982,16 @@ static int test_timeout_link_chain5(struct io_uring *ring)
}
switch (cqe->user_data) {
case 1:
- if (cqe->res) {
- fprintf(stderr, "Timeout got %d, wanted -EINVAL\n",
+ case 2:
+ if (cqe->res && cqe->res != -ECANCELED) {
+ fprintf(stderr, "Request got %d, wanted -EINVAL "
+ "or -ECANCELED\n",
cqe->res);
goto err;
}
break;
- case 2:
- if (cqe->res != -ECANCELED) {
+ case 3:
+ if (cqe->res != -ECANCELED && cqe->res != -EINVAL) {
fprintf(stderr, "Link timeout got %d, wanted -ECANCELED\n", cqe->res);
goto err;
}
--
2.32.0
next prev parent reply other threads:[~2021-08-15 9:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-15 9:43 [PATCH liburing 0/2] update linked timeout tests Pavel Begunkov
2021-08-15 9:43 ` [PATCH liburing 1/2] tests: close pipes in link-timeout Pavel Begunkov
2021-08-15 9:43 ` Pavel Begunkov [this message]
2021-08-15 15:15 ` [PATCH liburing 0/2] update linked timeout tests Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d2576c13100bacc00467c9ccfaedca1e71117e97.1629020550.git.asml.silence@gmail.com \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox