Test whether Nix correctly checks the hash of downloaded NARs
This commit is contained in:
parent
11cb4bfb25
commit
ea38e39a20
|
@ -40,6 +40,20 @@ nix-store --check-validity $outPath
|
|||
nix-store -qR $outPath | grep input-2
|
||||
|
||||
|
||||
# Test whether Nix notices if the NAR doesn't match the hash in the NAR info.
|
||||
clearStore
|
||||
|
||||
nar=$(ls $cacheDir/*.nar.xz | head -n1)
|
||||
mv $nar $nar.good
|
||||
mkdir -p $TEST_ROOT/empty
|
||||
nix-store --dump $TEST_ROOT/empty | xz > $nar
|
||||
|
||||
nix-build --option binary-caches "file://$cacheDir" dependencies.nix -o $TEST_ROOT/result 2>&1 | tee $TEST_ROOT/log
|
||||
grep -q "hash mismatch in downloaded path" $TEST_ROOT/log
|
||||
|
||||
mv $nar.good $nar
|
||||
|
||||
|
||||
# Test whether this unsigned cache is rejected if the user requires signed caches.
|
||||
clearStore
|
||||
|
||||
|
|
Loading…
Reference in a new issue