summaryrefslogtreecommitdiffstats
path: root/tests/test-lz4-dict.sh
diff options
context:
space:
mode:
authorTristan Partin <tristan@partin.io>2022-08-16 07:36:48 (GMT)
committerTristan Partin <tristan@partin.io>2022-10-20 04:27:05 (GMT)
commit198e532300f253ada3acac3ab5428ed991adb085 (patch)
treeb5c04cd31e42772751dac47bc6a0780b581b871d /tests/test-lz4-dict.sh
parente312412c60140b3d061526499cef22e5e99d7751 (diff)
downloadlz4-198e532300f253ada3acac3ab5428ed991adb085.zip
lz4-198e532300f253ada3acac3ab5428ed991adb085.tar.gz
lz4-198e532300f253ada3acac3ab5428ed991adb085.tar.bz2
Update Meson build to 1.9.4
Specifically this adds support for the following options: - LZ4_ALIGN_TEST - LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION - LZ4_DISTANCE_MAX - LZ4_FAST_DEC_LOOP - LZ4_FORCE_SW_BITCOUNT - LZ4_FREESTANDING - LZ4_USER_MEMORY_FUNCTIONS - compiling ossfuzz targets - compiling more test targets - registering some tests
Diffstat (limited to 'tests/test-lz4-dict.sh')
-rwxr-xr-xtests/test-lz4-dict.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/test-lz4-dict.sh b/tests/test-lz4-dict.sh
new file mode 100755
index 0000000..347cf92
--- /dev/null
+++ b/tests/test-lz4-dict.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+FPREFIX="tmp-dict"
+
+set -e
+
+remove () {
+ rm $FPREFIX*
+}
+
+trap remove EXIT
+
+set -x
+
+datagen -g16KB > $FPREFIX
+datagen -g32KB > $FPREFIX-sample-32k
+< $FPREFIX-sample-32k lz4 -D $FPREFIX | lz4 -dD $FPREFIX | diff - $FPREFIX-sample-32k
+datagen -g128MB > $FPREFIX-sample-128m
+< $FPREFIX-sample-128m lz4 -D $FPREFIX | lz4 -dD $FPREFIX | diff - $FPREFIX-sample-128m
+touch $FPREFIX-sample-0
+< $FPREFIX-sample-0 lz4 -D $FPREFIX | lz4 -dD $FPREFIX | diff - $FPREFIX-sample-0
+
+< $FPREFIX-sample-32k lz4 -D $FPREFIX-sample-0 | lz4 -dD $FPREFIX-sample-0 | diff - $FPREFIX-sample-32k
+< $FPREFIX-sample-0 lz4 -D $FPREFIX-sample-0 | lz4 -dD $FPREFIX-sample-0 | diff - $FPREFIX-sample-0
+lz4 -bi0 -D $FPREFIX $FPREFIX-sample-32k $FPREFIX-sample-32k
+
+echo "---- test lz4 dictionary loading ----"
+datagen -g128KB > $FPREFIX-data-128KB
+set -e; \
+for l in 0 1 4 128 32767 32768 32769 65535 65536 65537 98303 98304 98305 131071 131072 131073; do \
+ datagen -g$$l > $FPREFIX-$$l; \
+ dd if=$FPREFIX-$$l of=$FPREFIX-$$l-tail bs=1 count=65536 skip=$((l > 65536 ? l - 65536 : 0)); \
+ < $FPREFIX-$$l lz4 -D stdin $FPREFIX-data-128KB -c | lz4 -dD $FPREFIX-$$l-tail | diff - $FPREFIX-data-128KB; \
+ < $FPREFIX-$$l-tail lz4 -D stdin $FPREFIX-data-128KB -c | lz4 -dD $FPREFIX-$$l | diff - $FPREFIX-data-128KB; \
+done