diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/binary-cache.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/binary-cache.sh b/tests/binary-cache.sh index ed947a6620d5..71ede03c8320 100644 --- a/tests/binary-cache.sh +++ b/tests/binary-cache.sh @@ -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 |