aboutsummaryrefslogtreecommitdiff
path: root/tests/linux-sandbox.sh
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-06-22 14:23:25 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-06-22 14:29:45 -0400
commit97df060588e4d328a7e219107553087149a77bac (patch)
tree1f6cc6209b382c437757cc438b8f29fa9783a05b /tests/linux-sandbox.sh
parent2291232dc18fe01baceefcbc83e909aa160bd255 (diff)
Better document build failure exit codes
- Improved API docs from comment - Exit codes are for `nix-build`, not just `nix-store --release` - Make note in tests so the magic numbers are not surprising Picking up where #8387 left off.
Diffstat (limited to 'tests/linux-sandbox.sh')
-rw-r--r--tests/linux-sandbox.sh3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/linux-sandbox.sh b/tests/linux-sandbox.sh
index f2a77174d..ff7d257bd 100644
--- a/tests/linux-sandbox.sh
+++ b/tests/linux-sandbox.sh
@@ -36,11 +36,13 @@ nix-sandbox-build dependencies.nix --check
# Test that sandboxed builds with --check and -K can move .check directory to store
nix-sandbox-build check.nix -A nondeterministic
+# `100 + 4` means non-determinstic, see doc/manual/src/command-ref/status-build-failure.md
expectStderr 104 nix-sandbox-build check.nix -A nondeterministic --check -K > $TEST_ROOT/log
grepQuietInverse 'error: renaming' $TEST_ROOT/log
grepQuiet 'may not be deterministic' $TEST_ROOT/log
# Test that sandboxed builds cannot write to /etc easily
+# `100` means build failure without extra info, see doc/manual/src/command-ref/status-build-failure.md
expectStderr 100 nix-sandbox-build -E 'with import ./config.nix; mkDerivation { name = "etc-write"; buildCommand = "echo > /etc/test"; }' |
grepQuiet "/etc/test: Permission denied"
@@ -50,6 +52,7 @@ testCert () {
expectation=$1 # "missing" | "present"
mode=$2 # "normal" | "fixed-output"
certFile=$3 # a string that can be the path to a cert file
+ # `100` means build failure without extra info, see doc/manual/src/command-ref/status-build-failure.md
[ "$mode" == fixed-output ] && ret=1 || ret=100
expectStderr $ret nix-sandbox-build linux-sandbox-cert-test.nix --argstr mode "$mode" --option ssl-cert-file "$certFile" |
grepQuiet "CERT_${expectation}_IN_SANDBOX"