about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2018-06-11T09·10+0200
committerGitHub <noreply@github.com>2018-06-11T09·10+0200
commitde71335e4d7e5e7d63149b8d832878d163d13fd4 (patch)
treea1383fe4d66ac4b0b2062067fea09d2b0b8d25c7
parent9c2283cc4aafa5766e164cc0f2e21a2d42dfb0c6 (diff)
parenta717ad7484e098839017a876bba5705975563d08 (diff)
Merge pull request #2211 from unsatcore/master
tests: more robust check for user namespaces availability (canUseSand…
-rw-r--r--release-common.nix2
-rw-r--r--tests/common.sh.in8
2 files changed, 4 insertions, 6 deletions
diff --git a/release-common.nix b/release-common.nix
index d7fb8125f25e..9138c1127843 100644
--- a/release-common.nix
+++ b/release-common.nix
@@ -57,7 +57,7 @@ rec {
       git
       mercurial
     ]
-    ++ lib.optional stdenv.isLinux libseccomp
+    ++ lib.optionals stdenv.isLinux [libseccomp utillinux]
     ++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium
     ++ lib.optional (stdenv.isLinux || stdenv.isDarwin)
       (aws-sdk-cpp.override {
diff --git a/tests/common.sh.in b/tests/common.sh.in
index 195205988afb..fddd25b366bf 100644
--- a/tests/common.sh.in
+++ b/tests/common.sh.in
@@ -94,11 +94,9 @@ canUseSandbox() {
         return 1
     fi
 
-    if [ -e /proc/sys/kernel/unprivileged_userns_clone ]; then
-        if [ "$(cat /proc/sys/kernel/unprivileged_userns_clone)" != 1 ]; then
-            echo "Unprivileged user namespaces disabled by sysctl, skipping this test..."
-            return 1
-        fi
+    if ! unshare --user true ; then
+        echo "Unprivileged user namespaces disabled by sysctl, skipping this test..."
+        return 1
     fi
 
     return 0