mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 05:56:15 +02:00
tests/check.sh: Fix a race
Fixes this random failure: error: hash mismatch in fixed-output derivation '/tmp/nix-shell.EUgAVU/nix-test/tests/check/store/sfps3l3c5n7dabpx34kigxnfhmrwk2h6-dummy.drv': specified: sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= got: sha256-0qhPS4tlCTfsj3PNi+LHSt1akRumTfJ0WO2CKdqASiY= which happens because multiple tests were writing to ./dummy.
This commit is contained in:
parent
2c853e2a58
commit
02dd6bb610
3 changed files with 5 additions and 4 deletions
|
@ -9,7 +9,7 @@ echo $path2
|
||||||
if test "$path1" != "$path2"; then
|
if test "$path1" != "$path2"; then
|
||||||
echo "nix-store --add and --add-fixed mismatch"
|
echo "nix-store --add and --add-fixed mismatch"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
path3=$(nix-store --add-fixed sha256 ./dummy)
|
path3=$(nix-store --add-fixed sha256 ./dummy)
|
||||||
echo $path3
|
echo $path3
|
||||||
|
|
|
@ -44,7 +44,7 @@ with import ./config.nix;
|
||||||
};
|
};
|
||||||
|
|
||||||
hashmismatch = import <nix/fetchurl.nix> {
|
hashmismatch = import <nix/fetchurl.nix> {
|
||||||
url = "file://" + toString ./dummy;
|
url = "file://" + builtins.getEnv "TMPDIR" + "/dummy";
|
||||||
sha256 = "0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73";
|
sha256 = "0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -74,12 +74,13 @@ nix-build check.nix -A fetchurl --no-out-link --check
|
||||||
nix-build check.nix -A fetchurl --no-out-link --repair
|
nix-build check.nix -A fetchurl --no-out-link --repair
|
||||||
[[ $(cat $path) != foo ]]
|
[[ $(cat $path) != foo ]]
|
||||||
|
|
||||||
|
echo 'Hello World' > $TMPDIR/dummy
|
||||||
nix-build check.nix -A hashmismatch --no-out-link || status=$?
|
nix-build check.nix -A hashmismatch --no-out-link || status=$?
|
||||||
[ "$status" = "102" ]
|
[ "$status" = "102" ]
|
||||||
|
|
||||||
echo -n > ./dummy
|
echo -n > $TMPDIR/dummy
|
||||||
nix-build check.nix -A hashmismatch --no-out-link
|
nix-build check.nix -A hashmismatch --no-out-link
|
||||||
echo 'Hello World' > ./dummy
|
echo 'Hello World' > $TMPDIR/dummy
|
||||||
|
|
||||||
nix-build check.nix -A hashmismatch --no-out-link --check || status=$?
|
nix-build check.nix -A hashmismatch --no-out-link --check || status=$?
|
||||||
[ "$status" = "102" ]
|
[ "$status" = "102" ]
|
||||||
|
|
Loading…
Reference in a new issue