-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure that when `nix-build` runs with `--keep-going` we don't stop the build too early
- Loading branch information
1 parent
bb8fff3
commit be145b2
Showing
3 changed files
with
49 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
with import ./config.nix; | ||
|
||
rec { | ||
|
||
# Hack to get the scheduler to do what we want: The `good` derivation can | ||
# only be built after `delay_good` (which takes a long time to build) while | ||
# the others don't have any dependency. | ||
# This means that if we build this with parallelism (`-j2`), then we can be | ||
# reasonably sure that the failing derivations will be scheduled _before_ the | ||
# `good` one (and so we can check that `--keep-going` works fine) | ||
delay_good = mkDerivation { | ||
name = "delay-good"; | ||
buildCommand = "sleep 3; touch $out"; | ||
}; | ||
|
||
good = mkDerivation { | ||
name = "good"; | ||
buildCommand = "mkdir $out; echo foo > $out/bar"; | ||
delay = delay_good; | ||
}; | ||
|
||
failing = mkDerivation { | ||
name = "failing"; | ||
buildCommand = false; | ||
}; | ||
|
||
requiresFooSystemFeature = mkDerivation { | ||
name = "requires-foo-system-feature"; | ||
buildCommand = "mkdir $out; echo foo > $out/bar"; | ||
requiredSystemFeatures = [ "foo" ]; | ||
}; | ||
|
||
} | ||
|
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,14 @@ | ||
source common.sh | ||
|
||
clearStore | ||
|
||
# XXX: These invocations of nix-build should always return 100 according to the manpage, but often return 1 | ||
(! nix-build ./keep-going.nix -j2) | ||
(! nix-build ./keep-going.nix -A good -j0) || \ | ||
fail "Hello shouldn't have been built because of earlier errors" | ||
|
||
clearStore | ||
|
||
(! nix-build ./keep-going.nix --keep-going -j2) | ||
nix-build ./keep-going.nix -A good -j0 || \ | ||
fail "Hello should have been built despite the errors because of '--keep-going'" |
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