generic/317,318: fail gracefully if userns not supported
PATCH 1/1 generic/317,318: fail gracefully if userns not supported
generic/317 and generic/318 fail un-gracefully on older kernels which don't support userns; fix that by running a simple test as a prerequisite and fail gracefully if needed.
---
tests/generic/317 +2 -0
@@ -56,6 +56,8 @@ _supported_os Linux [ -x $nsexec ] || _notrun "$nsexec executable not found" [ -x $lstat64 ] || _notrun "$lstat64 executable not found" +$nsexec -U true 2>/dev/null || _notrun "user namespaces not supported by this kernel" + rm -f $seqres.full _require_scratch
tests/generic/318 +2 -0
@@ -57,6 +57,8 @@ _supported_os Linux [ -x $nsexec ] || _notrun "$nsexec executable not found" +$nsexec -U true 2>/dev/null || _notrun "user namespaces not supported by this kernel" + rm -f $seqres.full _require_scratch
Quoted 12 lines · Eric Sandeen
generic/317 and generic/318 fail un-gracefully on older kernels which don't support userns; fix that by running a simple test as a prerequisite and fail gracefully if needed.
Signed-off-by Eric Sandeen <[email protected]>---
tests/generic/317 +0
-0
tests/generic/317 _supported_os Linux · line 60
Quoted 5 lines
tests/generic/317 +2
-0@@ -56,6 +56,8 @@ _supported_os Linux [ -x $nsexec ] || _notrun "$nsexec executable not found" [ -x $lstat64 ] || _notrun "$lstat64 executable not found" +$nsexec -U true 2>/dev/null || _notrun "user namespaces not supported by this kernel" +
Can you turn this into a _requires_user_namespaces()?
i.e. check for $nsexec and the kernel support in one function.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
PATCH v2 1/1 generic/317,318: fail gracefully if userns not supported
In reply to Eric Sandeengeneric/317 and generic/318 fail un-gracefully on older kernels which don't support userns; fix that by running a simple test as a prerequisite and fail gracefully if needed.
Roll that in with the test for executable presence, and make a new _require_userns()
---
V2: _require_userns
common/rc +6 -0
@@ -2115,6 +2115,12 @@ _require_relatime() _scratch_unmount } +_require_userns() +{ + [ -x src/nsexec ] || _notrun "src/nsexec executable not found" + src/nsexec -U true 2>/dev/null || _notrun "userns not supported by this kernel" +} + _create_loop_device() { file=$1
tests/generic/317 +1 -1
@@ -53,7 +53,6 @@ _supported_fs generic # only Linux supports user namespace _supported_os Linux -[ -x $nsexec ] || _notrun "$nsexec executable not found" [ -x $lstat64 ] || _notrun "$lstat64 executable not found" rm -f $seqres.full
@@ -62,6 +61,7 @@ _require_scratch _need_to_be_root _require_user _require_ugid_map +_require_userns qa_user_id=`grep $qa_user /etc/passwd |awk -F: '{print $3}'` _filter_output()
tests/generic/318 +1 -2
@@ -55,8 +55,6 @@ _supported_fs generic # only Linux supports user namespace _supported_os Linux -[ -x $nsexec ] || _notrun "$nsexec executable not found" - rm -f $seqres.full _require_scratch
@@ -64,6 +62,7 @@ _need_to_be_root _acl_setup_ids _require_acls _require_ugid_map +_require_userns ns_acl1=0 ns_acl2=`expr $acl2 - $acl1` ns_acl3=`expr $acl3 - $acl1`
Quoted 11 lines · Eric Sandeen
Date: Mon, 16 Jun 2014 21:44:05 -0500
From: Eric Sandeen <[email protected]>
To: Eric Sandeen <[email protected]>, [email protected]
Subject: [PATCH V2] generic/317,318: fail gracefully if userns not supportedgeneric/317 and generic/318 fail un-gracefully on older kernels which don't support userns; fix that by running a simple test as a prerequisite and fail gracefully if needed.
Roll that in with the test for executable presence, and make a new
_require_userns()
Looks good.
Quoted 70 lines
Signed-off-by Eric Sandeen <[email protected]>---
V2:
_require_usernscommon/rc +6
-0@@ -2115,6 +2115,12 @@ _require_relatime() _scratch_unmount } +_require_userns() +{ + [ -x src/nsexec ] || _notrun "src/nsexec executable not found" + src/nsexec -U true 2>/dev/null || _notrun "userns not supported by this kernel" +} + _create_loop_device() { file=$1tests/generic/317 +1
-1@@ -53,7 +53,6 @@ _supported_fs generic # only Linux supports user namespace _supported_os Linux -[ -x $nsexec ] || _notrun "$nsexec executable not found" [ -x $lstat64 ] || _notrun "$lstat64 executable not found" rm -f $seqres.full@@ -62,6 +61,7 @@ _require_scratch _need_to_be_root _require_user _require_ugid_map +_require_userns qa_user_id=`grep $qa_user /etc/passwd |awk -F: '{print $3}'` _filter_output()tests/generic/318 +1
-3@@ -55,8 +55,6 @@ _supported_fs generic # only Linux supports user namespace _supported_os Linux -[ -x $nsexec ] || _notrun "$nsexec executable not found" - rm -f $seqres.full _require_scratch@@ -64,6 +62,7 @@ _need_to_be_root _acl_setup_ids _require_acls _require_ugid_map +_require_userns ns_acl1=0 ns_acl2=`expr $acl2 - $acl1` ns_acl3=`expr $acl3 - $acl1` --To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html