[CRIU] [PATCH 9/9] zdtm: Test for HUGE mapping to dump OK

Pavel Emelyanov xemul at parallels.com
Fri Mar 1 11:04:40 EST 2013


Signed-off-by: Pavel Emelyanov <xemul at parallels.com>

---
 test/zdtm.sh                   |  1 +
 test/zdtm/live/static/Makefile |  1 +
 test/zdtm/live/static/maps04.c | 48 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+)
 create mode 100644 test/zdtm/live/static/maps04.c

diff --git a/test/zdtm.sh b/test/zdtm.sh
index a825045..09f258f 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -11,6 +11,7 @@ static/env00
 static/maps00
 static/maps01
 static/maps02
+static/maps04
 static/mprotect00
 static/mtime_mmap
 static/sleeping00
diff --git a/test/zdtm/live/static/Makefile b/test/zdtm/live/static/Makefile
index a888536..43f812c 100644
--- a/test/zdtm/live/static/Makefile
+++ b/test/zdtm/live/static/Makefile
@@ -61,6 +61,7 @@ TST_NOFILE	=				\
 		maps01				\
 		maps02				\
 		maps03				\
+		maps04				\
 		xids00				\
 		groups				\
 		file_fown			\
diff --git a/test/zdtm/live/static/maps04.c b/test/zdtm/live/static/maps04.c
new file mode 100644
index 0000000..86b23e6
--- /dev/null
+++ b/test/zdtm/live/static/maps04.c
@@ -0,0 +1,48 @@
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <linux/limits.h>
+#include "zdtmtst.h"
+
+#define PAGE_SIZE 4096
+#define MEM_SIZE (1L << 29)
+
+const char *test_doc	= "Test big mappings";
+const char *test_author	= "Andrew Vagin <avagin at openvz.org";
+
+int main(int argc, char ** argv)
+{
+	void *m;
+	uint32_t crc;
+
+	test_init(argc, argv);
+
+	m = mmap(NULL, MEM_SIZE, PROT_WRITE | PROT_READ,
+				MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+
+	if (m == MAP_FAILED) {
+		fail();
+		return 1;
+	}
+
+	crc = ~0;
+	datagen(m, MEM_SIZE, &crc);
+
+	test_daemon();
+	test_waitsig();
+
+	crc = ~0;
+	if (datachk(m, MEM_SIZE, &crc))
+		fail("Mem corrupted");
+	else
+		pass();
+
+	return 0;
+}
-- 
1.7.11.7


More information about the CRIU mailing list