[PATCH liburing 2/2] tests: fail early invalid linked setups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <asml.silence@xxxxxxxxx>
---
 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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux