summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2019-11-19 15:28:43 -0700
committerJens Axboe <axboe@kernel.dk>2019-11-19 15:28:43 -0700
commit4bc1af0c10b64e593dd7e521e04d7d2cf0609a59 (patch)
treea60c4c83bdcb28e8fa4503d6bf111bcfb1d45379
parent0cbc36abf26e6700020762ac3e0e684cbacd697d (diff)
downloadliburing-4bc1af0c10b64e593dd7e521e04d7d2cf0609a59.tar.gz
liburing-4bc1af0c10b64e593dd7e521e04d7d2cf0609a59.tar.bz2
Add teardown test case
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--test/Makefile4
-rw-r--r--test/teardowns.c41
2 files changed, 43 insertions, 2 deletions
diff --git a/test/Makefile b/test/Makefile
index 6305d95..97e88ea 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -10,7 +10,7 @@ all_targets += poll poll-cancel ring-leak fsync io_uring_setup io_uring_register
cq-size 8a9973408177-test a0908ae19763-test 232c93d07b74-test \
socket-rw accept timeout-overflow defer read-write io-cancel \
link-timeout cq-overflow link_drain fc2a85cb02ef-test \
- poll-link accept-link fixed-link poll-cancel-ton
+ poll-link accept-link fixed-link poll-cancel-ton teardowns
include ../Makefile.quiet
@@ -28,7 +28,7 @@ test_srcs := poll.c poll-cancel.c ring-leak.c fsync.c io_uring_setup.c \
a0908ae19763-test.c 232c93d07b74-test.c socket-rw.c accept.c \
timeout-overflow.c defer.c read-write.c io-cancel.c link-timeout.c \
cq-overflow.c link_drain.c fc2a85cb02ef-test.c poll-link.c \
- accept-link.c fixed-link.c poll-cancel-ton.c
+ accept-link.c fixed-link.c poll-cancel-ton.c teardowns.c
test_objs := $(patsubst %.c,%.ol,$(test_srcs))
diff --git a/test/teardowns.c b/test/teardowns.c
new file mode 100644
index 0000000..df53a79
--- /dev/null
+++ b/test/teardowns.c
@@ -0,0 +1,41 @@
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+#include "liburing.h"
+
+static void loop(void)
+{
+ int i;
+
+ for (i = 0; i < 1000; i++) {
+ struct io_uring ring;
+ int fd;
+
+ memset(&ring, 0, sizeof(ring));
+ fd = io_uring_queue_init(0xa4, &ring, 0);
+ if (fd >= 0)
+ close(fd);
+ }
+ exit(0);
+}
+
+int main(void)
+{
+ int i;
+
+ for (i = 0; i < 12; i++) {
+ if (!fork()) {
+ loop();
+ break;
+ }
+ }
+
+ sleep(20);
+ return 0;
+}