diff mbox series

[liburing,1/2] Revert "test/nop: kill cqe32 test code"

Message ID a85bf82b68dca4f82fa8c275d5ed7e06cc065034.1655455225.git.asml.silence@gmail.com (mailing list archive)
State New
Headers show
Series use nop CQE32 tests to test some assumptions | expand

Commit Message

Pavel Begunkov June 17, 2022, 8:42 a.m. UTC
This reverts commit e5d017ab9cd9605248db68168ae5451f830e646c.

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

Patch

diff --git a/test/nop.c b/test/nop.c
index 01e41a6..ce223b3 100644
--- a/test/nop.c
+++ b/test/nop.c
@@ -20,6 +20,7 @@  static int test_single_nop(struct io_uring *ring)
 	struct io_uring_cqe *cqe;
 	struct io_uring_sqe *sqe;
 	int ret;
+	bool cqe32 = (ring->flags & IORING_SETUP_CQE32);
 
 	sqe = io_uring_get_sqe(ring);
 	if (!sqe) {
@@ -28,6 +29,10 @@  static int test_single_nop(struct io_uring *ring)
 	}
 
 	io_uring_prep_nop(sqe);
+	if (cqe32) {
+		sqe->addr = 1234;
+		sqe->addr2 = 5678;
+	}
 	sqe->user_data = ++seq;
 
 	ret = io_uring_submit(ring);
@@ -45,6 +50,17 @@  static int test_single_nop(struct io_uring *ring)
 		fprintf(stderr, "Unexpected 0 user_data\n");
 		goto err;
 	}
+	if (cqe32) {
+		if (cqe->big_cqe[0] != 1234) {
+			fprintf(stderr, "Unexpected extra1\n");
+			goto err;
+
+		}
+		if (cqe->big_cqe[1] != 5678) {
+			fprintf(stderr, "Unexpected extra2\n");
+			goto err;
+		}
+	}
 	io_uring_cqe_seen(ring, cqe);
 	return 0;
 err:
@@ -56,6 +72,7 @@  static int test_barrier_nop(struct io_uring *ring)
 	struct io_uring_cqe *cqe;
 	struct io_uring_sqe *sqe;
 	int ret, i;
+	bool cqe32 = (ring->flags & IORING_SETUP_CQE32);
 
 	for (i = 0; i < 8; i++) {
 		sqe = io_uring_get_sqe(ring);
@@ -67,6 +84,10 @@  static int test_barrier_nop(struct io_uring *ring)
 		io_uring_prep_nop(sqe);
 		if (i == 4)
 			sqe->flags = IOSQE_IO_DRAIN;
+		if (cqe32) {
+			sqe->addr = 1234;
+			sqe->addr2 = 5678;
+		}
 		sqe->user_data = ++seq;
 	}
 
@@ -89,6 +110,16 @@  static int test_barrier_nop(struct io_uring *ring)
 			fprintf(stderr, "Unexpected 0 user_data\n");
 			goto err;
 		}
+		if (cqe32) {
+			if (cqe->big_cqe[0] != 1234) {
+				fprintf(stderr, "Unexpected extra1\n");
+				goto err;
+			}
+			if (cqe->big_cqe[1] != 5678) {
+				fprintf(stderr, "Unexpected extra2\n");
+				goto err;
+			}
+		}
 		io_uring_cqe_seen(ring, cqe);
 	}