[CRIU] [PATCH 2/2] v6 zdtm: test for auto-dedup on restore

Tikhomirov Pavel snorcht at gmail.com
Tue Mar 11 00:07:57 PDT 2014


if new size of all pages images is zero than dedup works

use :
bash test/zdtm.sh --auto-dedup
bash test/zdtm.sh --auto-dedup static/maps04
bash test/zdtm.sh -P -i 3 --auto-dedup -t transition/maps007

changes: aplicable for all tests, -ad changed to --auto-dedup,
simplify, check all private pages images, check shmem images
and go with shmem patch set.

Signed-off-by: Tikhomirov Pavel <snorcht at gmail.com>
---
 test/zdtm.sh | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/test/zdtm.sh b/test/zdtm.sh
index ac6b974..d7f8fca 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -460,6 +460,11 @@ EOF
 		args="$args -L `pwd`/$tdir/lib"
 	fi
 
+	if [ -n "$AUTO_DEDUP" ]; then
+		args="$args --auto-dedup"
+		ps_args="--auto-dedup"
+	fi
+
 	for i in `seq $ITERATIONS`; do
 		local dump_only=
 		local postdump=
@@ -472,7 +477,7 @@ EOF
 		[ -n "$DUMP_ONLY" ] && dump_only=1
 
 		if [ $PAGE_SERVER -eq 1 ]; then
-			$CRIU page-server -D $ddump -o page_server.log -v4 --port $PS_PORT --daemon || return 1
+			$CRIU page-server -D $ddump -o page_server.log -v4 --port $PS_PORT $ps_args --daemon || return 1
 			ps_pid=`lsof -s TCP:LISTEN -i :$PS_PORT -t`
 			ps -p "$ps_pid" -o cmd h | grep -q page-server || {
 				echo "Unable to determing PID of page-server"
@@ -586,6 +591,18 @@ EOF
 		[ $sltime -lt 9 ] && sltime=$((sltime+1))
 	done
 
+	if [ -n "$AUTO_DEDUP" ]; then
+		for img in $ddump/pages-*.img; do
+			img_name="${img##*/}"
+			size=$(du -sh -BK "$img" | grep -Eo '[0-9]+' | head -1)
+			echo "Size of $img_name is $size"
+			if [ "$size" -ne 0 ]; then
+				echo "Check: $test, Auto-dedup: image size is more than 0"
+				return 2
+			fi
+		done
+	fi
+
 	cat $test.out
 	cat $test.out | grep -q PASS || return 2
 	[ "$CLEANUP" -ne 0 ] && rm -rf `dirname $ddump`
@@ -681,6 +698,7 @@ Options:
 	-v : Verbose mode
 	-P : Make pre-dump instead of dump on all iterations except the last one
 	-s : Make iterative snapshots. Only the last one will be checked.
+	--auto-dedup : Make auto-dedup on restore. Check sizes of pages imges, it must be zero.
 EOF
 }
 
@@ -755,6 +773,10 @@ while :; do
 		SNAPSHOT=1
 		shift
 		;;
+	  --auto-dedup)
+		AUTO_DEDUP=1
+		shift
+		;;
 	  -g)
 		COMPILE_ONLY=1
 		shift
-- 
1.8.3.2



More information about the CRIU mailing list