-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make --keep-going work with drv that don't have a system #12168
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
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" ]; | ||
}; | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
source common.sh | ||
|
||
clearStore | ||
|
||
mkdir -p "$TEST_ROOT/sync" | ||
# XXX: These invocations of nix-build should always return 100 according to the manpage, but often return 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you create an issue for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, @iFreilicht is the one who discovered the error. Probably could use more details before creating the issue? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, that's all I found out, I don't have more details for you 😬 But it basically happened during testing, so you should be able to reproduce that issue and can then create one with a proper log. This might also be why the tests are failing right now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, alright. I did check the blame and it looks like @Ericson2314 did write some of the worker stuff around where I'm touching. Maybe John has some ideas into getting this to pass. |
||
(! nix-build ./keep-going.nix -j2 --extra-sandbox-paths "$TEST_ROOT/sync" --no-out-link 2>&1 \ | ||
| while read -r ln; do | ||
echo "nix build: $ln" | ||
if echo "$ln" | grepQuiet ...; then | ||
touch "$TEST_ROOT/sync/failing-drv-failed" | ||
fi | ||
done) | ||
(! nix-build ./keep-going.nix -A good -j0 --no-out-link) || \ | ||
fail "Hello shouldn't have been built because of earlier errors" | ||
|
||
clearStore | ||
|
||
(! nix-build ./keep-going.nix --keep-going -j2 --no-out-link) | ||
nix-build ./keep-going.nix -A good -j0 --no-out-link || \ | ||
fail "Hello should have been built despite the errors because of '--keep-going'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be synchronized by waiting for a file to appear in a mutable directory in
extra-sandbox-paths
. The test would have to monitor the CLI's log before creating it.(doing it in the
failing
derivation would only decrease the length of the race condition, but not make it reliable)Something along the lines of
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like that might work? I plugged it in. It doesn't break the tests on my machine.