unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] tests: Skip 'guix environment --container' tests in some cases.
@ 2015-11-04  3:10 David Thompson
  2015-11-04  9:05 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: David Thompson @ 2015-11-04  3:10 UTC (permalink / raw)
  To: guix-devel, ludo

Hey Ludo,

Took a stab at fixing the guix-environment-container.sh tests when the
necessary features aren't available.  GuixSD systems don't have
/proc/sys/kernel/unprivileged_userns_clone so I couldn't verify that
code path works as intended.  All I can say is that the tests still pass
on my machine as they did before.

WDYT?  Did I make it in time for the release?

Thanks,

- Dave

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

* Re: [PATCH] tests: Skip 'guix environment --container' tests in some cases.
  2015-11-04  3:10 [PATCH] tests: Skip 'guix environment --container' tests in some cases David Thompson
@ 2015-11-04  9:05 ` Ludovic Courtès
  2015-11-04 14:05   ` Thompson, David
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2015-11-04  9:05 UTC (permalink / raw)
  To: David Thompson; +Cc: guix-devel

David Thompson <dthompson2@worcester.edu> skribis:

> Took a stab at fixing the guix-environment-container.sh tests when the
> necessary features aren't available.  GuixSD systems don't have
> /proc/sys/kernel/unprivileged_userns_clone so I couldn't verify that
> code path works as intended.  All I can say is that the tests still pass
> on my machine as they did before.
>
> WDYT?  Did I make it in time for the release?

Sounds good in principle, but you forgot to attach the patch.  :-)

Ludo’.

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

* Re: [PATCH] tests: Skip 'guix environment --container' tests in some cases.
  2015-11-04  9:05 ` Ludovic Courtès
@ 2015-11-04 14:05   ` Thompson, David
  2015-11-04 22:41     ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Thompson, David @ 2015-11-04 14:05 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 702 bytes --]

On Wed, Nov 4, 2015 at 4:05 AM, Ludovic Courtès <ludo@gnu.org> wrote:
> David Thompson <dthompson2@worcester.edu> skribis:
>
>> Took a stab at fixing the guix-environment-container.sh tests when the
>> necessary features aren't available.  GuixSD systems don't have
>> /proc/sys/kernel/unprivileged_userns_clone so I couldn't verify that
>> code path works as intended.  All I can say is that the tests still pass
>> on my machine as they did before.
>>
>> WDYT?  Did I make it in time for the release?
>
> Sounds good in principle, but you forgot to attach the patch.  :-)

Ugh.  Then I also forgot to reply-all and sent the patch to you only.
Double ugh.  Sorry about this.

- Dave

[-- Attachment #2: 0001-tests-Skip-guix-environment-container-tests-in-some-.patch --]
[-- Type: text/x-diff, Size: 1251 bytes --]

From a2b6e503c53ed6f4e20474e78f17fac208f4627e Mon Sep 17 00:00:00 2001
From: David Thompson <dthompson2@worcester.edu>
Date: Tue, 3 Nov 2015 22:05:26 -0500
Subject: [PATCH] tests: Skip 'guix environment --container' tests in some
 cases.

The tests in tests/guix-environment-container.sh cannot be performed
unless the system supports user namespaces.

* tests/guix-environment-container.sh: Skip if feature tests fail.
---
 tests/guix-environment-container.sh | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tests/guix-environment-container.sh b/tests/guix-environment-container.sh
index 141fd16..9e75ac5 100644
--- a/tests/guix-environment-container.sh
+++ b/tests/guix-environment-container.sh
@@ -22,6 +22,25 @@
 
 set -e
 
+# Perform some feature tests to determine if the tests are applicable.
+if test -f /proc/self/ns/user -a \
+        -f /proc/self/setgroups
+then
+    if test -f /proc/sys/kernel/unprivileged_userns_clone
+    then
+        if test $(cat /proc/sys/kernel/unprivileged_userns_clone) = "1"
+        then
+            true
+        else
+            exit 77
+        fi
+    else
+        true
+    fi
+else
+    exit 77
+fi
+
 guix environment --version
 
 tmpdir="t-guix-environment-$$"
-- 
2.5.0


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

* Re: [PATCH] tests: Skip 'guix environment --container' tests in some cases.
  2015-11-04 14:05   ` Thompson, David
@ 2015-11-04 22:41     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2015-11-04 22:41 UTC (permalink / raw)
  To: Thompson, David; +Cc: guix-devel

"Thompson, David" <dthompson2@worcester.edu> skribis:

> From a2b6e503c53ed6f4e20474e78f17fac208f4627e Mon Sep 17 00:00:00 2001
> From: David Thompson <dthompson2@worcester.edu>
> Date: Tue, 3 Nov 2015 22:05:26 -0500
> Subject: [PATCH] tests: Skip 'guix environment --container' tests in some
>  cases.
>
> The tests in tests/guix-environment-container.sh cannot be performed
> unless the system supports user namespaces.
>
> * tests/guix-environment-container.sh: Skip if feature tests fail.

[...]

> +# Perform some feature tests to determine if the tests are applicable.
> +if test -f /proc/self/ns/user -a \
> +        -f /proc/self/setgroups
> +then
> +    if test -f /proc/sys/kernel/unprivileged_userns_clone
> +    then
> +        if test $(cat /proc/sys/kernel/unprivileged_userns_clone) = "1"

Looks good, but please use `cat foo` instead of $(cat foo), for
compatibility with non-Bash Bourne shells, and also square brackets
instead of ‘test’ for conciseness.

Thank you!

Ludo’.

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

end of thread, other threads:[~2015-11-04 22:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-04  3:10 [PATCH] tests: Skip 'guix environment --container' tests in some cases David Thompson
2015-11-04  9:05 ` Ludovic Courtès
2015-11-04 14:05   ` Thompson, David
2015-11-04 22:41     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).