[CRIU] [PATCH 8/8] zdtm: Simple test for AIO ring
Pavel Emelyanov
xemul at parallels.com
Fri Oct 10 12:03:02 PDT 2014
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
test/zdtm.sh | 1 +
test/zdtm/live/static/Makefile | 2 ++
test/zdtm/live/static/aio00.c | 36 ++++++++++++++++++++++++++++++++++++
3 files changed, 39 insertions(+)
create mode 100644 test/zdtm/live/static/aio00.c
diff --git a/test/zdtm.sh b/test/zdtm.sh
index 9a2c188..d2ea79a 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
diff --git a/test/zdtm/live/static/Makefile b/test/zdtm/live/static/Makefile
index e9cac39..7876366 100644
--- a/test/zdtm/live/static/Makefile
+++ b/test/zdtm/live/static/Makefile
@@ -115,6 +115,7 @@ TST_NOFILE = \
dumpable01 \
dumpable02 \
remap_dead_pid \
+ aio00 \
# jobctl00 \
TST_FILE = \
@@ -265,6 +266,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