[CRIU] [PATCH 4/4] zdtm: Introduce per-test criu options

Pavel Emelyanov xemul at parallels.com
Tue Jul 1 07:30:07 PDT 2014


Some tests require custom options for dump and restore. Instead
of hard-coding test names into zdth.sh, introduce the $test.opts
file from which zdtm would pick the needed options.

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 test/zdtm.sh                                   | 24 +++++++-----------------
 test/zdtm/live/static/file_locks00.opts        |  1 +
 test/zdtm/live/static/file_locks01.opts        |  1 +
 test/zdtm/live/static/socket-ext.opts          |  1 +
 test/zdtm/live/static/socket-tcp.opts          |  1 +
 test/zdtm/live/static/socket-tcp6.opts         |  1 +
 test/zdtm/live/static/socket-tcpbuf-local.opts |  1 +
 test/zdtm/live/static/socket-tcpbuf.opts       |  1 +
 test/zdtm/live/static/socket-tcpbuf6.opts      |  1 +
 test/zdtm/live/static/unlink_fstat03.opts      |  1 +
 test/zdtm/live/streaming/socket-tcp.opts       |  1 +
 test/zdtm/live/streaming/socket-tcp6.opts      |  1 +
 12 files changed, 18 insertions(+), 17 deletions(-)
 create mode 100644 test/zdtm/live/static/file_locks00.opts
 create mode 100644 test/zdtm/live/static/file_locks01.opts
 create mode 100644 test/zdtm/live/static/socket-ext.opts
 create mode 100644 test/zdtm/live/static/socket-tcp.opts
 create mode 100644 test/zdtm/live/static/socket-tcp6.opts
 create mode 100644 test/zdtm/live/static/socket-tcpbuf-local.opts
 create mode 100644 test/zdtm/live/static/socket-tcpbuf.opts
 create mode 100644 test/zdtm/live/static/socket-tcpbuf6.opts
 create mode 100644 test/zdtm/live/static/unlink_fstat03.opts
 create mode 100644 test/zdtm/live/streaming/socket-tcp.opts
 create mode 100644 test/zdtm/live/streaming/socket-tcp6.opts

