-
-
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.
Properly lock the builds of CA derivations
Make sure that we can’t build the same derivation twice at the same time. Fix #5029
- Loading branch information
1 parent
1af3f63
commit 8707773
Showing
4 changed files
with
42 additions
and
2 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
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,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Ensure that we can’t build twice the same derivation concurrently. | ||
# Regression test for https://github.com/NixOS/nix/issues/5029 | ||
|
||
source common.sh | ||
|
||
sed -i 's/experimental-features .*/& ca-derivations ca-references/' "$NIX_CONF_DIR"/nix.conf | ||
|
||
export NIX_TESTS_CA_BY_DEFAULT=1 | ||
|
||
clearStore | ||
|
||
for i in {0..5}; do | ||
nix build --no-link --file ./racy.nix & | ||
done | ||
|
||
wait |
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,15 @@ | ||
# A derivation that would certainly fail if several builders tried to | ||
# build it at once. | ||
|
||
|
||
with import ./config.nix; | ||
|
||
mkDerivation { | ||
name = "simple"; | ||
buildCommand = '' | ||
mkdir $out | ||
echo bar >> $out/foo | ||
sleep 3 | ||
[[ "$(cat $out/foo)" == bar ]] | ||
''; | ||
} |
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