23 $ECHO "roundTripTest: ./datagen $1 $proba | $ZSTD -v$cLevel | $ZSTD -d$dLevel"
24 ./datagen $1 $proba | $MD5SUM > tmp1
25 ./datagen $1 $proba | $ZSTD --ultra -v$cLevel | $ZSTD -d$dLevel | $MD5SUM > tmp2
43 rm -f tmp.zstd tmp.md5.1 tmp.md5.2
44 $ECHO "fileRoundTripTest: ./datagen $1 $local_p > tmp && $ZSTD -v$local_c -c tmp | $ZSTD -d$local_d"
45 ./datagen $1 $local_p > tmp
46 < tmp $MD5SUM > tmp.md5.1
47 $ZSTD --ultra -v$local_c -c tmp | $ZSTD -d$local_d | $MD5SUM > tmp.md5.2
48 $DIFF -q tmp.md5.1 tmp.md5.2
52 if [ -t 0 ] && [ -t 1 ]
70 Darwin) MD5SUM="md5 -r" ;;
71 FreeBSD) MD5SUM="gmd5sum" ;;
77 SunOS) DIFF="gdiff" ;;
82 Darwin) ECHO="echo" ;;
85 $ECHO "\nStarting playTests.sh isWindows=$isWindows ZSTD='$ZSTD'"
87 [ -n "$ZSTD" ] || die "ZSTD variable must be defined!"
89 if [ -n "$(echo hello | $ZSTD -v -T2 2>&1 > $INTOVOID | grep 'multi-threading is disabled')" ]
97 $ECHO "\n===> simple tests "
100 $ECHO "test : basic compression "
101 $ZSTD -f tmp # trivial compression case, creates tmp.zst
102 $ECHO "test : basic decompression"
103 $ZSTD -df tmp.zst # trivial decompression case (overwrites tmp)
104 $ECHO "test : too large compression level => auto-fix"
105 $ZSTD -99 -f tmp # too large compression level, automatic sized down
106 $ECHO "test : --fast aka negative compression levels"
107 $ZSTD --fast -f tmp # == -1
108 $ZSTD --fast=3 -f tmp # == -3
109 $ZSTD --fast=200000 -f tmp # == no compression
110 $ECHO "test : compress to stdout"
111 $ZSTD tmp -c > tmpCompressed
112 $ZSTD tmp --stdout > tmpCompressed # long command format
113 $ECHO "test : compress to named file"
115 $ZSTD tmp -o tmpCompressed
116 test -f tmpCompressed # file must be created
117 $ECHO "test : -o must be followed by filename (must fail)"
118 $ZSTD tmp -of tmpCompressed && die "-o must be followed by filename "
119 $ECHO "test : force write, correct order"
120 $ZSTD tmp -fo tmpCompressed
121 $ECHO "test : forgotten argument"
123 $ZSTD tmp2 -fo && die "-o must be followed by filename "
124 $ECHO "test : implied stdout when input is stdin"
125 $ECHO bob | $ZSTD | $ZSTD -d
126 if [ "$isTerminal" = true ]; then
127 $ECHO "test : compressed data to terminal"
128 $ECHO bob | $ZSTD && die "should have refused : compressed data to terminal"
129 $ECHO "test : compressed data from terminal (a hang here is a test fail, zstd is wrongly waiting on data from terminal)"
130 $ZSTD -d > $INTOVOID && die "should have refused : compressed data from terminal"
132 $ECHO "test : null-length file roundtrip"
133 $ECHO -n '' | $ZSTD - --stdout | $ZSTD -d --stdout
134 $ECHO "test : ensure small file doesn't add 3-bytes null block"
136 $ZSTD tmp1 -c | wc -c | grep "14"
137 $ZSTD < tmp1 | wc -c | grep "14"
138 $ECHO "test : decompress file with wrong suffix (must fail)"
139 $ZSTD -d tmpCompressed && die "wrong suffix error not detected!"
140 $ZSTD -df tmp && die "should have refused : wrong extension"
141 $ECHO "test : decompress into stdout"
142 $ZSTD -d tmpCompressed -c > tmpResult # decompression using stdout
143 $ZSTD --decompress tmpCompressed -c > tmpResult
144 $ZSTD --decompress tmpCompressed --stdout > tmpResult
145 $ECHO "test : decompress from stdin into stdout"
146 $ZSTD -dc < tmp.zst > $INTOVOID # combine decompression, stdin & stdout
147 $ZSTD -dc - < tmp.zst > $INTOVOID
148 $ZSTD -d < tmp.zst > $INTOVOID # implicit stdout when stdin is used
149 $ZSTD -d - < tmp.zst > $INTOVOID
150 $ECHO "test : impose memory limitation (must fail)"
151 $ZSTD -d -f tmp.zst -M2K -c > $INTOVOID && die "decompression needs more memory than allowed"
152 $ZSTD -d -f tmp.zst --memlimit=2K -c > $INTOVOID && die "decompression needs more memory than allowed" # long command
153 $ZSTD -d -f tmp.zst --memory=2K -c > $INTOVOID && die "decompression needs more memory than allowed" # long command
154 $ZSTD -d -f tmp.zst --memlimit-decompress=2K -c > $INTOVOID && die "decompression needs more memory than allowed" # long command
155 $ECHO "test : overwrite protection"
156 $ZSTD -q tmp && die "overwrite check failed!"
157 $ECHO "test : force overwrite"
160 $ECHO "test : overwrite readonly file"
161 rm -f tmpro tmpro.zst
162 $ECHO foo > tmpro.zst
165 $ZSTD -q tmpro && die "should have refused to overwrite read-only file"
167 rm -f tmpro tmpro.zst
168 $ECHO "test : file removal"
170 test ! -f tmp # tmp should no longer be present
171 $ZSTD -f -d --rm tmp.zst
172 test ! -f tmp.zst # tmp.zst should no longer be present
173 $ECHO "test : should quietly not remove non-regular file"
175 $ZSTD tmp -f -o "$DEVDEVICE" 2>tmplog > "$INTOVOID"
176 grep -v "Refusing to remove non-regular file" tmplog
178 $ZSTD tmp -f -o "$INTONULL" 2>&1 | grep -v "Refusing to remove non-regular file"
179 $ECHO "test : --rm on stdin"
180 $ECHO a | $ZSTD --rm > $INTOVOID # --rm should remain silent
182 $ZSTD -f tmp && die "tmp not present : should have failed"
183 test ! -f tmp.zst # tmp.zst should not be created
185 $ECHO "test : compress multiple files"
188 $ZSTD tmp1 tmp2 -o "$INTOVOID"
189 $ZSTD tmp1 tmp2 -c | $ZSTD -t
190 $ZSTD tmp1 tmp2 -o tmp.zst
194 $ZSTD -t tmp1.zst tmp2.zst
195 $ZSTD -dc tmp1.zst tmp2.zst
196 $ZSTD tmp1.zst tmp2.zst -o "$INTOVOID"
197 $ZSTD -d tmp1.zst tmp2.zst -o tmp
199 $ZSTD tmp1 tmp2 -f -o tmpexists
200 $ZSTD tmp1 tmp2 -o tmpexists && die "should have refused to overwrite"
202 if [ "$?" -eq 139 ]; then
203 die "should not have segfaulted"
208 $ECHO "\n===> Advanced compression parameters "
209 $ECHO "Hello world!" | $ZSTD --zstd=windowLog=21, - -o tmp.zst && die "wrong parameters not detected!"
210 $ECHO "Hello world!" | $ZSTD --zstd=windowLo=21 - -o tmp.zst && die "wrong parameters not detected!"
211 $ECHO "Hello world!" | $ZSTD --zstd=windowLog=21,slog - -o tmp.zst && die "wrong parameters not detected!"
212 test ! -f tmp.zst # tmp.zst should not be created
214 roundTripTest -g512K " --zstd=slen=3,tlen=48,strat=6"
215 roundTripTest -g512K " --zstd=strat=6,wlog=23,clog=23,hlog=22,slog=6"
216 roundTripTest -g512K " --zstd=windowLog=23,chainLog=23,hashLog=22,searchLog=6,searchLength=3,targetLength=48,strategy=6"
217 roundTripTest -g512K " --single-thread --long --zstd=ldmHashLog=20,ldmSearchLength=64,ldmBucketSizeLog=1,ldmHashEveryLog=7"
218 roundTripTest -g512K " --single-thread --long --zstd=ldmhlog=20,ldmslen=64,ldmblog=1,ldmhevery=7"
219 roundTripTest -g512K 19
222 $ECHO "\n===> Pass-Through mode "
223 $ECHO "Hello world 1!" | $ZSTD -df
224 $ECHO "Hello world 2!" | $ZSTD -dcf
225 $ECHO "Hello world 3!" > tmp1
229 $ECHO "\n===> frame concatenation "
231 $ECHO "hello " > hello.tmp
232 $ECHO "world!" > world.tmp
233 cat hello.tmp world.tmp > helloworld.tmp
234 $ZSTD -c hello.tmp > hello.zstd
235 $ZSTD -c world.tmp > world.zstd
236 cat hello.zstd world.zstd > helloworld.zstd
237 $ZSTD -dc helloworld.zstd > result.tmp
239 $DIFF helloworld.tmp result.tmp
240 $ECHO "frame concatenation without checksum"
241 $ZSTD -c hello.tmp > hello.zstd --no-check
242 $ZSTD -c world.tmp > world.zstd --no-check
243 cat hello.zstd world.zstd > helloworld.zstd
244 $ZSTD -dc helloworld.zstd > result.tmp
245 $DIFF helloworld.tmp result.tmp
246 $ECHO "testing zstdcat symlink"
248 ./zstdcat helloworld.zstd > result.tmp
249 $DIFF helloworld.tmp result.tmp
252 $ECHO "testing zcat symlink"
254 ./zcat helloworld.zstd > result.tmp
255 $DIFF helloworld.tmp result.tmp
258 $ECHO "frame concatenation tests completed"
261 if [ "$isWindows" = false ] && [ "$UNAME" != 'SunOS' ] ; then
262 $ECHO "\n**** flush write error test **** "
264 $ECHO "$ECHO foo | $ZSTD > /dev/full"
265 $ECHO foo | $ZSTD > /dev/full && die "write error not detected!"
266 $ECHO "$ECHO foo | $ZSTD | $ZSTD -d > /dev/full"
267 $ECHO foo | $ZSTD | $ZSTD -d > /dev/full && die "write error not detected!"
270 $ECHO "\n===> symbolic link test "
272 rm -f hello.tmp world.tmp hello.tmp.zst world.tmp.zst
273 $ECHO "hello world" > hello.tmp
274 ln -s hello.tmp world.tmp
275 $ZSTD world.tmp hello.tmp
276 test -f hello.tmp.zst # regular file should have been compressed!
277 test ! -f world.tmp.zst # symbolic link should not have been compressed!
278 $ZSTD world.tmp hello.tmp -f
279 test -f world.tmp.zst # symbolic link should have been compressed with --force
280 rm -f hello.tmp world.tmp hello.tmp.zst world.tmp.zst
285 $ECHO "\n===> test sparse file support "
287 ./datagen -g5M -P100 > tmpSparse
288 $ZSTD tmpSparse -c | $ZSTD -dv -o tmpSparseRegen
289 $DIFF -s tmpSparse tmpSparseRegen
290 $ZSTD tmpSparse -c | $ZSTD -dv --sparse -c > tmpOutSparse
291 $DIFF -s tmpSparse tmpOutSparse
292 $ZSTD tmpSparse -c | $ZSTD -dv --no-sparse -c > tmpOutNoSparse
293 $DIFF -s tmpSparse tmpOutNoSparse
294 ls -ls tmpSparse* # look at file size and block size on disk
295 ./datagen -s1 -g1200007 -P100 | $ZSTD | $ZSTD -dv --sparse -c > tmpSparseOdd # Odd size file (to not finish on an exact nb of blocks)
296 ./datagen -s1 -g1200007 -P100 | $DIFF -s - tmpSparseOdd
297 ls -ls tmpSparseOdd # look at file size and block size on disk
298 $ECHO "\n Sparse Compatibility with Console :"
299 $ECHO "Hello World 1 !" | $ZSTD | $ZSTD -d -c
300 $ECHO "Hello World 2 !" | $ZSTD | $ZSTD -d | cat
301 $ECHO "\n Sparse Compatibility with Append :"
302 ./datagen -P100 -g1M > tmpSparse1M
303 cat tmpSparse1M tmpSparse1M > tmpSparse2M
304 $ZSTD -v -f tmpSparse1M -o tmpSparseCompressed
305 $ZSTD -d -v -f tmpSparseCompressed -o tmpSparseRegenerated
306 $ZSTD -d -v -f tmpSparseCompressed -c >> tmpSparseRegenerated
307 ls -ls tmpSparse* # look at file size and block size on disk
308 $DIFF tmpSparse2M tmpSparseRegenerated
312 $ECHO "\n===> multiple files tests "
314 ./datagen -s1 > tmp1 2> $INTOVOID
315 ./datagen -s2 -g100K > tmp2 2> $INTOVOID
316 ./datagen -s3 -g1M > tmp3 2> $INTOVOID
317 $ECHO "compress tmp* : "
321 $ECHO "decompress tmp* : "
324 $ECHO "compress tmp* into stdout > tmpall : "
325 $ZSTD -c tmp1 tmp2 tmp3 > tmpall
326 ls -ls tmp* # check size of tmpall (should be tmp1.zst + tmp2.zst + tmp3.zst)
327 $ECHO "decompress tmpall* into stdout > tmpdec : "
329 $ZSTD -dc tmpall* > tmpdec
330 ls -ls tmp* # check size of tmpdec (should be 2*(tmp1 + tmp2 + tmp3))
331 $ECHO "compress multiple files including a missing one (notHere) : "
332 $ZSTD -f tmp1 notHere tmp2 && die "missing file not detected!"
335 $ECHO "\n===> dictionary tests "
337 $ECHO "- test with raw dict (content only) "
339 ./datagen -g1M | $MD5SUM > tmp1
340 ./datagen -g1M | $ZSTD -D tmpDict | $ZSTD -D tmpDict -dvq | $MD5SUM > tmp2
342 $ECHO "- Create first dictionary "
343 TESTFILE=../programs/zstdcli.c
344 $ZSTD --train *.c ../programs/*.c -o tmpDict
346 $ECHO "- Dictionary compression roundtrip"
347 $ZSTD -f tmp -D tmpDict
348 $ZSTD -d tmp.zst -D tmpDict -fo result
349 $DIFF $TESTFILE result
350 $ECHO "- Dictionary compression with btlazy2 strategy"
351 $ZSTD -f tmp -D tmpDict --zstd=strategy=6
352 $ZSTD -d tmp.zst -D tmpDict -fo result
353 $DIFF $TESTFILE result
356 $ECHO "- Test dictionary compression with multithreading "
357 ./datagen -g5M | $ZSTD -T2 -D tmpDict | $ZSTD -t -D tmpDict # fails with v1.3.2
359 $ECHO "- Create second (different) dictionary "
360 $ZSTD --train *.c ../programs/*.c ../programs/*.h -o tmpDictC
361 $ZSTD -d tmp.zst -D tmpDictC -fo result && die "wrong dictionary not detected!"
362 $ECHO "- Create dictionary with short dictID"
363 $ZSTD --train *.c ../programs/*.c --dictID=1 -o tmpDict1
364 cmp tmpDict tmpDict1 && die "dictionaries should have different ID !"
365 $ECHO "- Create dictionary with wrong dictID parameter order (must fail)"
366 $ZSTD --train *.c ../programs/*.c --dictID -o 1 tmpDict1 && die "wrong order : --dictID must be followed by argument "
367 $ECHO "- Create dictionary with size limit"
368 $ZSTD --train *.c ../programs/*.c -o tmpDict2 --maxdict=4K -v
369 $ECHO "- Create dictionary with small size limit"
370 $ZSTD --train *.c ../programs/*.c -o tmpDict3 --maxdict=1K -v
371 $ECHO "- Create dictionary with wrong parameter order (must fail)"
372 $ZSTD --train *.c ../programs/*.c -o tmpDict3 --maxdict -v 4K && die "wrong order : --maxdict must be followed by argument "
373 $ECHO "- Compress without dictID"
374 $ZSTD -f tmp -D tmpDict1 --no-dictID
375 $ZSTD -d tmp.zst -D tmpDict -fo result
376 $DIFF $TESTFILE result
377 $ECHO "- Compress with wrong argument order (must fail)"
378 $ZSTD tmp -Df tmpDict1 -c > $INTOVOID && die "-D must be followed by dictionary name "
379 $ECHO "- Compress multiple files with dictionary"
383 cp ../programs/*.c dirTestDict
384 cp ../programs/*.h dirTestDict
385 $MD5SUM dirTestDict/* > tmph1
386 $ZSTD -f --rm dirTestDict/* -D tmpDictC
387 $ZSTD -d --rm dirTestDict/*.zst -D tmpDictC # note : use internal checksum by default
389 Darwin) $ECHO "md5sum -c not supported on OS-X : test skipped" ;; # not compatible with OS-X's md5
390 *) $MD5SUM -c tmph1 ;;
393 $ECHO "- dictionary builder on bogus input"
394 $ECHO "Hello World" > tmp
395 $ZSTD --train-legacy -q tmp && die "Dictionary training should fail : not enough input source"
396 ./datagen -P0 -g10M > tmp
397 $ZSTD --train-legacy -q tmp && die "Dictionary training should fail : source is pure noise"
401 $ECHO "\n===> cover dictionary builder : advanced options "
403 TESTFILE=../programs/zstdcli.c
405 $ECHO "- Create first dictionary"
406 $ZSTD --train-cover=k=46,d=8 *.c ../programs/*.c -o tmpDict
408 $ZSTD -f tmp -D tmpDict
409 $ZSTD -d tmp.zst -D tmpDict -fo result
410 $DIFF $TESTFILE result
411 $ECHO "- Create second (different) dictionary"
412 $ZSTD --train-cover=k=56,d=8 *.c ../programs/*.c ../programs/*.h -o tmpDictC
413 $ZSTD -d tmp.zst -D tmpDictC -fo result && die "wrong dictionary not detected!"
414 $ECHO "- Create dictionary with short dictID"
415 $ZSTD --train-cover=k=46,d=8 *.c ../programs/*.c --dictID=1 -o tmpDict1
416 cmp tmpDict tmpDict1 && die "dictionaries should have different ID !"
417 $ECHO "- Create dictionary with size limit"
418 $ZSTD --train-cover=steps=8 *.c ../programs/*.c -o tmpDict2 --maxdict=4K
421 $ECHO "\n===> legacy dictionary builder "
423 TESTFILE=../programs/zstdcli.c
425 $ECHO "- Create first dictionary"
426 $ZSTD --train-legacy=selectivity=8 *.c ../programs/*.c -o tmpDict
428 $ZSTD -f tmp -D tmpDict
429 $ZSTD -d tmp.zst -D tmpDict -fo result
430 $DIFF $TESTFILE result
431 $ECHO "- Create second (different) dictionary"
432 $ZSTD --train-legacy=s=5 *.c ../programs/*.c ../programs/*.h -o tmpDictC
433 $ZSTD -d tmp.zst -D tmpDictC -fo result && die "wrong dictionary not detected!"
434 $ECHO "- Create dictionary with short dictID"
435 $ZSTD --train-legacy -s5 *.c ../programs/*.c --dictID=1 -o tmpDict1
436 cmp tmpDict tmpDict1 && die "dictionaries should have different ID !"
437 $ECHO "- Create dictionary with size limit"
438 $ZSTD --train-legacy -s9 *.c ../programs/*.c -o tmpDict2 --maxdict=4K
442 $ECHO "\n===> integrity tests "
444 $ECHO "test one file (tmp1.zst) "
448 $ZSTD --test tmp1.zst
449 $ECHO "test multiple files (*.zst) "
451 $ECHO "test bad files (*) "
452 $ZSTD -t * && die "bad files not detected !"
453 $ZSTD -t tmp1 && die "bad file not detected !"
455 $ZSTD -t tmp2.zst && die "bad file not detected !"
457 $ZSTD -t tmp3 && die "bad file not detected !" # detects 0-sized files as bad
458 $ECHO "test --rm and --test combined "
459 $ZSTD -t --rm tmp1.zst
460 test -f tmp1.zst # check file is still present
461 split -b16384 tmp1.zst tmpSplit.
462 $ZSTD -t tmpSplit.* && die "bad file not detected !"
463 ./datagen | $ZSTD -c | $ZSTD -t
467 $ECHO "\n===> golden files tests "
470 $ZSTD -c -r files | $ZSTD -t
473 $ECHO "\n===> benchmark mode tests "
475 $ECHO "bench one file"
478 $ECHO "bench multiple levels"
480 $ECHO "bench negative level"
481 $ZSTD -bi0 --fast tmp1
482 $ECHO "with recursive and quiet modes"
486 $ECHO "\n===> gzip compatibility tests "
489 $ZSTD --format=gzip -V || GZIPMODE=0
490 if [ $GZIPMODE -eq 1 ]; then
491 $ECHO "gzip support detected"
494 if [ $GZIPEXE -eq 1 ]; then
496 $ZSTD --format=gzip -f tmp
499 $ZSTD -d -f -v tmp.gz
502 $ECHO "gzip binary not detected"
505 $ECHO "gzip mode not supported"
509 $ECHO "\n===> gzip frame tests "
511 if [ $GZIPMODE -eq 1 ]; then
513 $ZSTD -f --format=gzip tmp
515 cat tmp.gz tmp.zst tmp.gz tmp.zst | $ZSTD -d -f -o tmp
516 head -c -1 tmp.gz | $ZSTD -t > $INTOVOID && die "incomplete frame not detected !"
519 $ECHO "gzip mode not supported"
523 $ECHO "\n===> xz compatibility tests "
526 $ZSTD --format=xz -V || LZMAMODE=0
527 if [ $LZMAMODE -eq 1 ]; then
528 $ECHO "xz support detected"
530 xz -V && lzma -V || XZEXE=0
531 if [ $XZEXE -eq 1 ]; then
532 $ECHO "Testing zstd xz and lzma support"
534 $ZSTD --format=lzma -f tmp
535 $ZSTD --format=xz -f tmp
539 lzma -f -k --lzma1 tmp
540 $ZSTD -d -f -v tmp.xz
541 $ZSTD -d -f -v tmp.lzma
543 $ECHO "Creating symlinks"
548 $ECHO "Testing xz and lzma symlinks"
554 $ECHO "Testing unxz and unlzma symlinks"
559 rm xz unxz lzma unlzma
562 $ECHO "xz binary not detected"
565 $ECHO "xz mode not supported"
569 $ECHO "\n===> xz frame tests "
571 if [ $LZMAMODE -eq 1 ]; then
573 $ZSTD -f --format=xz tmp
574 $ZSTD -f --format=lzma tmp
576 cat tmp.xz tmp.lzma tmp.zst tmp.lzma tmp.xz tmp.zst | $ZSTD -d -f -o tmp
577 head -c -1 tmp.xz | $ZSTD -t > $INTOVOID && die "incomplete frame not detected !"
578 head -c -1 tmp.lzma | $ZSTD -t > $INTOVOID && die "incomplete frame not detected !"
581 $ECHO "xz mode not supported"
584 $ECHO "\n===> lz4 compatibility tests "
587 $ZSTD --format=lz4 -V || LZ4MODE=0
588 if [ $LZ4MODE -eq 1 ]; then
589 $ECHO "lz4 support detected"
592 if [ $LZ4EXE -eq 1 ]; then
594 $ZSTD --format=lz4 -f tmp
597 $ZSTD -d -f -v tmp.lz4
600 $ECHO "lz4 binary not detected"
603 $ECHO "lz4 mode not supported"
607 $ECHO "\n===> lz4 frame tests "
609 if [ $LZ4MODE -eq 1 ]; then
611 $ZSTD -f --format=lz4 tmp
613 cat tmp.lz4 tmp.zst tmp.lz4 tmp.zst | $ZSTD -d -f -o tmp
614 head -c -1 tmp.lz4 | $ZSTD -t > $INTOVOID && die "incomplete frame not detected !"
617 $ECHO "lz4 mode not supported"
620 $ECHO "\n===> zstd round-trip tests "
623 roundTripTest -g15K # TableID==3
624 roundTripTest -g127K # TableID==2
625 roundTripTest -g255K # TableID==1
626 roundTripTest -g522K # TableID==0
627 roundTripTest -g519K 6 # greedy, hash chain
628 roundTripTest -g517K 16 # btlazy2
629 roundTripTest -g516K 19 # btopt
631 fileRoundTripTest -g500K
633 $ECHO "\n===> zstd long distance matching round-trip tests "
634 roundTripTest -g0 "2 --single-thread --long"
635 roundTripTest -g1000K "1 --single-thread --long"
636 roundTripTest -g517K "6 --single-thread --long"
637 roundTripTest -g516K "16 --single-thread --long"
638 roundTripTest -g518K "19 --single-thread --long"
639 fileRoundTripTest -g5M "3 --single-thread --long"
642 roundTripTest -g96K "5 --single-thread"
645 $ECHO "\n===> zstdmt round-trip tests "
646 roundTripTest -g4M "1 -T0"
647 roundTripTest -g8M "3 -T2"
648 roundTripTest -g8000K "2 --threads=2"
649 fileRoundTripTest -g4M "19 -T2 -B1M"
651 $ECHO "\n===> zstdmt long distance matching round-trip tests "
652 roundTripTest -g8M "3 --long=24 -T2"
654 $ECHO "\n===> no multithreading, skipping zstdmt tests "
659 $ECHO "\n===> zstd --list/-l single frame tests "
665 $ZSTD -lv *.zst | grep "Decompressed Size:" # check that decompressed size is present in header
667 $ZSTD --list -v *.zst
669 $ECHO "\n===> zstd --list/-l multiple frame tests "
670 cat tmp1.zst tmp2.zst > tmp12.zst
671 cat tmp12.zst tmp3.zst > tmp123.zst
675 $ECHO "\n===> zstd --list/-l error detection tests "
676 ! $ZSTD -l tmp1 tmp1.zst
679 ! $ZSTD --list -v tmp2 tmp12.zst
681 $ECHO "\n===> zstd --list/-l test with null files "
686 $ZSTD -lv tmp5.zst | grep "Decompressed Size: 0.00 KB (0 B)" # check that 0 size is present in header
689 $ECHO "\n===> zstd --list/-l test with no content size field "
690 ./datagen -g513K | $ZSTD > tmp6.zst
692 ! $ZSTD -lv tmp6.zst | grep "Decompressed Size:" # must NOT be present in header
694 $ECHO "\n===> zstd --list/-l test with no checksum "
695 $ZSTD -f --no-check tmp1
702 $ECHO "\n===> zstd long distance matching tests "
703 roundTripTest -g0 " --single-thread --long"
704 roundTripTest -g9M "2 --single-thread --long"
705 # Test parameter parsing
706 roundTripTest -g1M -P50 "1 --single-thread --long=29" " --memory=512MB"
707 roundTripTest -g1M -P50 "1 --single-thread --long=29 --zstd=wlog=28" " --memory=256MB"
708 roundTripTest -g1M -P50 "1 --single-thread --long=29" " --long=28 --memory=512MB"
709 roundTripTest -g1M -P50 "1 --single-thread --long=29" " --zstd=wlog=28 --memory=512MB"
712 if [ "$1" != "--test-large-data" ]; then
713 $ECHO "Skipping large data tests"
717 $ECHO "\n===> large files tests "
719 roundTripTest -g270000000 1
720 roundTripTest -g250000000 2
721 roundTripTest -g230000000 3
723 roundTripTest -g140000000 -P60 4
724 roundTripTest -g130000000 -P62 5
725 roundTripTest -g120000000 -P65 6
727 roundTripTest -g70000000 -P70 7
728 roundTripTest -g60000000 -P71 8
729 roundTripTest -g50000000 -P73 9
731 roundTripTest -g35000000 -P75 10
732 roundTripTest -g30000000 -P76 11
733 roundTripTest -g25000000 -P78 12
735 roundTripTest -g18000013 -P80 13
736 roundTripTest -g18000014 -P80 14
737 roundTripTest -g18000015 -P81 15
738 roundTripTest -g18000016 -P84 16
739 roundTripTest -g18000017 -P88 17
740 roundTripTest -g18000018 -P94 18
741 roundTripTest -g18000019 -P96 19
743 roundTripTest -g5000000000 -P99 1
744 roundTripTest -g1700000000 -P0 "1 --zstd=strategy=6" # ensure btlazy2 can survive an overflow rescale
746 fileRoundTripTest -g4193M -P99 1
749 $ECHO "\n===> zstd long, long distance matching round-trip tests "
750 roundTripTest -g270000000 "1 --single-thread --long"
751 roundTripTest -g130000000 -P60 "5 --single-thread --long"
752 roundTripTest -g35000000 -P70 "8 --single-thread --long"
753 roundTripTest -g18000001 -P80 "18 --single-thread --long"
754 # Test large window logs
755 roundTripTest -g700M -P50 "1 --single-thread --long=29"
756 roundTripTest -g600M -P50 "1 --single-thread --long --zstd=wlog=29,clog=28"
761 $ECHO "\n===> zstdmt long round-trip tests "
762 roundTripTest -g80000000 -P99 "19 -T2" " "
763 roundTripTest -g5000000000 -P99 "1 -T2" " "
764 roundTripTest -g500000000 -P97 "1 -T999" " "
765 fileRoundTripTest -g4103M -P98 " -T0" " "
766 roundTripTest -g400000000 -P97 "1 --long=24 -T2" " "
768 $ECHO "\n**** no multithreading, skipping zstdmt tests **** "