public inbox for [email protected]
 help / color / mirror / Atom feed
From: Dylan Yudaken <[email protected]>
To: <[email protected]>, <[email protected]>
Cc: <[email protected]>, <[email protected]>,
	Dylan Yudaken <[email protected]>
Subject: [PATCH liburing 3/4] test: poll-mshot-overflow use proper return codes
Date: Thu, 21 Jul 2022 07:42:28 -0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

This missed out on the refactor, so do it now in preparation for adding a
skip path.

Signed-off-by: Dylan Yudaken <[email protected]>
---
 test/poll-mshot-overflow.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/test/poll-mshot-overflow.c b/test/poll-mshot-overflow.c
index 078df04294fc..17039f585a77 100644
--- a/test/poll-mshot-overflow.c
+++ b/test/poll-mshot-overflow.c
@@ -10,6 +10,7 @@
 #include <sys/wait.h>
 
 #include "liburing.h"
+#include "helpers.h"
 
 int check_final_cqe(struct io_uring *ring)
 {
@@ -22,23 +23,23 @@ int check_final_cqe(struct io_uring *ring)
 			count++;
 			if (signalled_no_more) {
 				fprintf(stderr, "signalled no more!\n");
-				return 1;
+				return T_EXIT_FAIL;
 			}
 			if (!(cqe->flags & IORING_CQE_F_MORE))
 				signalled_no_more = true;
 		} else if (cqe->user_data != 3) {
 			fprintf(stderr, "%d: got unexpected %d\n", count, (int)cqe->user_data);
-			return 1;
+			return T_EXIT_FAIL;
 		}
 		io_uring_cqe_seen(ring, cqe);
 	}
 
 	if (!count) {
 		fprintf(stderr, "no cqe\n");
-		return 1;
+		return T_EXIT_FAIL;
 	}
 
-	return 0;
+	return T_EXIT_PASS;
 }
 
 int main(int argc, char *argv[])
@@ -54,7 +55,7 @@ int main(int argc, char *argv[])
 
 	if (pipe(pipe1) != 0) {
 		perror("pipe");
-		return 1;
+		return T_EXIT_FAIL;
 	}
 
 	struct io_uring_params params = {
@@ -65,20 +66,20 @@ int main(int argc, char *argv[])
 	ret = io_uring_queue_init_params(2, &ring, &params);
 	if (ret) {
 		fprintf(stderr, "ring setup failed: %d\n", ret);
-		return 1;
+		return T_EXIT_FAIL;
 	}
 
 	sqe = io_uring_get_sqe(&ring);
 	if (!sqe) {
 		fprintf(stderr, "get sqe failed\n");
-		return 1;
+		return T_EXIT_FAIL;
 	}
 	io_uring_prep_poll_multishot(sqe, pipe1[0], POLLIN);
 	io_uring_sqe_set_data64(sqe, 1);
 
 	if (io_uring_cq_ready(&ring)) {
 		fprintf(stderr, "unexpected cqe\n");
-		return 1;
+		return T_EXIT_FAIL;
 	}
 
 	for (i = 0; i < 2; i++) {
@@ -95,18 +96,18 @@ int main(int argc, char *argv[])
 
 	if (ret <= 0) {
 		fprintf(stderr, "write failed: %d\n", errno);
-		return 1;
+		return T_EXIT_FAIL;
 	}
 
 	/* should have 2 cqe + 1 overflow now, so take out two cqes */
 	for (i = 0; i < 2; i++) {
 		if (io_uring_peek_cqe(&ring, &cqe)) {
 			fprintf(stderr, "unexpectedly no cqe\n");
-			return 1;
+			return T_EXIT_FAIL;
 		}
 		if (cqe->user_data != 2) {
 			fprintf(stderr, "unexpected user_data\n");
-			return 1;
+			return T_EXIT_FAIL;
 		}
 		io_uring_cqe_seen(&ring, cqe);
 	}
@@ -119,7 +120,7 @@ int main(int argc, char *argv[])
 
 	if (ret != 1) {
 		fprintf(stderr, "bad poll remove\n");
-		return 1;
+		return T_EXIT_FAIL;
 	}
 
 	ret = check_final_cqe(&ring);
-- 
2.30.2


  parent reply	other threads:[~2022-07-21 14:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-21 14:42 [PATCH liburing 0/4] tests updates Dylan Yudaken
2022-07-21 14:42 ` [PATCH liburing 1/4] add a test for bad buf_ring register Dylan Yudaken
2022-07-21 14:42 ` [PATCH liburing 2/4] Copy IORING_SETUP_SINGLE_ISSUER into io_uring.h Dylan Yudaken
2022-07-21 14:42 ` Dylan Yudaken [this message]
2022-07-21 14:42 ` [PATCH liburing 4/4] skip poll-mshot-overflow on old kernels Dylan Yudaken
2022-07-21 14:57   ` Ammar Faizi
2022-07-21 15:26 ` [PATCH liburing 0/4] tests updates 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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [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