diff mbox series

[liburing,2/5] tests/msg_ring: test msg_ring with deferred tw

Message ID d9ff19ed95bf0ed7f90de359b2b7b844030948e6.1674523156.git.asml.silence@gmail.com (mailing list archive)
State New
Headers show
Series deferred tw msg_ring tests | expand

Commit Message

Pavel Begunkov Jan. 24, 2023, 1:21 a.m. UTC
Extend msg_ring.c to test IORING_SETUP_DEFER_TASKRUN rings

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 test/msg-ring.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
diff mbox series

Patch

diff --git a/test/msg-ring.c b/test/msg-ring.c
index afe3192..6db7680 100644
--- a/test/msg-ring.c
+++ b/test/msg-ring.c
@@ -254,5 +254,33 @@  int main(int argc, char *argv[])
 
 	pthread_join(thread, &tret);
 
+	io_uring_queue_exit(&ring);
+	io_uring_queue_exit(&ring2);
+	io_uring_queue_exit(&pring);
+
+	if (t_probe_defer_taskrun()) {
+		ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER |
+						    IORING_SETUP_DEFER_TASKRUN);
+		if (ret) {
+			fprintf(stderr, "deferred ring setup failed: %d\n", ret);
+			return T_EXIT_FAIL;
+		}
+
+		ret = test_own(&ring);
+		if (ret) {
+			fprintf(stderr, "test_own deferred failed\n");
+			return T_EXIT_FAIL;
+		}
+
+		for (i = 0; i < 2; i++) {
+			ret = test_invalid(&ring, i);
+			if (ret) {
+				fprintf(stderr, "test_invalid(0) deferred failed\n");
+				return T_EXIT_FAIL;
+			}
+		}
+		io_uring_queue_exit(&ring);
+	}
+
 	return T_EXIT_PASS;
 }