From cf198952d02aae5585e9bb895577b5b4e7b25707 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 1 Jun 2016 15:15:21 +0200 Subject: HttpBinaryCacheStore: Fix caching of WantMassQuery Also, test HttpBinaryCacheStore in addition to LocalBinaryCacheStore. --- tests/binary-cache.sh | 52 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 18 deletions(-) (limited to 'tests') diff --git a/tests/binary-cache.sh b/tests/binary-cache.sh index 48bc62d31..96cab6ad4 100644 --- a/tests/binary-cache.sh +++ b/tests/binary-cache.sh @@ -9,34 +9,50 @@ outPath=$(nix-build dependencies.nix --no-out-link) nix-push --dest $cacheDir $outPath -# By default, a binary cache doesn't support "nix-env -qas", but does -# support installation. -clearStore -clearCacheCache +basicTests() { -export _NIX_CACHE_FILE_URLS=1 + # By default, a binary cache doesn't support "nix-env -qas", but does + # support installation. + clearStore + clearCacheCache -nix-env --option binary-caches "file://$cacheDir" -f dependencies.nix -qas \* | grep -- "---" + nix-env --option binary-caches "file://$cacheDir" -f dependencies.nix -qas \* | grep -- "---" -nix-store --option binary-caches "file://$cacheDir" -r $outPath + nix-store --option binary-caches "file://$cacheDir" -r $outPath -[ -x $outPath/program ] + [ -x $outPath/program ] -# But with the right configuration, "nix-env -qas" should also work. -clearStore -clearCacheCache -echo "WantMassQuery: 1" >> $cacheDir/nix-cache-info + # But with the right configuration, "nix-env -qas" should also work. + clearStore + clearCacheCache + echo "WantMassQuery: 1" >> $cacheDir/nix-cache-info + + nix-env --option binary-caches "file://$cacheDir" -f dependencies.nix -qas \* | grep -- "--S" + nix-env --option binary-caches "file://$cacheDir" -f dependencies.nix -qas \* | grep -- "--S" + + x=$(nix-env -f dependencies.nix -qas \* --prebuilt-only) + [ -z "$x" ] + + nix-store --option binary-caches "file://$cacheDir" -r $outPath + + nix-store --check-validity $outPath + nix-store -qR $outPath | grep input-2 + + echo "WantMassQuery: 0" >> $cacheDir/nix-cache-info +} + + +# Test LocalBinaryCacheStore. +basicTests -nix-env --option binary-caches "file://$cacheDir" -f dependencies.nix -qas \* | grep -- "--S" -x=$(nix-env -f dependencies.nix -qas \* --prebuilt-only) -[ -z "$x" ] +# Test HttpBinaryCacheStore. +export _NIX_FORCE_HTTP_BINARY_CACHE_STORE=1 +basicTests -nix-store --option binary-caches "file://$cacheDir" -r $outPath -nix-store --check-validity $outPath -nix-store -qR $outPath | grep input-2 +unset _NIX_FORCE_HTTP_BINARY_CACHE_STORE # Test whether Nix notices if the NAR doesn't match the hash in the NAR info. -- cgit v1.2.3