On Wed, Nov 4, 2015 at 4:05 AM, Ludovic Courtès <[email protected]> wrote:
> David Thompson <[email protected]> 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
From a2b6e503c53ed6f4e20474e78f17fac208f4627e Mon Sep 17 00:00:00 2001
From: David Thompson <[email protected]>
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

Reply via email to