aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/extra-sandbox-profile.nix19
-rw-r--r--tests/functional/extra-sandbox-profile.sh23
-rw-r--r--tests/functional/meson.build1
3 files changed, 43 insertions, 0 deletions
diff --git a/tests/functional/extra-sandbox-profile.nix b/tests/functional/extra-sandbox-profile.nix
new file mode 100644
index 000000000..aa680b918
--- /dev/null
+++ b/tests/functional/extra-sandbox-profile.nix
@@ -0,0 +1,19 @@
+{ destFile, seed }:
+
+with import ./config.nix;
+
+mkDerivation {
+ name = "simple";
+ __sandboxProfile = ''
+ # Allow writing any file in the filesystem
+ (allow file*)
+ '';
+ inherit seed;
+ buildCommand = ''
+ (
+ set -x
+ touch ${destFile}
+ touch $out
+ )
+ '';
+}
diff --git a/tests/functional/extra-sandbox-profile.sh b/tests/functional/extra-sandbox-profile.sh
new file mode 100644
index 000000000..ac3ca036f
--- /dev/null
+++ b/tests/functional/extra-sandbox-profile.sh
@@ -0,0 +1,23 @@
+source common.sh
+
+if [[ $(uname) != Darwin ]]; then skipTest "Need Darwin"; fi
+
+DEST_FILE="${TEST_ROOT}/foo"
+
+testSandboxProfile () (
+ set -e
+
+ sandboxMode="$1"
+
+ rm -f "${DEST_FILE}"
+ nix-build --no-out-link ./extra-sandbox-profile.nix \
+ --option sandbox "$sandboxMode" \
+ --argstr seed "$RANDOM" \
+ --argstr destFile "${DEST_FILE}"
+
+ ls -l "${DEST_FILE}"
+)
+
+testSandboxProfile "false"
+expectStderr 2 testSandboxProfile "true"
+testSandboxProfile "relaxed"
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 3f4a970a7..d0966a60c 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -182,6 +182,7 @@ functional_tests_scripts = [
'debugger.sh',
'plugins.sh',
'test-libstoreconsumer.sh',
+ 'extra-sandbox-profile.sh',
]
# TODO(Qyriad): this will hopefully be able to be removed when we remove the autoconf+Make