Add SQ/CQ overflow tests

Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Jens Axboe
2019-04-17 08:57:25 -06:00
parent 8115820eb9
commit 26993e9872
3 changed files with 134 additions and 2 deletions

41
test/sq-full.c Normal file
View File

@@ -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;
}