Skip to content

Commit

Permalink
Merge pull request #4 from domenkozar/libcompress-tests
Browse files Browse the repository at this point in the history
add tests for zstd compression
  • Loading branch information
yorickvP authored Apr 13, 2021
2 parents 8a0c00b + c2dfda0 commit 88c8804
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libstore/binary-cache-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ ref<const ValidPathInfo> BinaryCacheStore::addToStoreCommon(
narInfo->url = "nar/" + narInfo->fileHash->to_string(Base32, false) + ".nar"
+ (compression == "xz" ? ".xz" :
compression == "bzip2" ? ".bz2" :
compression == "zstd" ? ".zst" :
compression == "lzip" ? ".lzip" :
compression == "lz4" ? ".lz4" :
compression == "br" ? ".br" :
"");

Expand Down
1 change: 1 addition & 0 deletions tests/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ nix_tests = \
signing.sh \
shell.sh \
brotli.sh \
zstd.sh \
pure-eval.sh \
check.sh \
plugins.sh \
Expand Down
28 changes: 28 additions & 0 deletions tests/zstd.sh
Original file line number Diff line number Diff line change
@@ -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 ]]

0 comments on commit 88c8804

Please sign in to comment.