diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2018-11-07T16·08+0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2018-11-07T16·08+0100 |
commit | 812e39313c2bcf8909b83e1e8bc548a85dcd626c (patch) | |
tree | 74e4b7bffd4db2e6fd3063d8e05da5af7e643610 /tests/common.sh.in | |
parent | 5a3f140856185ae0c6ee9270ad5d5fbc0505e3f2 (diff) |
Enable sandboxing by default
Closes #179.
Diffstat (limited to 'tests/common.sh.in')
-rw-r--r-- | tests/common.sh.in | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/common.sh.in b/tests/common.sh.in index 2ee2f589dae4..6a523ca9d832 100644 --- a/tests/common.sh.in +++ b/tests/common.sh.in @@ -85,16 +85,13 @@ killDaemon() { trap "" EXIT } -canUseSandbox() { - if [[ $(uname) != Linux ]]; then return 1; fi - - if [ ! -L /proc/self/ns/user ]; then - echo "Kernel doesn't support user namespaces, skipping this test..." - return 1 - fi +if [[ $(uname) == Linux ]] && [[ -L /proc/self/ns/user ]] && unshare --user true; then + _canUseSandbox=1 +fi - if ! unshare --user true ; then - echo "Unprivileged user namespaces disabled by sysctl, skipping this test..." +canUseSandbox() { + if [[ ! $_canUseSandbox ]]; then + echo "Sandboxing not supported, skipping this test..." return 1 fi |