summaryrefslogtreecommitdiff
path: root/test/nop.c
diff options
context:
space:
mode:
authorStefan Roesch <shr@fb.com>2022-04-25 11:26:39 -0700
committerJens Axboe <axboe@kernel.dk>2022-05-16 09:31:16 -0600
commit855ffa0d9fc7875ada65ec23a086489dac59e2c9 (patch)
tree29704abb41c7a849e8e5a55baf2ac79f995fc67b /test/nop.c
parenta2b20bcad03706101c3fffe77f0ced1ebcc1b9ff (diff)
downloadliburing-855ffa0d9fc7875ada65ec23a086489dac59e2c9.tar.gz
liburing-855ffa0d9fc7875ada65ec23a086489dac59e2c9.tar.bz2
liburing: Test all configurations with NOP test
This runs the NOP test with all four configurations: - default SQE and CQE size - large SQE size - large CQE size - large SQE and large CQE size Signed-off-by: Stefan Roesch <shr@fb.com> Link: https://lore.kernel.org/r/20220425182639.2446370-7-shr@fb.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'test/nop.c')
-rw-r--r--test/nop.c43
1 files changed, 13 insertions, 30 deletions
diff --git a/test/nop.c b/test/nop.c
index 8656373..59da22c 100644
--- a/test/nop.c
+++ b/test/nop.c
@@ -11,6 +11,7 @@
#include <fcntl.h>
#include "liburing.h"
+#include "test.h"
static int seq;
@@ -127,12 +128,14 @@ err:
return 1;
}
-static int test_p(struct io_uring_params *p)
+static int test_ring(unsigned flags)
{
struct io_uring ring;
+ struct io_uring_params p = { };
int ret;
- ret = io_uring_queue_init_params(8, &ring, p);
+ p.flags = flags;
+ ret = io_uring_queue_init_params(8, &ring, &p);
if (ret) {
fprintf(stderr, "ring setup failed: %d\n", ret);
return 1;
@@ -150,29 +153,11 @@ static int test_p(struct io_uring_params *p)
goto err;
}
- io_uring_queue_exit(&ring);
- return 0;
err:
io_uring_queue_exit(&ring);
return ret;
}
-static int test_normal_ring(void)
-{
- struct io_uring_params p = { };
-
- return test_p(&p);
-}
-
-static int test_big_ring(void)
-{
- struct io_uring_params p = { };
-
- p.flags = IORING_SETUP_SQE128;
- return test_p(&p);
-}
-
-
int main(int argc, char *argv[])
{
int ret;
@@ -180,17 +165,15 @@ int main(int argc, char *argv[])
if (argc > 1)
return 0;
- ret = test_normal_ring();
- if (ret) {
- fprintf(stderr, "Normal ring test failed\n");
- return ret;
- }
-
- ret = test_big_ring();
- if (ret) {
- fprintf(stderr, "Big ring test failed\n");
- return ret;
+ FOR_ALL_TEST_CONFIGS {
+ fprintf(stderr, "Testing %s config\n", IORING_GET_TEST_CONFIG_DESCRIPTION());
+ ret = test_ring(IORING_GET_TEST_CONFIG_FLAGS());
+ if (ret) {
+ fprintf(stderr, "Normal ring test failed\n");
+ return ret;
+ }
}
+ fprintf(stderr, "PASS\n");
return 0;
}