From 689719e0a1f139e28e57a4df334d5fde354b3379 Mon Sep 17 00:00:00 2001 From: nodist Date: Tue, 20 Oct 2026 14:11:31 -0400 Subject: config parse cli arguments --- test/config.c | 18 ++++++++++++++++++ test/io.c | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 test/config.c (limited to 'test') diff --git a/test/config.c b/test/config.c new file mode 100644 index 0000000..eb5d0ca --- /dev/null +++ b/test/config.c @@ -0,0 +1,18 @@ + +#include "kpl_test.h" + +KPL_TEST(set_thread_count) { + kpl_env env = {}; + int32_t argc = 4; + char *argv[] = {"./kpl", "-t", "4", "file.kpl"}; + KPL_ASSERT(kpl_env_config(&env, argc, argv) == KPL_EXIT_CODE_SUCCESS, "Should return success"); + KPL_ASSERT(env.thread_count == 4, "Threads should not be -1"); +} + +KPL_TEST(set_io_uring_queue_pow2_size) { + kpl_env env = {}; + int32_t argc = 4; + char *argv[] = {"./kpl", "-i", "12", "file.kpl"}; + KPL_ASSERT(kpl_env_config(&env, argc, argv) == KPL_EXIT_CODE_SUCCESS, "Should return success"); + KPL_ASSERT(env.io_uring_queue_size_pow2 != KPL_IO_URING_QUEUE_SIZE_POW2_DEFAULT, "Should not be default"); +} diff --git a/test/io.c b/test/io.c index 8a269fa..3dba03e 100644 --- a/test/io.c +++ b/test/io.c @@ -11,8 +11,10 @@ KPL_TEST(statx) { 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(task->object_flags & KPL_OBJECT_FLAGS_IO_PENDING , "task should have io pending flag"); 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->object_flags & KPL_OBJECT_FLAGS_IO_PENDING) , "task should not have io pending flag"); 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); -- cgit v1.2.3