[CRIU] [PATCH 3/3] zdtm: execute tests on non C/R kernel

Andrey Vagin avagin at openvz.org
Thu Nov 29 07:43:39 EST 2012


* add exclude list. Tests from this list are executed only on C/R kernels
* check that a version of a kernel is greater than 3.7

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 test/zdtm.sh | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/test/zdtm.sh b/test/zdtm.sh
index d1fcfb8..496a2a5 100644
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -2,6 +2,27 @@
 
 ZP="zdtm/live"
 
+TEST_CR_KERNEL="
+static/sockets00
+static/sockets01
+static/sock_opts01
+static/sockets_spair
+static/sockets_dgram
+static/socket_queues
+static/sk-unix-unconn
+static/cmdlinenv00
+static/socket_listen
+static/socket_listen6
+static/packet_sock
+static/socket_udp
+static/sock_filter
+static/socket6_udp
+static/socket_udplite
+static/eventfs00
+static/signalfd00
+static/inotify00
+"
+
 TEST_LIST="
 static/pipe00
 static/pipe01
@@ -110,6 +131,19 @@ static/sem
 transition/ipc
 "
 
+TEST_CR_KERNEL="
+static/sock_opts01	# getsockopt(SO_BINDTODEVICE)
+static/sockets01	# shutdown
+static/sock_filter	# getsockopt(SO_GET_FILTER)
+static/socket-tcp6
+streaming/socket-tcp6
+static/socket-tcpbuf6
+static/eventfs00
+static/signalfd00
+static/inotify00
+$IPC_TEST_LIST
+"
+
 CRTOOLS=`pwd`/`dirname $0`/../crtools
 TINIT=`pwd`/`dirname $0`/zdtm/lib/test_init
 test -x $CRTOOLS || exit 1
@@ -121,6 +155,32 @@ PIDNS=""
 
 ITERATIONS=1
 
+check_mainstream()
+{
+	local -a ver_arr
+	local ver_str=`uname -r`
+
+	$CRTOOLS check && return 0
+	MAINSTREAM_KERNEL=1
+
+	cat >&2 <<EOF
+============================= WARNING =============================
+Not all C/R features are commited in the meainstream kernel.
+Linux C/R can be cloned from:
+git://git.kernel.org/pub/scm/linux/kernel/git/gorcunov/linux-cr.git
+===================================================================
+EOF
+
+	ver_arr=(`echo ${ver_str//./ }`)
+
+	[ "${ver_arr[0]}" -gt 3 ] && return 0
+	[[ "${ver_arr[0]}" -eq 3 && "${ver_arr[1]}" -ge 7 ]] && return 0
+
+	echo "A version of kernel should be greater or equal to 3.7"
+
+	return 0;
+}
+
 umount_zdtm_root()
 {
 	[ -z "$ZDTM_ROOT" ] && return;
@@ -214,6 +274,11 @@ run_test()
 {
 	local test=$1
 
+	[ -n "$MAINSTREAM_KERNEL" ] && echo $TEST_CR_KERNEL | grep -q ${test#ns/} && {
+		echo "Skip $test"
+		return 0
+	}
+
 	expr "$test" : 'ns/' > /dev/null && PIDNS=1 || PIDNS=""
 	test=${ZP}/${test#ns/}
 
@@ -345,6 +410,9 @@ while :; do
 done
 
 if [ $# -eq 0 ]; then
+
+	check_mainstream || exit 1
+
 	for t in $TEST_LIST; do
 		run_test $t || case_error $t
 	done
-- 
1.7.11.7



More information about the CRIU mailing list