FS/XFS testing framework
 help / color / mirror / Atom feed
* [PATCH] generic/317,318: fail gracefully if userns not supported
@ 2014-06-13 21:33 Eric Sandeen
  2014-06-17  2:10 ` Dave Chinner
  2014-06-17  2:44 ` [PATCH V2] " Eric Sandeen
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Sandeen @ 2014-06-13 21:33 UTC (permalink / raw)
  To: fstests

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 <sandeen@redhat.com>
---

diff --git a/tests/generic/317 b/tests/generic/317
index e016a42..8919db2 100755
--- a/tests/generic/317
+++ b/tests/generic/317
@@ -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
diff --git a/tests/generic/318 b/tests/generic/318
index 0bfbba0..0212712 100755
--- a/tests/generic/318
+++ b/tests/generic/318
@@ -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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] generic/317,318: fail gracefully if userns not supported
  2014-06-13 21:33 [PATCH] generic/317,318: fail gracefully if userns not supported Eric Sandeen
@ 2014-06-17  2:10 ` Dave Chinner
  2014-06-17  2:44 ` [PATCH V2] " Eric Sandeen
  1 sibling, 0 replies; 4+ messages in thread
From: Dave Chinner @ 2014-06-17  2:10 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: fstests

On Fri, Jun 13, 2014 at 04:33:46PM -0500, Eric Sandeen wrote:
> 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 <sandeen@redhat.com>
> ---
> 
> diff --git a/tests/generic/317 b/tests/generic/317
> index e016a42..8919db2 100755
> --- a/tests/generic/317
> +++ b/tests/generic/317
> @@ -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.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH V2] generic/317,318: fail gracefully if userns not supported
  2014-06-13 21:33 [PATCH] generic/317,318: fail gracefully if userns not supported Eric Sandeen
  2014-06-17  2:10 ` Dave Chinner
@ 2014-06-17  2:44 ` Eric Sandeen
  2014-06-17  7:46   ` Lukáš Czerner
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Sandeen @ 2014-06-17  2:44 UTC (permalink / raw)
  To: Eric Sandeen, fstests

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.

Roll that in with the test for executable presence, and make
a new _require_userns()

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

V2: _require_userns

diff --git a/common/rc b/common/rc
index f27ee53..97ac862 100644
--- a/common/rc
+++ b/common/rc
@@ -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
diff --git a/tests/generic/317 b/tests/generic/317
index e016a42..efa37c7 100755
--- a/tests/generic/317
+++ b/tests/generic/317
@@ -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()
diff --git a/tests/generic/318 b/tests/generic/318
index 0bfbba0..8237434 100755
--- a/tests/generic/318
+++ b/tests/generic/318
@@ -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`


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] generic/317,318: fail gracefully if userns not supported
  2014-06-17  2:44 ` [PATCH V2] " Eric Sandeen
@ 2014-06-17  7:46   ` Lukáš Czerner
  0 siblings, 0 replies; 4+ messages in thread
From: Lukáš Czerner @ 2014-06-17  7:46 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Eric Sandeen, fstests

On Mon, 16 Jun 2014, Eric Sandeen wrote:

> Date: Mon, 16 Jun 2014 21:44:05 -0500
> From: Eric Sandeen <sandeen@sandeen.net>
> To: Eric Sandeen <sandeen@redhat.com>, fstests@vger.kernel.org
> Subject: [PATCH V2] 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.
> 
> Roll that in with the test for executable presence, and make
> a new _require_userns()

Looks good.

Reviewed-by: Lukas Czerner <lczerner@redhat.com>

> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> 
> V2: _require_userns
> 
> diff --git a/common/rc b/common/rc
> index f27ee53..97ac862 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -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
> diff --git a/tests/generic/317 b/tests/generic/317
> index e016a42..efa37c7 100755
> --- a/tests/generic/317
> +++ b/tests/generic/317
> @@ -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()
> diff --git a/tests/generic/318 b/tests/generic/318
> index 0bfbba0..8237434 100755
> --- a/tests/generic/318
> +++ b/tests/generic/318
> @@ -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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-17  7:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-13 21:33 [PATCH] generic/317,318: fail gracefully if userns not supported Eric Sandeen
2014-06-17  2:10 ` Dave Chinner
2014-06-17  2:44 ` [PATCH V2] " Eric Sandeen
2014-06-17  7:46   ` Lukáš Czerner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox