aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTom Bereknyei <tomberek@gmail.com>2021-10-12 02:14:36 -0400
committerTom Bereknyei <tomberek@gmail.com>2021-10-12 02:14:36 -0400
commit03bb8f84e0f54d9980b160785f98da8ae07196fe (patch)
tree7d6ab569ff1fa006ee307b90ecf5099b0f5a35d4 /tests
parent01e9f046a8f8fafb4d084153d4b30dd3a8d7aef5 (diff)
Add compression level for NARs
Based off on @dtzWill's #2276
Diffstat (limited to 'tests')
-rw-r--r--tests/compression-levels.sh22
-rw-r--r--tests/local.mk1
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/compression-levels.sh b/tests/compression-levels.sh
new file mode 100644
index 000000000..85f12974a
--- /dev/null
+++ b/tests/compression-levels.sh
@@ -0,0 +1,22 @@
+source common.sh
+
+clearStore
+clearCache
+
+outPath=$(nix-build dependencies.nix --no-out-link)
+
+cacheURI="file://$cacheDir?compression=xz&compression-level=0"
+
+nix copy --to $cacheURI $outPath
+
+FILESIZES=$(cat ${cacheDir}/*.narinfo | awk '/FileSize: /{sum+=$2}END{print sum}')
+
+clearCache
+
+cacheURI="file://$cacheDir?compression=xz&compression-level=5"
+
+nix copy --to $cacheURI $outPath
+
+FILESIZES2=$(cat ${cacheDir}/*.narinfo | awk '/FileSize: /{sum+=$2}END{print sum}')
+
+[[ $FILESIZES -gt $FILESIZES2 ]]
diff --git a/tests/local.mk b/tests/local.mk
index b100e7f15..d88c3a875 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -33,6 +33,7 @@ nix_tests = \
shell.sh \
brotli.sh \
zstd.sh \
+ compression-levels.sh \
pure-eval.sh \
check.sh \
plugins.sh \