diff options
author | Jens Axboe <axboe@kernel.dk> | 2019-04-17 08:57:25 -0600 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-04-17 08:57:25 -0600 |
commit | 26993e98723e1f2d9be94b53068ead1e4a9a849d (patch) | |
tree | 858ad640e2efde42743f64ff7a556a8c68de9a61 /test/sq-full.c | |
parent | 8115820eb9343d4fa49f4933a2fd7d7006796cc3 (diff) |
Add SQ/CQ overflow tests
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'test/sq-full.c')
-rw-r--r-- | test/sq-full.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/sq-full.c b/test/sq-full.c new file mode 100644 index 0000000..5bf7f72 --- /dev/null +++ b/test/sq-full.c @@ -0,0 +1,41 @@ +/* + * Description: test SQ queue full condition + * + */ +#include <errno.h> +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <fcntl.h> + +#include "../src/liburing.h" + +int main(int argc, char *argv[]) +{ + struct io_uring_sqe *sqe; + struct io_uring ring; + int ret, i; + + ret = io_uring_queue_init(8, &ring, 0); + if (ret) { + printf("ring setup failed\n"); + return 1; + + } + + i = 0; + while ((sqe = io_uring_get_sqe(&ring)) != NULL) + i++; + + if (i != 8) { + printf("Got %d SQEs\n", i); + goto err; + } + + io_uring_queue_exit(&ring); + return 0; +err: + io_uring_queue_exit(&ring); + return 1; +} |