mirror of
https://github.com/NixOS/nix
synced 2025-07-09 12:03:55 +02:00
* Negative caching, i.e. caching of build failures. Disabled by
default. This is mostly useful for Hydra.
This commit is contained in:
parent
7024a1ef07
commit
92f525ecf4
7 changed files with 140 additions and 7 deletions
22
tests/negative-caching.sh
Normal file
22
tests/negative-caching.sh
Normal file
|
@ -0,0 +1,22 @@
|
|||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
||||
set +e
|
||||
|
||||
opts="--option build-cache-failure true --print-build-trace"
|
||||
|
||||
# This build should fail, and the failure should be cached.
|
||||
log=$($nixbuild $opts negative-caching.nix -A fail 2>&1) && fail "should fail"
|
||||
echo "$log" | grep -q "@ build-failed" || fail "no build-failed trace"
|
||||
|
||||
# Do it again. The build shouldn't be tried again.
|
||||
log=$($nixbuild $opts negative-caching.nix -A fail 2>&1) && fail "should fail"
|
||||
echo "$log" | grep -q "FAIL" && fail "failed build not cached"
|
||||
echo "$log" | grep -q "@ build-failed .* cached" || fail "trace doesn't say cached"
|
||||
|
||||
# Check that --keep-going works properly with cached failures.
|
||||
log=$($nixbuild $opts --keep-going negative-caching.nix -A depOnFail 2>&1) && fail "should fail"
|
||||
echo "$log" | grep -q "FAIL" && fail "failed build not cached (2)"
|
||||
echo "$log" | grep -q "@ build-failed .* cached" || fail "trace doesn't say cached (2)"
|
||||
echo "$log" | grep -q "@ build-succeeded .*-succeed" || fail "didn't keep going"
|
Loading…
Add table
Add a link
Reference in a new issue