summaryrefslogtreecommitdiff
path: root/test/rw_merge_test.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-04-03 08:44:01 -0600
committerJens Axboe <axboe@kernel.dk>2021-04-03 08:44:01 -0600
commita209abe65befe603311b6fcd861e14d28e3e2f2d (patch)
treecbecaf96c2fb92d3dcdfa4e2b3a9e3dd9066231f /test/rw_merge_test.c
parentf76afee74ed5fe4698b6b9ed4943e9fc08d0714f (diff)
downloadliburing-a209abe65befe603311b6fcd861e14d28e3e2f2d.tar.gz
liburing-a209abe65befe603311b6fcd861e14d28e3e2f2d.tar.bz2
test/rw_merge_test: code cleanups
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'test/rw_merge_test.c')
-rw-r--r--test/rw_merge_test.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/test/rw_merge_test.c b/test/rw_merge_test.c
index 2c60293..43feed4 100644
--- a/test/rw_merge_test.c
+++ b/test/rw_merge_test.c
@@ -13,6 +13,7 @@
#include <unistd.h>
#include "liburing.h"
+#include "helpers.h"
int main(int argc, char *argv[])
{
@@ -27,20 +28,22 @@ int main(int argc, char *argv[])
};
struct __kernel_timespec ts = {.tv_sec = 3, .tv_nsec = 0};
+ if (argc > 1)
+ return 0;
+
ret = pipe(pipe1);
assert(!ret);
fd = open("testfile", O_RDWR | O_CREAT, 0644);
- assert(ret>=0);
+ assert(ret >= 0);
ret = ftruncate(fd, 4096);
assert(!ret);
- ret = io_uring_queue_init(4, &ring, 0);
- if (ret) {
- printf("io_uring_queue_init fail,"
- " please CONFIG_IO_URING kernel config option");
+ ret = t_create_ring(4, &ring, 0);
+ if (ret == T_SETUP_SKIP)
+ return 0;
+ else if (ret < 0)
return 1;
- }
/* REQ1 */
sqe = io_uring_get_sqe(&ring);
@@ -90,6 +93,5 @@ int main(int argc, char *argv[])
io_uring_cqe_seen(&ring, cqe);
io_uring_queue_exit(&ring);
-
return 0;
}