aboutsummaryrefslogtreecommitdiff
path: root/test/io.c
diff options
context:
space:
mode:
authornodist <kevin.comas.git@gmail.com>2026-10-17 15:41:01 -0400
committernodist <kevin.comas.git@gmail.com>2026-10-17 15:41:01 -0400
commit801aeb9172136ca93a4603fcf8dcf8e19a1522fe (patch)
tree3e55e80388c53188d042bb3ced3dad36c510abf9 /test/io.c
parent6673bb9357b9ed8187f3dcb2917e2c6a9da25ee7 (diff)
add io_uring
Diffstat (limited to 'test/io.c')
-rw-r--r--test/io.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/io.c b/test/io.c
new file mode 100644
index 0000000..2df3144
--- /dev/null
+++ b/test/io.c
@@ -0,0 +1,20 @@
+
+#include "kpl_test.h"
+
+static const char *linux_version = "/proc/version";
+
+KPL_TEST(statx) {
+ kpl_io_uring io_uring = {};
+ KPL_ASSERT(kpl_io_uring_init(&io_uring, KPL_IO_URING_QUEUE_SIZE_POW2_MIN) == 0, "should return 0 for success");
+ struct statx statx_object = {};
+ kpl_object_task *task = calloc(1, sizeof(kpl_object_task) + sizeof(kpl_class) * 1);
+ task->io_res = 1;
+ KPL_ASSERT(kpl_io_uring_statx(&io_uring, task, AT_FDCWD, linux_version, 0, STATX_ALL, &statx_object),
+ "should add statx operation");
+ KPL_ASSERT(kpl_io_uring_submit(&io_uring) == 1, "should submit one io operation");
+ KPL_ASSERT(task == kpl_io_uring_get_completed(&io_uring), "should return a task");
+ KPL_ASSERT(task->io_res == 0, "io_res should have success stax return");
+ KPL_ASSERT(statx_object.stx_nlink > 0, "should have one or more hard link(s)");
+ free(task);
+ kpl_io_uring_free(&io_uring);
+}