[CRIU] [PATCH] zdtm: Don't test userns tests if no required APIs found

Pavel Emelyanov xemul at parallels.com
Mon Nov 10 05:26:02 PST 2014


Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 test/zdtm.sh | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/test/zdtm.sh b/test/zdtm.sh
index 1eb8701..aebad76 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -244,8 +244,17 @@ ns/static/console
 ns/static/rtc
 "
 
+source $(readlink -f `dirname $0`/env.sh) || exit 1
+
+can_cr_userns() {
+	[ ! -f /proc/self/ns/user ] && return 1
+	$CRIU check | fgrep -q 'PR_SET_MM_MAP is not supported' && return 1
+
+	return 0
+}
+
 # Add tests which can be executed in an user namespace
-test -f /proc/self/ns/user && {
+if can_cr_userns ; then
 	blist=`mktemp /tmp/zdtm.black.XXXXXX`
 	echo "$BLACKLIST_FOR_USERNS" | sort > $blist
 
@@ -255,7 +264,7 @@ test -f /proc/self/ns/user && {
 	diff --changed-group-format="%<" --unchanged-group-format="" - $blist | \
 	sed s#ns/#ns/user/#`"
 	unlink $blist
-}
+fi
 
 TEST_SUID_LIST="
 pid00
@@ -293,8 +302,6 @@ mntns_link_ghost
 sockets00
 "
 
-source $(readlink -f `dirname $0`/env.sh) || exit 1
-
 CRIU_CPT=$CRIU
 TMP_TREE=""
 SCRIPTDIR=`dirname $CRIU`/test
-- 
1.8.4.2



More information about the CRIU mailing list