Merge pull request #4 from domenkozar/libcompress-tests

add tests for zstd compression
This commit is contained in:
Yorick 2021-04-13 21:14:16 +02:00 committed by GitHub
commit 88c8804b4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 0 deletions

View file

@ -179,6 +179,9 @@ ref<const ValidPathInfo> BinaryCacheStore::addToStoreCommon(
narInfo->url = "nar/" + narInfo->fileHash->to_string(Base32, false) + ".nar" narInfo->url = "nar/" + narInfo->fileHash->to_string(Base32, false) + ".nar"
+ (compression == "xz" ? ".xz" : + (compression == "xz" ? ".xz" :
compression == "bzip2" ? ".bz2" : compression == "bzip2" ? ".bz2" :
compression == "zstd" ? ".zst" :
compression == "lzip" ? ".lzip" :
compression == "lz4" ? ".lz4" :
compression == "br" ? ".br" : compression == "br" ? ".br" :
""); "");

View file

@ -27,6 +27,7 @@ nix_tests = \
signing.sh \ signing.sh \
shell.sh \ shell.sh \
brotli.sh \ brotli.sh \
zstd.sh \
pure-eval.sh \ pure-eval.sh \
check.sh \ check.sh \
plugins.sh \ plugins.sh \

28
tests/zstd.sh Normal file
View file

@ -0,0 +1,28 @@
source common.sh
clearStore
clearCache
cacheURI="file://$cacheDir?compression=zstd"
outPath=$(nix-build dependencies.nix --no-out-link)
nix copy --to $cacheURI $outPath
HASH=$(nix hash path $outPath)
clearStore
clearCacheCache
nix copy --from $cacheURI $outPath --no-check-sigs
if ls $cacheDir/nar/*.zst &> /dev/null; then
echo "files do exist"
else
echo "nars do not exist"
exit 1
fi
HASH2=$(nix hash path $outPath)
[[ $HASH = $HASH2 ]]