[CRIU] [PATCH 2/2] zdtm: check a process with many file vma-s

Andrey Vagin avagin at openvz.org
Tue May 17 17:06:04 PDT 2016


From: Andrew Vagin <avagin at virtuozzo.com>

Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 test/zdtm/static/Makefile |  1 +
 test/zdtm/static/maps06.c | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 test/zdtm/static/maps06.c

diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
index 36b9252..6965757 100644
--- a/test/zdtm/static/Makefile
+++ b/test/zdtm/static/Makefile
@@ -152,6 +152,7 @@ TST_NOFILE	=				\
 #		jobctl00			\
 
 TST_FILE	=				\
+		maps06				\
 		write_read00			\
 		write_read01			\
 		write_read02			\
diff --git a/test/zdtm/static/maps06.c b/test/zdtm/static/maps06.c
new file mode 100644
index 0000000..49602e4
--- /dev/null
+++ b/test/zdtm/static/maps06.c
@@ -0,0 +1,39 @@
+#include "zdtmtst.h"
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+const char *test_doc	= "Create a lot of file vma-s";
+const char *test_author	= "Andrei Vagin <avagin at openvz.org>";
+
+char *filename;
+TEST_OPTION(filename, string, "file name", 1);
+
+int main(int argc, char ** argv)
+{
+	int fd, i;
+
+	test_init(argc, argv);
+
+	fd = open(filename, O_RDWR | O_CREAT, 0666);
+	if (fd < 0)
+		return 1;
+
+	ftruncate(fd, 4096);
+
+	for (i = 0; i < 1024; i++) {
+		if (mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FILE, fd, 0) == MAP_FAILED)
+			return 1;
+		if (mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0) == MAP_FAILED)
+			return 1;
+	}
+
+	test_daemon();
+
+	test_waitsig();
+
+	pass();
+
+	return 0;
+}
-- 
2.7.4



More information about the CRIU mailing list