[CRIU] [PATCH 5/5]v4 zdtm: test for auto-dedup on restore

Tikhomirov Pavel snorcht at gmail.com
Tue Mar 4 00:13:56 PST 2014


if new size of image is zero than dedup works

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

changes: aplicable for all tests, -ad changed to -A, simplify,
check all(and only) private pages files.

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

diff --git a/test/zdtm.sh b/test/zdtm.sh
index ac6b974..423c2b4 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -460,6 +460,10 @@ EOF
 		args="$args -L `pwd`/$tdir/lib"
 	fi
 
+	if [ -n "$AUTO_DEDUP" ]; then
+		args="$args --auto-dedup"
+	fi
+
 	for i in `seq $ITERATIONS`; do
 		local dump_only=
 		local postdump=
@@ -586,6 +590,30 @@ EOF
 		[ $sltime -lt 9 ] && sltime=$((sltime+1))
 	done
 
+	if [ -n "$AUTO_DEDUP" ]; then
+		for pagemap in $ddump/pagemap-*.img; do
+			has_shmem=$(echo $pagemap | grep "pagemap-shmem")
+			if [ -z "$has_shmem" ]; then
+				img_index=$($CRIU show -f $pagemap | grep "pages_id" | grep -Eo '0x[0-9a-f]+' | head -1 | gawk --non-decimal-data '{ printf "%d", $1 }')
+				if [ -z "$img_index" ]; then
+					echo "Can't parse pages image index"
+					return 2
+				fi
+				echo "Check $img_index image"
+				size=$(du -sh -BK "$ddump/pages-$img_index.img" | grep -Eo '[0-9]+' | head -1)
+				if [ -z "$size" ]; then
+					echo "Can't get size of $img_index pages image"
+					return 2
+				fi
+				echo "Size of pages dump is $size"
+                		if [ $size -ne 0 ]; then
+                        		echo "Check: $test, Auto-dedup: image size is more than 0"
+                        		return 2
+                		fi
+			fi
+		done
+	fi
+
 	cat $test.out
 	cat $test.out | grep -q PASS || return 2
 	[ "$CLEANUP" -ne 0 ] && rm -rf `dirname $ddump`
@@ -681,6 +709,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.
+	-A : Make auto-dedup on restore. Check sizes of pages imges, it must be zero.
 EOF
 }
 
@@ -755,6 +784,10 @@ while :; do
 		SNAPSHOT=1
 		shift
 		;;
+	  -A)
+		AUTO_DEDUP=1
+		shift
+		;;
 	  -g)
 		COMPILE_ONLY=1
 		shift
-- 
1.8.3.2



More information about the CRIU mailing list