mirror of
https://github.com/NixOS/nix
synced 2024-09-19 10:50:24 -04:00
Add test that mkdir $HOME
fails with permission error
This commit is contained in:
parent
b95af5c672
commit
a1337f5a0c
|
@ -152,6 +152,11 @@ nix build --impure -f multiple-outputs.nix --json e --no-link \
|
||||||
(.outputs | keys == ["a_a", "b"]))
|
(.outputs | keys == ["a_a", "b"]))
|
||||||
'
|
'
|
||||||
|
|
||||||
|
# Make sure that `mkdir $HOME fails with a "Permission denied" error`
|
||||||
|
out="$(nix build -f mkdir-home-failing.nix -L 2>&1)" && status=0 || status=$?
|
||||||
|
test "$status" = 1
|
||||||
|
<<<"$out" grepQuiet -E "Permission denied"
|
||||||
|
|
||||||
# Make sure that `--stdin` works and does not apply any defaults
|
# Make sure that `--stdin` works and does not apply any defaults
|
||||||
printf "" | nix build --no-link --stdin --json | jq --exit-status '. == []'
|
printf "" | nix build --no-link --stdin --json | jq --exit-status '. == []'
|
||||||
printf "%s\n" "$drv^*" | nix build --no-link --stdin --json | jq --exit-status '.[0]|has("drvPath")'
|
printf "%s\n" "$drv^*" | nix build --no-link --stdin --json | jq --exit-status '.[0]|has("drvPath")'
|
||||||
|
|
8
tests/functional/mkdir-home-failing.nix
Normal file
8
tests/functional/mkdir-home-failing.nix
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
with import ./config.nix;
|
||||||
|
mkDerivation {
|
||||||
|
name = "mkdir-home-no-permission";
|
||||||
|
builder = builtins.toFile "builder.sh"
|
||||||
|
''
|
||||||
|
mkdir $HOME
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue