[PATCH 2/3] zdtm: Use "post-dump" script for "-d" option, v3

Cyrill Gorcunov gorcunov at openvz.org
Fri Jul 12 15:08:01 EDT 2013


https://bugzilla.openvz.org/show_bug.cgi?id=2583

Note -s option remains internally for easier parsing if --script was used.

v2:
 - Use special opcode 32 to distinguish error cases
 - Use --scripts for snapshot testings

v3:
 - test for both 32 and 0 for error code

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 test/post-dump.sh |  9 +++++++++
 test/zdtm.sh      | 17 ++++++++++++-----
 2 files changed, 21 insertions(+), 5 deletions(-)
 create mode 100755 test/post-dump.sh

diff --git a/test/post-dump.sh b/test/post-dump.sh
new file mode 100755
index 0000000..8cc6fed
--- /dev/null
+++ b/test/post-dump.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+[ $CRTOOLS_SCRIPT_ACTION == post-dump ] && {
+	#
+	# Special code to inform CRIU that
+	# it should turn off repair mode
+	# on sockets.
+        exit 32
+}
diff --git a/test/zdtm.sh b/test/zdtm.sh
index 9749b90..c17da54 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -153,6 +153,8 @@ sk-netlink
 CRIU=$(readlink -f `dirname $0`/../criu)
 CRIU_CPT=$CRIU
 TMP_TREE=""
+SCRIPTDIR=`dirname $CRIU`/test/
+POSTDUMP="--action-script $SCRIPTDIR/post-dump.sh"
 
 test -x $CRIU || {
 	echo "$CRIU is unavailable"
@@ -389,10 +391,14 @@ EOF
 
 		save_fds $PID  $ddump/dump.fd
 		setsid $CRIU_CPT dump $opts --file-locks --tcp-established $linkremap \
-			-x --evasive-devices -D $ddump -o dump.log -v4 -t $PID $args $ARGS $snapopt || {
-			echo WARNING: process $tname is left running for your debugging needs
-			return 1
-		}
+			-x --evasive-devices -D $ddump -o dump.log -v4 -t $PID $args $ARGS $snapopt
+		retcode=$?
+		if [ $retcode -ne 0 ]; then
+			if [ $retcode -ne 32 ]; then
+				echo WARNING: process $tname is left running for your debugging needs
+				return 1
+			fi
+		fi
 
 		if [ -n "$SNAPSHOT" ]; then
 			snappdir=../`basename $ddump`
@@ -499,7 +505,7 @@ cd `dirname $0` || exit 1
 
 while :; do
 	if [ "$1" = "-d" ]; then
-		ARGS="-s"
+		ARGS="-s $POSTDUMP"
 		shift
 		continue
 	fi
@@ -554,6 +560,7 @@ while :; do
 	fi
 	if [ "$1" = "-s" ]; then
 		SNAPSHOT=1
+		ARGS="-s $POSTDUMP"
 		shift
 		continue
 	fi
-- 
1.8.1.4


--T4sUOijqQbZv57TR--


More information about the CRIU mailing list