diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2021-10-01 17:12:54 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2021-10-01 17:12:54 +0000 |
commit | 13b6b645897fd2edaa0f09fa48d6fe8dd6287b55 (patch) | |
tree | 0c6fc18fa246115402c9fd0030029d9a4ebde82f /tests | |
parent | f4f3203aa7c2fc9225a8ae220db25593066fb397 (diff) | |
parent | 4f496150eb4e0012914c11f0a3ff4df2412b1d09 (diff) |
Merge remote-tracking branch 'upstream/master' into path-info
Diffstat (limited to 'tests')
-rw-r--r-- | tests/build-remote.sh | 13 | ||||
-rw-r--r-- | tests/failing.nix | 22 |
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/build-remote.sh b/tests/build-remote.sh index 27d85a83d..806c6d261 100644 --- a/tests/build-remote.sh +++ b/tests/build-remote.sh @@ -53,3 +53,16 @@ nix path-info --store $TEST_ROOT/machine3 --all \ | grep -v builder-build-remote-input-1.sh \ | grep -v builder-build-remote-input-2.sh \ | grep builder-build-remote-input-3.sh + +# Behavior of keep-failed +out="$(nix-build 2>&1 failing.nix \ + --builders "$(join_by '; ' "${builders[@]}")" \ + --keep-failed \ + --store $TEST_ROOT/machine0 \ + -j0 \ + --arg busybox $busybox)" || true + +[[ "$out" =~ .*"note: keeping build directory".* ]] + +build_dir="$(grep "note: keeping build" <<< "$out" | sed -E "s/^(.*)note: keeping build directory '(.*)'(.*)$/\2/")" +[[ "foo" = $(<"$build_dir"/bar) ]] diff --git a/tests/failing.nix b/tests/failing.nix new file mode 100644 index 000000000..2a0350d4d --- /dev/null +++ b/tests/failing.nix @@ -0,0 +1,22 @@ +{ busybox }: +with import ./config.nix; +let + + mkDerivation = args: + derivation ({ + inherit system; + builder = busybox; + args = ["sh" "-e" args.builder or (builtins.toFile "builder-${args.name}.sh" "if [ -e .attrs.sh ]; then source .attrs.sh; fi; eval \"$buildCommand\"")]; + } // removeAttrs args ["builder" "meta"]) + // { meta = args.meta or {}; }; +in +{ + + failing = mkDerivation { + name = "failing"; + buildCommand = '' + echo foo > bar + exit 1 + ''; + }; +} |