[CRIU] [PATCH] zdtm: Check how auto-dedup works

Pavel Emelyanov xemul at parallels.com
Thu Nov 26 10:55:00 PST 2015


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

---

diff --git a/test/jenkins/criu-dedup.sh b/test/jenkins/criu-dedup.sh
new file mode 100755
index 0000000..6f3c861
--- /dev/null
+++ b/test/jenkins/criu-dedup.sh
@@ -0,0 +1,11 @@
+# Check auto-deduplication of pagemaps
+set -e
+source `dirname $0`/criu-lib.sh
+prep
+./test/zdtm.py run --all --report report --parallel 4 -f h --pre 2 --dedup -x maps04 -x maps007 || fail
+
+# Additionally run these two as they touch a lot of
+# memory and it makes sense to additionally check it
+# with delays petween iterations
+./test/zdtm.py run -t zdtm/live/transition/maps007 --report report -f h --pre 8:.1 --dedup || fail
+./test/zdtm.py run -t zdtm/live/static/mem-touch   --report report -f h --pre 8:.1 --dedup || fail
diff --git a/test/zdtm.py b/test/zdtm.py
index aca5469..a889e0f 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -474,6 +474,7 @@ class criu_cli:
 		self.__restore_sibling = (opts['sibling'] and True or False)
 		self.__fault = (opts['fault'])
 		self.__sat = (opts['sat'] and True or False)
+		self.__dedup = (opts['dedup'] and True or False)
 
 	def logs(self):
 		return self.__dump_path
@@ -545,12 +546,19 @@ class criu_cli:
 
 		if self.__page_server:
 			print "Adding page server"
-			self.__criu_act("page-server", opts = [ "--port", "12345", \
-					"--daemon", "--pidfile", "ps.pid"])
+
+			ps_opts = [ "--port", "12345", "--daemon", "--pidfile", "ps.pid" ]
+			if self.__dedup:
+				ps_opts += [ "--auto-dedup" ]
+
+			self.__criu_act("page-server", opts = ps_opts)
 			a_opts += ["--page-server", "--address", "127.0.0.1", "--port", "12345"]
 
 		a_opts += self.__test.getdopts()
 
+		if self.__dedup:
+			a_opts += [ "--auto-dedup" ]
+
 		self.__criu_act(action, opts = a_opts + opts)
 
 		if self.__page_server:
@@ -733,7 +741,8 @@ class launcher:
 		self.__nr += 1
 		self.__show_progress()
 
-		nd = ('nocr', 'norst', 'pre', 'iters', 'page_server', 'sibling', 'fault', 'keep_img', 'report', 'snaps', 'sat')
+		nd = ('nocr', 'norst', 'pre', 'iters', 'page_server', 'sibling', \
+				'fault', 'keep_img', 'report', 'snaps', 'sat', 'dedup')
 		arg = repr((name, desc, flavor, { d: self.__opts[d] for d in nd }))
 		log = name.replace('/', '_') + ".log"
 		sub = subprocess.Popen(["./zdtm_ct", "zdtm.py"], \
@@ -951,6 +960,7 @@ rp.add_argument("-x", "--exclude", help = "Exclude tests from --all run", action
 rp.add_argument("--sibling", help = "Restore tests as siblings", action = 'store_true')
 rp.add_argument("--pre", help = "Do some pre-dumps before dump (n[:pause])")
 rp.add_argument("--snaps", help = "Instead of pre-dumps do full dumps", action = 'store_true')
+rp.add_argument("--dedup", help = "Auto-deduplicate images on iterations", action = 'store_true')
 rp.add_argument("--nocr", help = "Do not CR anything, just check test works", action = 'store_true')
 rp.add_argument("--norst", help = "Don't restore tasks, leave them running after dump", action = 'store_true')
 rp.add_argument("--iters", help = "Do CR cycle several times before check (n[:pause])")
diff --git a/test/zdtm/live/static/mem-touch.c b/test/zdtm/live/static/mem-touch.c
index ac17f6f..c14b480 100644
--- a/test/zdtm/live/static/mem-touch.c
+++ b/test/zdtm/live/static/mem-touch.c
@@ -32,13 +32,14 @@ int main(int argc, char **argv)
 	test_daemon();
 	while (test_go()) {
 		unsigned pfn;
+		struct timespec req = { .tv_sec = 0, .tv_nsec = 100000, };
 
 		pfn = random() % MEM_PAGES;
 		*(unsigned *)(mem + pfn * PAGE_SIZE) = rover;
 		backup[pfn] = rover;
 		test_msg("t %u %u\n", pfn, rover);
 		rover++;
-		sleep(1);
+		nanosleep(&req, NULL);
 	}
 	test_waitsig();
 



More information about the CRIU mailing list