[CRIU] [PATCH 5/5]v2 zdtm: test for auto-dedup on restore
Pavel Emelyanov
xemul at parallels.com
Wed Feb 19 07:19:39 PST 2014
On 02/19/2014 06:56 PM, Tikhomirov Pavel wrote:
> if new size of image is zero than dedup works
>
> use :
> bash test/zdtm.sh -ad static/maps04
> bash test/zdtm.sh -P -i 3 -ad -t transition/maps007
Andrey?
> Signed-off-by: Tikhomirov Pavel <snorcht at gmail.com>
> ---
> test/zdtm.sh | 39 +++++++++++++++++++++++++++++++++++++--
> 1 file changed, 37 insertions(+), 2 deletions(-)
>
> diff --git a/test/zdtm.sh b/test/zdtm.sh
> index 3cb96e3..ca568ee 100755
> --- a/test/zdtm.sh
> +++ b/test/zdtm.sh
> @@ -102,6 +102,7 @@ static/stopped
> static/chroot
> static/chroot-file
> static/rtc
> +transition/maps007
> "
> # Duplicate list with ns/ prefix
> TEST_LIST=$TEST_LIST$(echo $TEST_LIST | tr ' ' '\n' | sed 's#^#ns/#')
> @@ -154,6 +155,12 @@ chroot
> chroot-file
> rtc
> tempfs
> +maps007
> +"
> +
> +TEST_AUTO_DEDUP_RESTORE_LIST="
> +maps04
> +maps007
> "
>
> source $(readlink -f `dirname $0`/env.sh) || exit 1
> @@ -487,11 +494,22 @@ EOF
> [ -n "$snappdir" ] && snapopt="$snapopt --prev-images-dir=$snappdir"
> fi
>
> + if [ -n "$AUTO_DEDUP" ]; then
> + dedup_opts=""
> + restore_dedup_opts=""
> + if echo $TEST_AUTO_DEDUP_RESTORE_LIST | grep -q $tname; then
> + restore_dedup_opts="--auto-dedup"
> + if [ "$i" -ne 1 ]; then
> + dedup_opts="--auto-dedup"
> + fi
> + 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=$?
>
> @@ -550,7 +568,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
> @@ -582,6 +600,18 @@ EOF
> [ $sltime -lt 9 ] && sltime=$((sltime+1))
> done
>
> + if [ -n "$AUTO_DEDUP" ]; then
> + if echo $TEST_AUTO_DEDUP_RESTORE_LIST | grep -q $tname; then
> + size_last=$(du -sh -BK "$ddump/pages-1.img" | grep -Eo '[0-9]+' | head -1)
> + ls -lahs $ddump/../*/pages-*.img
> + 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
> + fi
> +
> cat $test.out
> cat $test.out | grep -q PASS || return 2
> [ "$CLEANUP" -ne 0 ] && rm -rf `dirname $ddump`
> @@ -677,6 +707,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.
> + -ad : Make auto-dedup on restore. Check size of last pages img, must be zero.
> EOF
> }
>
> @@ -751,6 +782,10 @@ while :; do
> SNAPSHOT=1
> shift
> ;;
> + -ad)
> + AUTO_DEDUP=1
> + shift
> + ;;
> -g)
> COMPILE_ONLY=1
> shift
>
More information about the CRIU
mailing list