-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11534 from fricklerhandwerk/backport-10652-to-2.1…
…8-maintenance [backport 2.18] libstore: check additionalSandboxProfile
- Loading branch information
Showing
3 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |