Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9c4ab7d

Browse files
committedMay 19, 2021
Add a test for the “two glibc” issue
1 parent 7234cf3 commit 9c4ab7d

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
source ./common.sh
2+
3+
sed -i 's/experimental-features .*/& ca-derivations ca-references/' "$NIX_CONF_DIR"/nix.conf
4+
5+
export REMOTE_STORE_DIR="$TEST_ROOT/remote_store"
6+
export REMOTE_STORE="file://$REMOTE_STORE_DIR"
7+
8+
rm -rf $REMOTE_STORE_DIR
9+
clearStore
10+
11+
nix copy --to "$REMOTE_STORE" -f nondeterministic.nix dep1
12+
clearStore
13+
sleep 2 # To make sure that `$(date)` will be different
14+
nix build -f nondeterministic.nix dep2
15+
nix build --substituters "$REMOTE_STORE" -f nondeterministic.nix dep1 --no-require-sigs
16+
nix build -f nondeterministic.nix toplevel

‎tests/ca/nondeterministic.nix

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
with import ./config.nix;
2+
3+
let mkCADerivation = args: mkDerivation ({
4+
__contentAddressed = true;
5+
outputHashMode = "recursive";
6+
outputHashAlgo = "sha256";
7+
} // args);
8+
in
9+
10+
rec {
11+
currentTime = mkCADerivation {
12+
name = "current-time";
13+
buildCommand = ''
14+
mkdir $out
15+
echo $(date) > $out/current-time
16+
'';
17+
};
18+
dep = seed: mkCADerivation {
19+
name = "dep";
20+
inherit seed;
21+
buildCommand = ''
22+
echo ${currentTime} > $out
23+
'';
24+
};
25+
dep1 = dep 1;
26+
dep2 = dep 2;
27+
toplevel = mkCADerivation {
28+
name = "toplevel";
29+
buildCommand = ''
30+
test ${dep1} == ${dep2}
31+
touch $out
32+
'';
33+
};
34+
}
35+

‎tests/local.mk

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ nix_tests = \
4444
build.sh \
4545
compute-levels.sh \
4646
ca/build.sh \
47+
ca/duplicate-realisation-in-closure.sh \
4748
ca/substitute.sh \
4849
ca/signatures.sh \
4950
ca/nix-run.sh \

0 commit comments

Comments
 (0)
Please sign in to comment.