about summary refs log tree commit diff
path: root/tests/binary-cache.sh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-01-21T14·30+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-01-21T14·30+0100
commit81628a6ccc6ce496735b22492bee15c9ad46f072 (patch)
treed1ec18b84514d2f44700082f8d800efb929a7678 /tests/binary-cache.sh
parentb1db599dd05e86f65e73dc40584913e6e78c2bac (diff)
parent5ef8508a92997dbd7f8aa501b64fd283fb1c7bb8 (diff)
Merge branch 'master' into make
Conflicts:
	src/libexpr/eval.cc
Diffstat (limited to 'tests/binary-cache.sh')
-rw-r--r--tests/binary-cache.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/binary-cache.sh b/tests/binary-cache.sh
index eb2ebbff8203..9bd4fecb6dec 100644
--- a/tests/binary-cache.sh
+++ b/tests/binary-cache.sh
@@ -40,6 +40,31 @@ 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
+
+rm -f $NIX_STATE_DIR/binary-cache*
+
+if nix-store --option binary-caches "file://$cacheDir" --option signed-binary-caches '*' -r $outPath; then
+    echo "unsigned binary cache incorrectly accepted"
+    exit 1
+fi
+
+
 # Test whether fallback works if we have cached info but the
 # corresponding NAR has disappeared.
 clearStore