[CRIU] [PATCH 5/5] zdtm: Simple test for AIO ring
Pavel Emelyanov
xemul at parallels.com
Fri Dec 19 05:03:21 PST 2014
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
test/zdtm.sh | 2 ++
test/zdtm/live/static/Makefile | 2 ++
test/zdtm/live/static/aio00.c | 36 ++++++++++++++++++++++++++++++++++++
3 files changed, 40 insertions(+)
create mode 100644 test/zdtm/live/static/aio00.c
diff --git a/test/zdtm.sh b/test/zdtm.sh
index 2734054..125cbce 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -20,6 +20,7 @@ static/cwd00
static/cwd01
static/cwd02
static/env00
+static/aio00
static/maps00
static/maps01
static/maps02
@@ -189,6 +190,7 @@ static/remap_dead_pid
TEST_CR_KERNEL="
ns/static/tun
static/timerfd
+static/aio00
"
cat /proc/self/fdinfo/1 | grep -q mnt_id
diff --git a/test/zdtm/live/static/Makefile b/test/zdtm/live/static/Makefile
index 3c78491..34095d5 100644
--- a/test/zdtm/live/static/Makefile
+++ b/test/zdtm/live/static/Makefile
@@ -116,6 +116,7 @@ TST_NOFILE = \
dumpable01 \
dumpable02 \
remap_dead_pid \
+ aio00 \
fd \
# jobctl00 \
@@ -270,6 +271,7 @@ wait_stop:
$(TST): $(LIB)
+aio00: override LDFLAGS += -laio
futex.o: override CFLAGS += -pthread
futex: override LDFLAGS += -pthread
futex-rl.o: override CFLAGS += -pthread
diff --git a/test/zdtm/live/static/aio00.c b/test/zdtm/live/static/aio00.c
new file mode 100644
index 0000000..e8aefe0
--- /dev/null
+++ b/test/zdtm/live/static/aio00.c
@@ -0,0 +1,36 @@
+#include <libaio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "zdtmtst.h"
+
+const char *test_doc = "Check that plain io_setup works";
+const char *test_author = "Pavel Emelianov <xemul at parallels.com>";
+
+int main(int argc, char **argv)
+{
+ int ret;
+ io_context_t ctx = 0;
+
+ test_init(argc, argv);
+
+ if (io_setup(1, &ctx) < 0) {
+ err("Can't setup io ctx");
+ return 1;
+ }
+
+ test_daemon();
+ test_waitsig();
+
+ ret = io_getevents(ctx, 0, 1, NULL, NULL);
+ if (ret != 0) {
+ if (ret < 0)
+ fail("IO ctx lost (%d)", ret);
+ else
+ fail("IO ctx screwed up (%d)", ret);
+ } else
+ pass();
+
+ return 0;
+}
--
1.8.4.2
More information about the CRIU
mailing list