Test whether Nix correctly checks the hash of downloaded NARs

This commit is contained in:
Eelco Dolstra 2014-01-08 17:56:30 +01:00
parent 11cb4bfb25
commit ea38e39a20

View file

@ -40,6 +40,20 @@ nix-store --check-validity $outPath
nix-store -qR $outPath | grep input-2 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. # Test whether this unsigned cache is rejected if the user requires signed caches.
clearStore clearStore