diff mbox series

[liburing,2/2] run link_drain test with defer_taskrun too

Message ID 20230127111133.2551653-3-dylany@meta.com (mailing list archive)
State New
Headers show
Series liburing: patches for drain bug | expand

Commit Message

Dylan Yudaken Jan. 27, 2023, 11:11 a.m. UTC
Defer_taskrun seems to expose odd codepaths, so also run link_drain tests
using it.

Signed-off-by: Dylan Yudaken <dylany@meta.com>
---
 test/link_drain.c | 34 ++++++++++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/test/link_drain.c b/test/link_drain.c
index 1a50c10d181d..86b0aa8db7fe 100644
--- a/test/link_drain.c
+++ b/test/link_drain.c
@@ -198,15 +198,17 @@  err:
 
 }
 
-int main(int argc, char *argv[])
+static int test_drain(bool defer)
 {
 	struct io_uring ring;
 	int i, ret;
+	unsigned int flags = 0;
 
-	if (argc > 1)
-		return 0;
+	if (defer)
+		flags = IORING_SETUP_SINGLE_ISSUER |
+			IORING_SETUP_DEFER_TASKRUN;
 
-	ret = io_uring_queue_init(100, &ring, 0);
+	ret = io_uring_queue_init(100, &ring, flags);
 	if (ret) {
 		printf("ring setup failed\n");
 		return 1;
@@ -227,3 +229,27 @@  int main(int argc, char *argv[])
 
 	return ret;
 }
+
+int main(int argc, char *argv[])
+{
+	int ret;
+
+	if (argc > 1)
+		return T_EXIT_SKIP;
+
+	ret = test_drain(false);
+	if (ret) {
+		fprintf(stderr, "test_drain(false) failed\n");
+		return T_EXIT_FAIL;
+	}
+
+	if (t_probe_defer_taskrun()) {
+		ret = test_drain(true);
+		if (ret) {
+			fprintf(stderr, "test_drain(true) failed\n");
+			return T_EXIT_FAIL;
+		}
+	}
+
+	return T_EXIT_PASS;
+}