[CRIU] Re: The first prize is given to Stas. Congrats!

Andrew Vagin avagin at parallels.com
Fri Feb 17 03:03:27 EST 2012


--- dump/ipc_namespace/6741/dump.fd	2012-02-17 11:01:26.000000000 +0300
+++ dump/ipc_namespace/6741/restore.fd	2012-02-17 11:01:27.000000000 +0300
@@ -2,3 +2,7 @@ total 0
 lrwx------ 1 root root 64 Feb 17 11:01 0 -> /dev/null
 lrwx------ 1 root root 64 Feb 17 11:01 1 -> /dev/null
 lrwx------ 1 root root 64 Feb 17 11:01 2 -> /dev/null
+lr-x------ 1 root root 64 Feb 17 11:01 3 -> /root/crtools/test/dump/ipc_namespace/6741/ipcns-var-6741.img
+lr-x------ 1 root root 64 Feb 17 11:01 4 -> /root/crtools/test/dump/ipc_namespace/6741/ipcns-shm-6741.img
+lr-x------ 1 root root 64 Feb 17 11:01 5 -> /root/crtools/test/dump/ipc_namespace/6741/ipcns-msg-6741.img
+lr-x------ 1 root root 64 Feb 17 11:01 6 -> /root/crtools/test/dump/ipc_namespace/6741/ipcns-sem-6741.img


On Fri, Feb 17, 2012 at 11:01:08AM +0300, Andrey Vagin wrote:
> 
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
>  test/zdtm.sh |   22 +++++++++++++++++++++-
>  1 files changed, 21 insertions(+), 1 deletions(-)
> 

> diff --git a/test/zdtm.sh b/test/zdtm.sh
> index 40a73d5..36c494b 100644
> --- a/test/zdtm.sh
> +++ b/test/zdtm.sh
> @@ -49,6 +49,21 @@ CRTOOLS=`pwd`/`dirname $0`/../crtools
>  test -x $CRTOOLS || exit 1
>  ARGS=""
>  
> +save_fds()
> +{
> +	ls -l /proc/$1/fd | sed 's/\(-> \(pipe\|socket\)\):.*/\1/' > $2
> +}
> +
> +diff_fds()
> +{
> +	if ! diff -up $1 $2; then
> +		echo ERROR: Sets of descriptors are differ:
> +		echo $1
> +		echo $2
> +		return 1
> +	fi
> +}
> +
>  run_test()
>  {
>  	local test=$ZP/$1
> @@ -67,12 +82,14 @@ run_test()
>  
>  	echo Dump $pid
>  	mkdir -p $ddump
> +	save_fds $pid  $ddump/dump.fd
>  	setsid $CRTOOLS dump -D $ddump -o dump.log -t $pid $args $ARGS || {
>  		echo WARNING: process $tname is left running for your debugging needs
>  		return 1
>  	}
> -
>  	if expr " $ARGS" : ' -s'; then
> +		save_fds $pid  $ddump/dump.fd.after
> +		diff_fds $ddump/dump.fd $ddump/dump.fd.after || return 1
>  		killall -CONT $tname
>  	else
>  		while :; do
> @@ -83,6 +100,9 @@ run_test()
>  
>  		echo Restore $pid
>  		setsid $CRTOOLS restore -D $ddump -o restore.log -d -t $pid $args || return 2
> +
> +		save_fds $pid  $ddump/restore.fd
> +		diff_fds $ddump/dump.fd $ddump/restore.fd || return 2
>  	fi
>  
>  	echo Check results $pid



More information about the CRIU mailing list