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

Tikhomirov Pavel snorcht at gmail.com
Sun Mar 2 22:36:19 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

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

diff --git a/test/zdtm.sh b/test/zdtm.sh
index ac6b974..bf2c2fa 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -491,11 +491,21 @@ EOF
 			[ -n "$snappdir" ] && snapopt="$snapopt --prev-images-dir=$snappdir"
 		fi
 
+		if [ -n "$AUTO_DEDUP" ]; then
+			dedup_opts=""
+			restore_dedup_opts="--auto-dedup"
+			if [ "$i" -ne 1 ]; then
+				dedup_opts="--auto-dedup"
+			else
+				echo "Deduplication Log" > $ddump/dedup_check.log
+			fi
+		fi
+
 		[ -n "$dump_only" ] && postdump=$POSTDUMP
 
 		save_fds $PID  $ddump/dump.fd
 		save_maps $PID  $ddump/dump.maps
-		setsid $CRIU_CPT $dump_cmd $opts --file-locks --tcp-established $linkremap \
+		setsid $CRIU_CPT $dump_cmd $dedup_opts $opts --file-locks --tcp-established $linkremap \
 			-x --evasive-devices -D $ddump -o dump.log -v4 -t $PID $args $ARGS $snapopt $postdump
 		retcode=$?
 
@@ -554,7 +564,7 @@ EOF
 			done
 
 			echo Restore
-			setsid $CRIU restore --file-locks --tcp-established -x -D $ddump -o restore.log -v4 -d $args || return 2
+			setsid $CRIU restore $restore_dedup_opts --file-locks --tcp-established -x -D $ddump -o restore.log -v4 -d $args || return 2
 
 			[ -n "$PIDNS" ] && PID=`cat $TPID`
 			for i in `seq 5`; do
@@ -586,6 +596,16 @@ EOF
 		[ $sltime -lt 9 ] && sltime=$((sltime+1))
 	done
 
+	if [ -n "$AUTO_DEDUP" ]; then
+		size_last=$(du -sh -BK "$ddump/pages-1.img" | grep -Eo '[0-9]+' | head -1)
+		ls -lahs $ddump/../*/pages-*.img >> $ddump/dedup_check.log
+		echo "Size of pages dump is $size_last"
+		if [ $size_last -ne 0 ]; then
+			echo "Test: $test, Auto-dedup: image size is more than 0"
+			return 2
+		fi
+	fi
+
 	cat $test.out
 	cat $test.out | grep -q PASS || return 2
 	[ "$CLEANUP" -ne 0 ] && rm -rf `dirname $ddump`
@@ -681,6 +701,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 size of last pages img, must be zero.
 EOF
 }
 
@@ -755,6 +776,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