fi
rm -f tmp1 tmp2
- println "roundTripTest: ./datagen $1 $proba | $ZSTD -v$cLevel | $ZSTD -d$dLevel"
- ./datagen $1 $proba | $MD5SUM > tmp1
- ./datagen $1 $proba | $ZSTD --ultra -v$cLevel | $ZSTD -d$dLevel | $MD5SUM > tmp2
+ println "roundTripTest: $DATAGEN $1 $proba | $ZSTD -v$cLevel | $ZSTD -d$dLevel"
+ $DATAGEN $1 $proba | $MD5SUM > tmp1
+ $DATAGEN $1 $proba | $ZSTD --ultra -v$cLevel | $ZSTD -d$dLevel | $MD5SUM > tmp2
$DIFF -q tmp1 tmp2
}
fi
rm -f tmp.zstd tmp.md5.1 tmp.md5.2
- println "fileRoundTripTest: ./datagen $1 $local_p > tmp && $ZSTD -v$local_c -c tmp | $ZSTD -d$local_d"
- ./datagen $1 $local_p > tmp
+ println "fileRoundTripTest: $DATAGEN $1 $local_p > tmp && $ZSTD -v$local_c -c tmp | $ZSTD -d$local_d"
+ $DATAGEN $1 $local_p > tmp
< tmp $MD5SUM > tmp.md5.1
$ZSTD --ultra -v$local_c -c tmp | $ZSTD -d$local_d | $MD5SUM > tmp.md5.2
$DIFF -q tmp.md5.1 tmp.md5.2
println "\nStarting playTests.sh isWindows=$isWindows EXE_PREFIX='$EXE_PREFIX' ZSTD_BIN='$ZSTD_BIN'"
[ -n "$ZSTD_BIN" ] || die "ZSTD_BIN variable must be defined!"
+[ -n "$DATAGEN_BIN" ] || die "DATAGEN_BIN variable must be defined!"
ZSTD="$EXE_PREFIX $ZSTD_BIN"
+DATAGEN="$DATAGEN_BIN"
if echo hello | $ZSTD -v -T2 2>&1 > $INTOVOID | grep -q 'multi-threading is disabled'
then
println "\n===> simple tests "
-./datagen > tmp
+$DATAGEN > tmp
println "test : basic compression "
$ZSTD -f tmp # trivial compression case, creates tmp.zst
println "test : basic decompression"
println "test : null-length file roundtrip"
println -n '' | $ZSTD - --stdout | $ZSTD -d --stdout
println "test : ensure small file doesn't add 3-bytes null block"
-./datagen -g1 > tmp1
+$DATAGEN -g1 > tmp1
$ZSTD tmp1 -c | wc -c | grep "14"
$ZSTD < tmp1 | wc -c | grep "14"
println "test : decompress file with wrong suffix (must fail)"
println "\n===> --exclude-compressed flag"
rm -rf precompressedFilterTestDir
mkdir -p precompressedFilterTestDir
-./datagen $size > precompressedFilterTestDir/input.5
-./datagen $size > precompressedFilterTestDir/input.6
+$DATAGEN $size > precompressedFilterTestDir/input.5
+$DATAGEN $size > precompressedFilterTestDir/input.6
$ZSTD --exclude-compressed --long --rm -r precompressedFilterTestDir
-./datagen $size > precompressedFilterTestDir/input.7
-./datagen $size > precompressedFilterTestDir/input.8
+$DATAGEN $size > precompressedFilterTestDir/input.7
+$DATAGEN $size > precompressedFilterTestDir/input.8
$ZSTD --exclude-compressed --long --rm -r precompressedFilterTestDir
test ! -f precompressedFilterTestDir/input.5.zst.zst
test ! -f precompressedFilterTestDir/input.6.zst.zst
println "Test is not successful"
fi
# File Extension check.
-./datagen $size > precompressedFilterTestDir/input.zstbar
+$DATAGEN $size > precompressedFilterTestDir/input.zstbar
$ZSTD --exclude-compressed --long --rm -r precompressedFilterTestDir
# ZSTD should compress input.zstbar
test -f precompressedFilterTestDir/input.zstbar.zst
die "should not have segfaulted"
fi
println "\n===> multiple files and shell completion "
-./datagen -s1 > tmp1 2> $INTOVOID
-./datagen -s2 -g100K > tmp2 2> $INTOVOID
-./datagen -s3 -g1M > tmp3 2> $INTOVOID
+$DATAGEN -s1 > tmp1 2> $INTOVOID
+$DATAGEN -s2 -g100K > tmp2 2> $INTOVOID
+$DATAGEN -s3 -g1M > tmp3 2> $INTOVOID
println "compress tmp* : "
$ZSTD -f tmp*
test -f tmp1.zst
# these tests requires sudo rights, which is uncommon.
# they are only triggered if DEVNULLRIGHTS macro is defined.
println "\n===> checking /dev/null permissions are unaltered "
- ./datagen > tmp
+ $DATAGEN > tmp
sudo $ZSTD tmp -o $INTOVOID # sudo rights could modify /dev/null permissions
sudo $ZSTD tmp -c > $INTOVOID
$ZSTD tmp -f -o tmp.zst
test -f tmp4
println "test : survive a list of files which is text garbage (--filelist=FILE)"
-./datagen > tmp_badList
+$DATAGEN > tmp_badList
$ZSTD -f --filelist=tmp_badList && die "should have failed : list is text garbage"
println "test : survive a list of files which is binary garbage (--filelist=FILE)"
-./datagen -P0 -g1M > tmp_badList
+$DATAGEN -P0 -g1M > tmp_badList
$ZSTD -qq -f --filelist=tmp_badList && die "should have failed : list is binary garbage" # let's avoid printing binary garbage on console
println "test : try to overflow internal list of files (--filelist=FILE)"
println "\n===> test sparse file support "
-./datagen -g5M -P100 > tmpSparse
+$DATAGEN -g5M -P100 > tmpSparse
$ZSTD tmpSparse -c | $ZSTD -dv -o tmpSparseRegen
$DIFF -s tmpSparse tmpSparseRegen
$ZSTD tmpSparse -c | $ZSTD -dv --sparse -c > tmpOutSparse
$ZSTD tmpSparse -c | $ZSTD -dv --no-sparse -c > tmpOutNoSparse
$DIFF -s tmpSparse tmpOutNoSparse
ls -ls tmpSparse* # look at file size and block size on disk
-./datagen -s1 -g1200007 -P100 | $ZSTD | $ZSTD -dv --sparse -c > tmpSparseOdd # Odd size file (to not finish on an exact nb of blocks)
-./datagen -s1 -g1200007 -P100 | $DIFF -s - tmpSparseOdd
+$DATAGEN -s1 -g1200007 -P100 | $ZSTD | $ZSTD -dv --sparse -c > tmpSparseOdd # Odd size file (to not finish on an exact nb of blocks)
+$DATAGEN -s1 -g1200007 -P100 | $DIFF -s - tmpSparseOdd
ls -ls tmpSparseOdd # look at file size and block size on disk
println "\n Sparse Compatibility with Console :"
println "Hello World 1 !" | $ZSTD | $ZSTD -d -c
println "Hello World 2 !" | $ZSTD | $ZSTD -d | cat
println "\n Sparse Compatibility with Append :"
-./datagen -P100 -g1M > tmpSparse1M
+$DATAGEN -P100 -g1M > tmpSparse1M
cat tmpSparse1M tmpSparse1M > tmpSparse2M
$ZSTD -v -f tmpSparse1M -o tmpSparseCompressed
$ZSTD -d -v -f tmpSparseCompressed -o tmpSparseRegenerated
println "\n===> stream-size mode"
-./datagen -g11000 > tmp
+$DATAGEN -g11000 > tmp
println "test : basic file compression vs sized streaming compression"
file_size=$($ZSTD -14 -f tmp -o tmp.zst && wc -c < tmp.zst)
stream_size=$(cat tmp | $ZSTD -14 --stream-size=11000 | wc -c)
println "\n===> size-hint mode"
-./datagen -g11000 > tmp
-./datagen -g11000 > tmp2
-./datagen > tmpDict
+$DATAGEN -g11000 > tmp
+$DATAGEN -g11000 > tmp2
+$DATAGEN > tmpDict
println "test : basic file compression vs hinted streaming compression"
file_size=$($ZSTD -14 -f tmp -o tmp.zst && wc -c < tmp.zst)
stream_size=$(cat tmp | $ZSTD -14 --size-hint=11000 | wc -c)
println "\n===> dictionary tests "
println "- test with raw dict (content only) "
-./datagen > tmpDict
-./datagen -g1M | $MD5SUM > tmp1
-./datagen -g1M | $ZSTD -D tmpDict | $ZSTD -D tmpDict -dvq | $MD5SUM > tmp2
+$DATAGEN > tmpDict
+$DATAGEN -g1M | $MD5SUM > tmp1
+$DATAGEN -g1M | $ZSTD -D tmpDict | $ZSTD -D tmpDict -dvq | $MD5SUM > tmp2
$DIFF -q tmp1 tmp2
println "- Create first dictionary "
TESTFILE="$PRGDIR"/zstdcli.c
if [ -n "$hasMT" ]
then
println "- Test dictionary compression with multithreading "
- ./datagen -g5M | $ZSTD -T2 -D tmpDict | $ZSTD -t -D tmpDict # fails with v1.3.2
+ $DATAGEN -g5M | $ZSTD -T2 -D tmpDict | $ZSTD -t -D tmpDict # fails with v1.3.2
fi
println "- Create second (different) dictionary "
$ZSTD --train "$TESTDIR"/*.c "$PRGDIR"/*.c "$PRGDIR"/*.h -o tmpDictC
println "- dictionary builder on bogus input"
println "Hello World" > tmp
$ZSTD --train-legacy -q tmp && die "Dictionary training should fail : not enough input source"
-./datagen -P0 -g10M > tmp
+$DATAGEN -P0 -g10M > tmp
$ZSTD --train-legacy -q tmp && die "Dictionary training should fail : source is pure noise"
println "- Test -o before --train"
rm -f tmpDict dictionary
println "\n===> fastCover dictionary builder : advanced options "
TESTFILE="$PRGDIR"/zstdcli.c
-./datagen > tmpDict
+$DATAGEN > tmpDict
println "- Create first dictionary"
$ZSTD --train-fastcover=k=46,d=8,f=15,split=80 "$TESTDIR"/*.c "$PRGDIR"/*.c -o tmpDict
cp "$TESTFILE" tmp
println "\n===> legacy dictionary builder "
TESTFILE="$PRGDIR"/zstdcli.c
-./datagen > tmpDict
+$DATAGEN > tmpDict
println "- Create first dictionary"
$ZSTD --train-legacy=selectivity=8 "$TESTDIR"/*.c "$PRGDIR"/*.c -o tmpDict
cp "$TESTFILE" tmp
println "\n===> integrity tests "
println "test one file (tmp1.zst) "
-./datagen > tmp1
+$DATAGEN > tmp1
$ZSTD tmp1
$ZSTD -t tmp1.zst
$ZSTD --test tmp1.zst
$ZSTD -t tmp1 && die "bad file not detected !"
cp tmp1 tmp2.zst
$ZSTD -t tmp2.zst && die "bad file not detected !"
-./datagen -g0 > tmp3
+$DATAGEN -g0 > tmp3
$ZSTD -t tmp3 && die "bad file not detected !" # detects 0-sized files as bad
println "test --rm and --test combined "
$ZSTD -t --rm tmp1.zst
test -f tmp1.zst # check file is still present
split -b16384 tmp1.zst tmpSplit.
$ZSTD -t tmpSplit.* && die "bad file not detected !"
-./datagen | $ZSTD -c | $ZSTD -t
+$DATAGEN | $ZSTD -c | $ZSTD -t
println "\n===> golden files tests "
println "\n===> benchmark mode tests "
println "bench one file"
-./datagen > tmp1
+$DATAGEN > tmp1
$ZSTD -bi0 tmp1
println "bench multiple levels"
$ZSTD -i0b0e3 tmp1
println "\n===> zstd compatibility tests "
-./datagen > tmp
+$DATAGEN > tmp
rm -f tmp.zst
$ZSTD --format=zstd -f tmp
test -f tmp.zst
GZIPEXE=1
gzip -V || GZIPEXE=0
if [ $GZIPEXE -eq 1 ]; then
- ./datagen > tmp
+ $DATAGEN > tmp
$ZSTD --format=gzip -f tmp
gzip -t -v tmp.gz
gzip -f tmp
println "\n===> gzip frame tests "
if [ $GZIPMODE -eq 1 ]; then
- ./datagen > tmp
+ $DATAGEN > tmp
$ZSTD -f --format=gzip tmp
$ZSTD -f tmp
cat tmp.gz tmp.zst tmp.gz tmp.zst | $ZSTD -d -f -o tmp
fi
if [ $GZIPMODE -eq 1 ]; then
- ./datagen > tmp
+ $DATAGEN > tmp
rm -f tmp.zst
$ZSTD --format=gzip --format=zstd -f tmp
test -f tmp.zst
xz -Q -V && lzma -Q -V || XZEXE=0
if [ $XZEXE -eq 1 ]; then
println "Testing zstd xz and lzma support"
- ./datagen > tmp
+ $DATAGEN > tmp
$ZSTD --format=lzma -f tmp
$ZSTD --format=xz -f tmp
xz -Q -t -v tmp.xz
ln -s $ZSTD ./lzma
ln -s $ZSTD ./unlzma
println "Testing xz and lzma symlinks"
- ./datagen > tmp
+ $DATAGEN > tmp
./xz tmp
xz -Q -d tmp.xz
./lzma tmp
println "\n===> xz frame tests "
if [ $LZMAMODE -eq 1 ]; then
- ./datagen > tmp
+ $DATAGEN > tmp
$ZSTD -f --format=xz tmp
$ZSTD -f --format=lzma tmp
$ZSTD -f tmp
LZ4EXE=1
lz4 -V || LZ4EXE=0
if [ $LZ4EXE -eq 1 ]; then
- ./datagen > tmp
+ $DATAGEN > tmp
$ZSTD --format=lz4 -f tmp
lz4 -t -v tmp.lz4
lz4 -f tmp
if [ $LZ4MODE -eq 1 ]; then
println "\n===> lz4 frame tests "
- ./datagen > tmp
+ $DATAGEN > tmp
$ZSTD -f --format=lz4 tmp
$ZSTD -f tmp
cat tmp.lz4 tmp.zst tmp.lz4 tmp.zst | $ZSTD -d -f -o tmp
rm -f tmp tmp.tar tmp.tzst tmp.tgz tmp.txz tmp.tlz4
-./datagen > tmp
+$DATAGEN > tmp
tar cf tmp.tar tmp
$ZSTD tmp.tar -o tmp.tzst
rm tmp.tar
roundTripTest -g8M "3 --long=24 -T2"
println "\n===> ovLog tests "
- ./datagen -g2MB > tmp
+ $DATAGEN -g2MB > tmp
refSize=$($ZSTD tmp -6 -c --zstd=wlog=18 | wc -c)
ov9Size=$($ZSTD tmp -6 -c --zstd=wlog=18,ovlog=9 | wc -c)
ov1Size=$($ZSTD tmp -6 -c --zstd=wlog=18,ovlog=1 | wc -c)
rm tmp*
println "\n===> zstd --list/-l single frame tests "
-./datagen > tmp1
-./datagen > tmp2
-./datagen > tmp3
+$DATAGEN > tmp1
+$DATAGEN > tmp2
+$DATAGEN > tmp3
$ZSTD tmp*
$ZSTD -l ./*.zst
$ZSTD -lv ./*.zst | grep "Decompressed Size:" # check that decompressed size is present in header
TEST_DATA_FILE=truncatable-input.txt
FULL_COMPRESSED_FILE=${TEST_DATA_FILE}.zst
TRUNCATED_COMPRESSED_FILE=truncated-input.txt.zst
-./datagen -g50000 > $TEST_DATA_FILE
+$DATAGEN -g50000 > $TEST_DATA_FILE
$ZSTD -f $TEST_DATA_FILE -o $FULL_COMPRESSED_FILE
dd bs=1 count=100 if=$FULL_COMPRESSED_FILE of=$TRUNCATED_COMPRESSED_FILE
$ZSTD --list $TRUNCATED_COMPRESSED_FILE && die "-l must fail on truncated file"
$ZSTD -l tmp1.zst < tmp2.zst # this will check tmp1.zst, but not tmp2.zst, which is not an error : zstd simply doesn't read stdin in this case. It must not error just because stdin is not a tty
println "\n===> zstd --list/-l test with null files "
-./datagen -g0 > tmp5
+$DATAGEN -g0 > tmp5
$ZSTD tmp5
$ZSTD -l tmp5.zst
$ZSTD -l tmp5* && die "-l must fail on non-zstd file"
$ZSTD -lv tmp5* && die "-l must fail on non-zstd file"
println "\n===> zstd --list/-l test with no content size field "
-./datagen -g513K | $ZSTD > tmp6.zst
+$DATAGEN -g513K | $ZSTD > tmp6.zst
$ZSTD -l tmp6.zst
$ZSTD -lv tmp6.zst | grep "Decompressed Size:" && die "Field :Decompressed Size: should not be available in this compressed file"
roundTripTest -g270000000 " --adapt"
roundTripTest -g27000000 " --adapt=min=1,max=4"
println "===> test: --adapt must fail on incoherent bounds "
- ./datagen > tmp
+ $DATAGEN > tmp
$ZSTD -f -vv --adapt=min=10,max=9 tmp && die "--adapt must fail on incoherent bounds"
println "\n===> rsyncable mode "
println "\n===> patch-from tests"
-./datagen -g1000 -P50 > tmp_dict
-./datagen -g1000 -P10 > tmp_patch
+$DATAGEN -g1000 -P50 > tmp_dict
+$DATAGEN -g1000 -P10 > tmp_patch
$ZSTD --memory=10000 --patch-from=tmp_dict tmp_patch -o tmp_patch_diff
$ZSTD -d --memory=10000 --patch-from=tmp_dict tmp_patch_diff -o tmp_patch_recon
$DIFF -s tmp_patch_recon tmp_patch
println "\n===> cover dictionary builder : advanced options "
TESTFILE="$PRGDIR"/zstdcli.c
-./datagen > tmpDict
+$DATAGEN > tmpDict
println "- Create first dictionary"
$ZSTD --train-cover=k=46,d=8,split=80 "$TESTDIR"/*.c "$PRGDIR"/*.c -o tmpDict
cp "$TESTFILE" tmp