aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAleksandr Pashkov <pashkov.alex+github@gmail.com>2018-06-05 23:13:51 +0300
committerAleksandr Pashkov <pashkov.alex+github@gmail.com>2018-06-06 00:41:01 +0300
commit5ee4472b8bd5a3bda25599eb710f2c979e9c8876 (patch)
tree9497406e22f85e15835a7f4932cd584fe43709e2 /tests
parent4ac4f675df3da01b6d814cd328dd3219dd472ac9 (diff)
tests: more robust check for user namespaces availability (canUseSandbox)
Issue https://github.com/NixOS/nix/issues/2165
Diffstat (limited to 'tests')
-rw-r--r--tests/common.sh.in8
1 files changed, 3 insertions, 5 deletions
diff --git a/tests/common.sh.in b/tests/common.sh.in
index 195205988..fddd25b36 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