diff --git a/test/zdtm.sh b/test/zdtm.sh
index 89ea46c..d952b9d 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -434,21 +434,11 @@ diff_fds()
 run_test()
 {
 	local test=$1
-	local linkremap=
 	local snappdir=
 	local ps_pid=
 
 	[ -n "$EXCLUDE_PATTERN" ] && echo $test | grep "$EXCLUDE_PATTERN" && return 0
 
-	#
-	# add option for unlinked files test
-	if [[ $1 =~ "unlink_" ]]; then
-		linkremap="--link-remap"
-	fi
-	if [[ $1 =~ "write_read10" ]]; then
-		linkremap="--link-remap"
-	fi
-
 	if [ -n "$MAINSTREAM_KERNEL" ] && [ $COMPILE_ONLY -eq 0 ] && echo $TEST_CR_KERNEL | grep -q ${test#ns/}; then
 		echo "Skip $test"
 		return 0
@@ -483,6 +473,10 @@ run_test()
 		return 1
 	fi
 
+	if [ -f "${test}.opts" ]; then
+		gen_args="$gen_args $(cat "${test}.opts")"
+	fi
+
 	if [ -n "$PIDNS" ]; then
 		[ -z "$CR_IP_TOOL" ] && CR_IP_TOOL=ip
 		if ! $CR_IP_TOOL a help 2>&1 | grep -q showdump; then
@@ -544,8 +538,7 @@ EOF
 
 		save_fds $PID  $ddump/dump.fd
 		save_maps $PID  $ddump/dump.maps
-		setsid $CRIU_CPT $dump_cmd --file-locks --tcp-established $linkremap \
-			-x --evasive-devices -D $ddump -o dump.log -v4 -t $PID $gen_args $cpt_args
+		setsid $CRIU_CPT $dump_cmd -D $ddump -o dump.log -v4 -t $PID $gen_args $cpt_args
 		retcode=$?
 
 		#
@@ -583,10 +576,7 @@ EOF
 				diff_maps $ddump/dump.maps $ddump/dump.maps.after || return 1
 			}
 
-			if [[ $linkremap ]]; then
-				echo "remove ./$tdir/link_remap.*"
-				rm -f ./$tdir/link_remap.*
-			fi
+			rm -f ./$tdir/link_remap.*
 		else
 			# Wait while tasks are dying, otherwise PIDs would be busy.
 			for i in $ddump/core-*.img; do
@@ -603,7 +593,7 @@ EOF
 			done
 
 			echo Restore
-			setsid $CRIU restore --file-locks --tcp-established -x -D $ddump -o restore.log -v4 -d $gen_args || return 2
+			setsid $CRIU restore -D $ddump -o restore.log -v4 -d $gen_args || return 2
 
 			[ -n "$PIDNS" ] && PID=`cat $TPID`
 			for i in `seq 5`; do
diff --git a/test/zdtm/live/static/file_locks00.opts b/test/zdtm/live/static/file_locks00.opts
new file mode 100644
index 0000000..738083a
--- /dev/null
+++ b/test/zdtm/live/static/file_locks00.opts
@@ -0,0 +1 @@
+--file-locks
diff --git a/test/zdtm/live/static/file_locks01.opts b/test/zdtm/live/static/file_locks01.opts
new file mode 100644
index 0000000..738083a
--- /dev/null
+++ b/test/zdtm/live/static/file_locks01.opts
@@ -0,0 +1 @@
+--file-locks
diff --git a/test/zdtm/live/static/socket-ext.opts b/test/zdtm/live/static/socket-ext.opts
new file mode 100644
index 0000000..de36807
--- /dev/null
+++ b/test/zdtm/live/static/socket-ext.opts
@@ -0,0 +1 @@
+--ext-unix-sk
diff --git a/test/zdtm/live/static/socket-tcp.opts b/test/zdtm/live/static/socket-tcp.opts
new file mode 100644
index 0000000..f016a54
--- /dev/null
+++ b/test/zdtm/live/static/socket-tcp.opts
@@ -0,0 +1 @@
+--tcp-established
diff --git a/test/zdtm/live/static/socket-tcp6.opts b/test/zdtm/live/static/socket-tcp6.opts
new file mode 100644
index 0000000..f016a54
--- /dev/null
+++ b/test/zdtm/live/static/socket-tcp6.opts
@@ -0,0 +1 @@
+--tcp-established
diff --git a/test/zdtm/live/static/socket-tcpbuf-local.opts b/test/zdtm/live/static/socket-tcpbuf-local.opts
new file mode 100644
index 0000000..f016a54
--- /dev/null
+++ b/test/zdtm/live/static/socket-tcpbuf-local.opts
@@ -0,0 +1 @@
+--tcp-established
diff --git a/test/zdtm/live/static/socket-tcpbuf.opts b/test/zdtm/live/static/socket-tcpbuf.opts
new file mode 100644
index 0000000..f016a54
--- /dev/null
+++ b/test/zdtm/live/static/socket-tcpbuf.opts
@@ -0,0 +1 @@
+--tcp-established
diff --git a/test/zdtm/live/static/socket-tcpbuf6.opts b/test/zdtm/live/static/socket-tcpbuf6.opts
new file mode 100644
index 0000000..f016a54
--- /dev/null
+++ b/test/zdtm/live/static/socket-tcpbuf6.opts
@@ -0,0 +1 @@
+--tcp-established
diff --git a/test/zdtm/live/static/unlink_fstat03.opts b/test/zdtm/live/static/unlink_fstat03.opts
new file mode 100644
index 0000000..4722946
--- /dev/null
+++ b/test/zdtm/live/static/unlink_fstat03.opts
@@ -0,0 +1 @@
+--link-remap
diff --git a/test/zdtm/live/streaming/socket-tcp.opts b/test/zdtm/live/streaming/socket-tcp.opts
new file mode 100644
index 0000000..f016a54
--- /dev/null
+++ b/test/zdtm/live/streaming/socket-tcp.opts
@@ -0,0 +1 @@
+--tcp-established
diff --git a/test/zdtm/live/streaming/socket-tcp6.opts b/test/zdtm/live/streaming/socket-tcp6.opts
new file mode 100644
index 0000000..f016a54
--- /dev/null
+++ b/test/zdtm/live/streaming/socket-tcp6.opts
@@ -0,0 +1 @@
+--tcp-established
-- 
1.8.4.2




More information about the CRIU mailing list