]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tests/playTests.sh
Import Zstandard 1.2.0
[FreeBSD/FreeBSD.git] / tests / playTests.sh
1 #!/bin/sh -e
2
3 die() {
4     $ECHO "$@" 1>&2
5     exit 1
6 }
7
8 roundTripTest() {
9     if [ -n "$3" ]; then
10         local_c="$3"
11         local_p="$2"
12     else
13         local_c="$2"
14         local_p=""
15     fi
16
17     rm -f tmp1 tmp2
18     $ECHO "roundTripTest: ./datagen $1 $local_p | $ZSTD -v$local_c | $ZSTD -d"
19     ./datagen $1 $local_p | $MD5SUM > tmp1
20     ./datagen $1 $local_p | $ZSTD --ultra -v$local_c | $ZSTD -d  | $MD5SUM > tmp2
21     $DIFF -q tmp1 tmp2
22 }
23
24 fileRoundTripTest() {
25     if [ -n "$3" ]; then
26         local_c="$3"
27         local_p="$2"
28     else
29         local_c="$2"
30         local_p=""
31     fi
32
33     rm -f tmp.zstd tmp.md5.1 tmp.md5.2
34     $ECHO "fileRoundTripTest: ./datagen $1 $local_p > tmp && $ZSTD -v$local_c -c tmp | $ZSTD -d"
35     ./datagen $1 $local_p > tmp
36     cat tmp | $MD5SUM > tmp.md5.1
37     $ZSTD --ultra -v$local_c -c tmp | $ZSTD -d | $MD5SUM > tmp.md5.2
38     $DIFF -q tmp.md5.1 tmp.md5.2
39 }
40
41 isTerminal=false
42 if [ -t 0 ] && [ -t 1 ]
43 then
44     isTerminal=true
45 fi
46
47 isWindows=false
48 ECHO="echo -e"
49 INTOVOID="/dev/null"
50 case "$OS" in
51   Windows*)
52     isWindows=true
53     INTOVOID="NUL"
54     ;;
55 esac
56
57 UNAME=$(uname)
58 case "$UNAME" in
59   Darwin) MD5SUM="md5 -r" ;;
60   FreeBSD) MD5SUM="gmd5sum" ;;
61   *) MD5SUM="md5sum" ;;
62 esac
63
64 DIFF="diff"
65 case "$UNAME" in
66   SunOS) DIFF="gdiff" ;;
67 esac
68
69 $ECHO "\nStarting playTests.sh isWindows=$isWindows ZSTD='$ZSTD'"
70
71 [ -n "$ZSTD" ] || die "ZSTD variable must be defined!"
72
73 if [ -n "$(echo hello | $ZSTD -v -T2 2>&1 > $INTOVOID | grep 'multi-threading is disabled')" ]
74 then
75     hasMT=""
76 else
77     hasMT="true"
78 fi
79
80 $ECHO "\n**** simple tests **** "
81
82 ./datagen > tmp
83 $ECHO "test : basic compression "
84 $ZSTD -f tmp                      # trivial compression case, creates tmp.zst
85 $ECHO "test : basic decompression"
86 $ZSTD -df tmp.zst                 # trivial decompression case (overwrites tmp)
87 $ECHO "test : too large compression level (must fail)"
88 $ZSTD -99 -f tmp  # too large compression level, automatic sized down
89 $ECHO "test : compress to stdout"
90 $ZSTD tmp -c > tmpCompressed
91 $ZSTD tmp --stdout > tmpCompressed       # long command format
92 $ECHO "test : compress to named file"
93 rm tmpCompressed
94 $ZSTD tmp -o tmpCompressed
95 ls tmpCompressed   # must work
96 $ECHO "test : -o must be followed by filename (must fail)"
97 $ZSTD tmp -of tmpCompressed && die "-o must be followed by filename "
98 $ECHO "test : force write, correct order"
99 $ZSTD tmp -fo tmpCompressed
100 $ECHO "test : forgotten argument"
101 cp tmp tmp2
102 $ZSTD tmp2 -fo && die "-o must be followed by filename "
103 $ECHO "test : implied stdout when input is stdin"
104 $ECHO bob | $ZSTD | $ZSTD -d
105 if [ "$isTerminal" = true ]; then
106 $ECHO "test : compressed data to terminal"
107 $ECHO bob | $ZSTD && die "should have refused : compressed data to terminal"
108 $ECHO "test : compressed data from terminal (a hang here is a test fail, zstd is wrongly waiting on data from terminal)"
109 $ZSTD -d > $INTOVOID && die "should have refused : compressed data from terminal"
110 fi
111 $ECHO "test : null-length file roundtrip"
112 $ECHO -n '' | $ZSTD - --stdout | $ZSTD -d --stdout
113 $ECHO "test : decompress file with wrong suffix (must fail)"
114 $ZSTD -d tmpCompressed && die "wrong suffix error not detected!"
115 $ZSTD -df tmp && die "should have refused : wrong extension"
116 $ECHO "test : decompress into stdout"
117 $ZSTD -d tmpCompressed -c > tmpResult    # decompression using stdout
118 $ZSTD --decompress tmpCompressed -c > tmpResult
119 $ZSTD --decompress tmpCompressed --stdout > tmpResult
120 $ECHO "test : decompress from stdin into stdout"
121 $ZSTD -dc   < tmp.zst > $INTOVOID   # combine decompression, stdin & stdout
122 $ZSTD -dc - < tmp.zst > $INTOVOID
123 $ZSTD -d    < tmp.zst > $INTOVOID   # implicit stdout when stdin is used
124 $ZSTD -d  - < tmp.zst > $INTOVOID
125 $ECHO "test : impose memory limitation (must fail)"
126 $ZSTD -d -f tmp.zst -M2K -c > $INTOVOID && die "decompression needs more memory than allowed"
127 $ZSTD -d -f tmp.zst --memlimit=2K -c > $INTOVOID && die "decompression needs more memory than allowed"  # long command
128 $ZSTD -d -f tmp.zst --memory=2K -c > $INTOVOID && die "decompression needs more memory than allowed"  # long command
129 $ZSTD -d -f tmp.zst --memlimit-decompress=2K -c > $INTOVOID && die "decompression needs more memory than allowed"  # long command
130 $ECHO "test : overwrite protection"
131 $ZSTD -q tmp && die "overwrite check failed!"
132 $ECHO "test : force overwrite"
133 $ZSTD -q -f tmp
134 $ZSTD -q --force tmp
135 $ECHO "test : overwrite readonly file"
136 rm -f tmpro tmpro.zst
137 $ECHO foo > tmpro.zst
138 $ECHO foo > tmpro
139 chmod 400 tmpro.zst
140 $ZSTD -q tmpro && die "should have refused to overwrite read-only file"
141 $ZSTD -q -f tmpro
142 rm -f tmpro tmpro.zst
143 $ECHO "test : file removal"
144 $ZSTD -f --rm tmp
145 ls tmp && die "tmp should no longer be present"
146 $ZSTD -f -d --rm tmp.zst
147 ls tmp.zst && die "tmp.zst should no longer be present"
148 $ECHO "test : --rm on stdin"
149 $ECHO a | $ZSTD --rm > $INTOVOID   # --rm should remain silent
150 rm tmp
151 $ZSTD -f tmp && die "tmp not present : should have failed"
152 ls tmp.zst && die "tmp.zst should not be created"
153
154
155 $ECHO "\n**** Advanced compression parameters **** "
156 $ECHO "Hello world!" | $ZSTD --zstd=windowLog=21,      - -o tmp.zst && die "wrong parameters not detected!"
157 $ECHO "Hello world!" | $ZSTD --zstd=windowLo=21        - -o tmp.zst && die "wrong parameters not detected!"
158 $ECHO "Hello world!" | $ZSTD --zstd=windowLog=21,slog  - -o tmp.zst && die "wrong parameters not detected!"
159 ls tmp.zst && die "tmp.zst should not be created"
160 roundTripTest -g512K
161 roundTripTest -g512K " --zstd=slen=3,tlen=48,strat=6"
162 roundTripTest -g512K " --zstd=strat=6,wlog=23,clog=23,hlog=22,slog=6"
163 roundTripTest -g512K " --zstd=windowLog=23,chainLog=23,hashLog=22,searchLog=6,searchLength=3,targetLength=48,strategy=6"
164 roundTripTest -g512K 19
165
166
167 $ECHO "\n**** Pass-Through mode **** "
168 $ECHO "Hello world 1!" | $ZSTD -df
169 $ECHO "Hello world 2!" | $ZSTD -dcf
170 $ECHO "Hello world 3!" > tmp1
171 $ZSTD -dcf tmp1
172
173
174 $ECHO "\n**** frame concatenation **** "
175
176 $ECHO "hello " > hello.tmp
177 $ECHO "world!" > world.tmp
178 cat hello.tmp world.tmp > helloworld.tmp
179 $ZSTD -c hello.tmp > hello.zstd
180 $ZSTD -c world.tmp > world.zstd
181 cat hello.zstd world.zstd > helloworld.zstd
182 $ZSTD -dc helloworld.zstd > result.tmp
183 cat result.tmp
184 $DIFF helloworld.tmp result.tmp
185 $ECHO "frame concatenation without checksum"
186 $ZSTD -c hello.tmp > hello.zstd --no-check
187 $ZSTD -c world.tmp > world.zstd --no-check
188 cat hello.zstd world.zstd > helloworld.zstd
189 $ZSTD -dc helloworld.zstd > result.tmp
190 cat result.tmp
191 $DIFF helloworld.tmp result.tmp
192 rm ./*.tmp ./*.zstd
193 $ECHO "frame concatenation tests completed"
194
195
196 if [ "$isWindows" = false ] && [ "$UNAME" != 'SunOS' ] ; then
197 $ECHO "\n**** flush write error test **** "
198
199 $ECHO "$ECHO foo | $ZSTD > /dev/full"
200 $ECHO foo | $ZSTD > /dev/full && die "write error not detected!"
201 $ECHO "$ECHO foo | $ZSTD | $ZSTD -d > /dev/full"
202 $ECHO foo | $ZSTD | $ZSTD -d > /dev/full && die "write error not detected!"
203
204 $ECHO "\n**** symbolic link test **** "
205
206 rm -f hello.tmp world.tmp hello.tmp.zst world.tmp.zst
207 $ECHO "hello world" > hello.tmp
208 ln -s hello.tmp world.tmp
209 $ZSTD world.tmp hello.tmp
210 ls hello.tmp.zst || die "regular file should have been compressed!"
211 ls world.tmp.zst && die "symbolic link should not have been compressed!"
212 $ZSTD world.tmp hello.tmp -f
213 ls world.tmp.zst || die "symbol link should have been compressed with --force"
214 rm -f hello.tmp world.tmp hello.tmp.zst world.tmp.zst
215
216 fi
217
218
219 $ECHO "\n**** test sparse file support **** "
220
221 ./datagen -g5M  -P100 > tmpSparse
222 $ZSTD tmpSparse -c | $ZSTD -dv -o tmpSparseRegen
223 $DIFF -s tmpSparse tmpSparseRegen
224 $ZSTD tmpSparse -c | $ZSTD -dv --sparse -c > tmpOutSparse
225 $DIFF -s tmpSparse tmpOutSparse
226 $ZSTD tmpSparse -c | $ZSTD -dv --no-sparse -c > tmpOutNoSparse
227 $DIFF -s tmpSparse tmpOutNoSparse
228 ls -ls tmpSparse*
229 ./datagen -s1 -g1200007 -P100 | $ZSTD | $ZSTD -dv --sparse -c > tmpSparseOdd   # Odd size file (to not finish on an exact nb of blocks)
230 ./datagen -s1 -g1200007 -P100 | $DIFF -s - tmpSparseOdd
231 ls -ls tmpSparseOdd
232 $ECHO "\n Sparse Compatibility with Console :"
233 $ECHO "Hello World 1 !" | $ZSTD | $ZSTD -d -c
234 $ECHO "Hello World 2 !" | $ZSTD | $ZSTD -d | cat
235 $ECHO "\n Sparse Compatibility with Append :"
236 ./datagen -P100 -g1M > tmpSparse1M
237 cat tmpSparse1M tmpSparse1M > tmpSparse2M
238 $ZSTD -v -f tmpSparse1M -o tmpSparseCompressed
239 $ZSTD -d -v -f tmpSparseCompressed -o tmpSparseRegenerated
240 $ZSTD -d -v -f tmpSparseCompressed -c >> tmpSparseRegenerated
241 ls -ls tmpSparse*
242 $DIFF tmpSparse2M tmpSparseRegenerated
243 rm tmpSparse*
244
245
246 $ECHO "\n**** multiple files tests **** "
247
248 ./datagen -s1        > tmp1 2> $INTOVOID
249 ./datagen -s2 -g100K > tmp2 2> $INTOVOID
250 ./datagen -s3 -g1M   > tmp3 2> $INTOVOID
251 $ECHO "compress tmp* : "
252 $ZSTD -f tmp*
253 ls -ls tmp*
254 rm tmp1 tmp2 tmp3
255 $ECHO "decompress tmp* : "
256 $ZSTD -df *.zst
257 ls -ls tmp*
258 $ECHO "compress tmp* into stdout > tmpall : "
259 $ZSTD -c tmp1 tmp2 tmp3 > tmpall
260 ls -ls tmp*
261 $ECHO "decompress tmpall* into stdout > tmpdec : "
262 cp tmpall tmpall2
263 $ZSTD -dc tmpall* > tmpdec
264 ls -ls tmp*
265 $ECHO "compress multiple files including a missing one (notHere) : "
266 $ZSTD -f tmp1 notHere tmp2 && die "missing file not detected!"
267
268
269 $ECHO "\n**** dictionary tests **** "
270
271 $ECHO "- test with raw dict (content only) "
272 ./datagen > tmpDict
273 ./datagen -g1M | $MD5SUM > tmp1
274 ./datagen -g1M | $ZSTD -D tmpDict | $ZSTD -D tmpDict -dvq | $MD5SUM > tmp2
275 $DIFF -q tmp1 tmp2
276 $ECHO "- Create first dictionary "
277 TESTFILE=../programs/zstdcli.c
278 $ZSTD --train *.c ../programs/*.c -o tmpDict
279 cp $TESTFILE tmp
280 $ZSTD -f tmp -D tmpDict
281 $ZSTD -d tmp.zst -D tmpDict -fo result
282 $DIFF $TESTFILE result
283 $ECHO "- Create second (different) dictionary "
284 $ZSTD --train *.c ../programs/*.c ../programs/*.h -o tmpDictC
285 $ZSTD -d tmp.zst -D tmpDictC -fo result && die "wrong dictionary not detected!"
286 $ECHO "- Create dictionary with short dictID"
287 $ZSTD --train *.c ../programs/*.c --dictID=1 -o tmpDict1
288 cmp tmpDict tmpDict1 && die "dictionaries should have different ID !"
289 $ECHO "- Create dictionary with wrong dictID parameter order (must fail)"
290 $ZSTD --train *.c ../programs/*.c --dictID -o 1 tmpDict1 && die "wrong order : --dictID must be followed by argument "
291 $ECHO "- Create dictionary with size limit"
292 $ZSTD --train *.c ../programs/*.c -o tmpDict2 --maxdict=4K -v
293 $ECHO "- Create dictionary with wrong parameter order (must fail)"
294 $ZSTD --train *.c ../programs/*.c -o tmpDict2 --maxdict -v 4K && die "wrong order : --maxdict must be followed by argument "
295 $ECHO "- Compress without dictID"
296 $ZSTD -f tmp -D tmpDict1 --no-dictID
297 $ZSTD -d tmp.zst -D tmpDict -fo result
298 $DIFF $TESTFILE result
299 $ECHO "- Compress with wrong argument order (must fail)"
300 $ZSTD tmp -Df tmpDict1 -c > $INTOVOID && die "-D must be followed by dictionary name "
301 $ECHO "- Compress multiple files with dictionary"
302 rm -rf dirTestDict
303 mkdir dirTestDict
304 cp *.c dirTestDict
305 cp ../programs/*.c dirTestDict
306 cp ../programs/*.h dirTestDict
307 $MD5SUM dirTestDict/* > tmph1
308 $ZSTD -f --rm dirTestDict/* -D tmpDictC
309 $ZSTD -d --rm dirTestDict/*.zst -D tmpDictC  # note : use internal checksum by default
310 case "$UNAME" in
311   Darwin) $ECHO "md5sum -c not supported on OS-X : test skipped" ;;  # not compatible with OS-X's md5
312   *) $MD5SUM -c tmph1 ;;
313 esac
314 rm -rf dirTestDict
315 $ECHO "- dictionary builder on bogus input"
316 $ECHO "Hello World" > tmp
317 $ZSTD --train-legacy -q tmp && die "Dictionary training should fail : not enough input source"
318 ./datagen -P0 -g10M > tmp
319 $ZSTD --train-legacy -q tmp && die "Dictionary training should fail : source is pure noise"
320 rm tmp*
321
322
323 $ECHO "\n**** cover dictionary tests **** "
324
325 TESTFILE=../programs/zstdcli.c
326 ./datagen > tmpDict
327 $ECHO "- Create first dictionary"
328 $ZSTD --train-cover=k=46,d=8 *.c ../programs/*.c -o tmpDict
329 cp $TESTFILE tmp
330 $ZSTD -f tmp -D tmpDict
331 $ZSTD -d tmp.zst -D tmpDict -fo result
332 $DIFF $TESTFILE result
333 $ECHO "- Create second (different) dictionary"
334 $ZSTD --train-cover=k=56,d=8 *.c ../programs/*.c ../programs/*.h -o tmpDictC
335 $ZSTD -d tmp.zst -D tmpDictC -fo result && die "wrong dictionary not detected!"
336 $ECHO "- Create dictionary with short dictID"
337 $ZSTD --train-cover=k=46,d=8 *.c ../programs/*.c --dictID=1 -o tmpDict1
338 cmp tmpDict tmpDict1 && die "dictionaries should have different ID !"
339 $ECHO "- Create dictionary with size limit"
340 $ZSTD --train-cover=steps=8 *.c ../programs/*.c -o tmpDict2 --maxdict=4K
341 rm tmp*
342
343 $ECHO "\n**** legacy dictionary tests **** "
344
345 TESTFILE=../programs/zstdcli.c
346 ./datagen > tmpDict
347 $ECHO "- Create first dictionary"
348 $ZSTD --train-legacy=selectivity=8 *.c ../programs/*.c -o tmpDict
349 cp $TESTFILE tmp
350 $ZSTD -f tmp -D tmpDict
351 $ZSTD -d tmp.zst -D tmpDict -fo result
352 $DIFF $TESTFILE result
353 $ECHO "- Create second (different) dictionary"
354 $ZSTD --train-legacy=s=5 *.c ../programs/*.c ../programs/*.h -o tmpDictC
355 $ZSTD -d tmp.zst -D tmpDictC -fo result && die "wrong dictionary not detected!"
356 $ECHO "- Create dictionary with short dictID"
357 $ZSTD --train-legacy -s5 *.c ../programs/*.c --dictID=1 -o tmpDict1
358 cmp tmpDict tmpDict1 && die "dictionaries should have different ID !"
359 $ECHO "- Create dictionary with size limit"
360 $ZSTD --train-legacy -s9 *.c ../programs/*.c -o tmpDict2 --maxdict=4K
361 rm tmp*
362
363
364 $ECHO "\n**** integrity tests **** "
365
366 $ECHO "test one file (tmp1.zst) "
367 ./datagen > tmp1
368 $ZSTD tmp1
369 $ZSTD -t tmp1.zst
370 $ZSTD --test tmp1.zst
371 $ECHO "test multiple files (*.zst) "
372 $ZSTD -t *.zst
373 $ECHO "test bad files (*) "
374 $ZSTD -t * && die "bad files not detected !"
375 $ZSTD -t tmp1 && die "bad file not detected !"
376 cp tmp1 tmp2.zst
377 $ZSTD -t tmp2.zst && die "bad file not detected !"
378 ./datagen -g0 > tmp3
379 $ZSTD -t tmp3 && die "bad file not detected !"   # detects 0-sized files as bad
380 $ECHO "test --rm and --test combined "
381 $ZSTD -t --rm tmp1.zst
382 ls -ls tmp1.zst  # check file is still present
383
384
385 $ECHO "\n**** benchmark mode tests **** "
386
387 $ECHO "bench one file"
388 ./datagen > tmp1
389 $ZSTD -bi0 tmp1
390 $ECHO "bench multiple levels"
391 $ZSTD -i0b0e3 tmp1
392 $ECHO "with recursive and quiet modes"
393 $ZSTD -rqi1b1e2 tmp1
394
395
396 $ECHO "\n**** gzip compatibility tests **** "
397
398 GZIPMODE=1
399 $ZSTD --format=gzip -V || GZIPMODE=0
400 if [ $GZIPMODE -eq 1 ]; then
401     $ECHO "gzip support detected"
402     GZIPEXE=1
403     gzip -V || GZIPEXE=0
404     if [ $GZIPEXE -eq 1 ]; then
405         ./datagen > tmp
406         $ZSTD --format=gzip -f tmp
407         gzip -t -v tmp.gz
408         gzip -f tmp
409         $ZSTD -d -f -v tmp.gz
410         rm tmp*
411     else
412         $ECHO "gzip binary not detected"
413     fi
414 else
415     $ECHO "gzip mode not supported"
416 fi
417
418
419 $ECHO "\n**** gzip frame tests **** "
420
421 if [ $GZIPMODE -eq 1 ]; then
422     ./datagen > tmp
423     $ZSTD -f --format=gzip tmp
424     $ZSTD -f tmp
425     cat tmp.gz tmp.zst tmp.gz tmp.zst | $ZSTD -d -f -o tmp
426     head -c -1 tmp.gz | $ZSTD -t > $INTOVOID && die "incomplete frame not detected !"
427     rm tmp*
428 else
429     $ECHO "gzip mode not supported"
430 fi
431
432
433 $ECHO "\n**** xz compatibility tests **** "
434
435 LZMAMODE=1
436 $ZSTD --format=xz -V || LZMAMODE=0
437 if [ $LZMAMODE -eq 1 ]; then
438     $ECHO "xz support detected"
439     XZEXE=1
440     xz -V && lzma -V || XZEXE=0
441     if [ $XZEXE -eq 1 ]; then
442         ./datagen > tmp
443         $ZSTD --format=lzma -f tmp
444         $ZSTD --format=xz -f tmp
445         xz -t -v tmp.xz
446         xz -t -v tmp.lzma
447         xz -f -k tmp
448         lzma -f -k --lzma1 tmp
449         $ZSTD -d -f -v tmp.xz
450         $ZSTD -d -f -v tmp.lzma
451         rm tmp*
452     else
453         $ECHO "xz binary not detected"
454     fi
455 else
456     $ECHO "xz mode not supported"
457 fi
458
459
460 $ECHO "\n**** xz frame tests **** "
461
462 if [ $LZMAMODE -eq 1 ]; then
463     ./datagen > tmp
464     $ZSTD -f --format=xz tmp
465     $ZSTD -f --format=lzma tmp
466     $ZSTD -f tmp
467     cat tmp.xz tmp.lzma tmp.zst tmp.lzma tmp.xz tmp.zst | $ZSTD -d -f -o tmp
468     head -c -1 tmp.xz | $ZSTD -t > $INTOVOID && die "incomplete frame not detected !"
469     head -c -1 tmp.lzma | $ZSTD -t > $INTOVOID && die "incomplete frame not detected !"
470     rm tmp*
471 else
472     $ECHO "xz mode not supported"
473 fi
474
475 $ECHO "\n**** lz4 compatibility tests **** "
476
477 LZ4MODE=1
478 $ZSTD --format=lz4 -V || LZ4MODE=0
479 if [ $LZ4MODE -eq 1 ]; then
480     $ECHO "lz4 support detected"
481     LZ4EXE=1
482     lz4 -V || LZ4EXE=0
483     if [ $LZ4EXE -eq 1 ]; then
484         ./datagen > tmp
485         $ZSTD --format=lz4 -f tmp
486         lz4 -t -v tmp.lz4
487         lz4 -f tmp
488         $ZSTD -d -f -v tmp.lz4
489         rm tmp*
490     else
491         $ECHO "lz4 binary not detected"
492     fi
493 else
494     $ECHO "lz4 mode not supported"
495 fi
496
497
498 $ECHO "\n**** lz4 frame tests **** "
499
500 if [ $LZ4MODE -eq 1 ]; then
501     ./datagen > tmp
502     $ZSTD -f --format=lz4 tmp
503     $ZSTD -f tmp
504     cat tmp.lz4 tmp.zst tmp.lz4 tmp.zst | $ZSTD -d -f -o tmp
505     head -c -1 tmp.lz4 | $ZSTD -t > $INTOVOID && die "incomplete frame not detected !"
506     rm tmp*
507 else
508     $ECHO "lz4 mode not supported"
509 fi
510
511 $ECHO "\n**** zstd round-trip tests **** "
512
513 roundTripTest
514 roundTripTest -g15K       # TableID==3
515 roundTripTest -g127K      # TableID==2
516 roundTripTest -g255K      # TableID==1
517 roundTripTest -g522K      # TableID==0
518 roundTripTest -g519K 6    # greedy, hash chain
519 roundTripTest -g517K 16   # btlazy2
520 roundTripTest -g516K 19   # btopt
521
522 fileRoundTripTest -g500K
523
524 if [ -n "$hasMT" ]
525 then
526     $ECHO "\n**** zstdmt round-trip tests **** "
527     roundTripTest -g4M "1 -T0"
528     roundTripTest -g8M "3 -T2"
529     roundTripTest -g8000K "2 --threads=2"
530     fileRoundTripTest -g4M "19 -T2 -B1M"
531 else
532     $ECHO "\n**** no multithreading, skipping zstdmt tests **** "
533 fi
534
535 rm tmp*
536
537 if [ "$1" != "--test-large-data" ]; then
538     $ECHO "Skipping large data tests"
539     exit 0
540 fi
541
542 roundTripTest -g270000000 1
543 roundTripTest -g270000000 2
544 roundTripTest -g270000000 3
545
546 roundTripTest -g140000000 -P60 4
547 roundTripTest -g140000000 -P60 5
548 roundTripTest -g140000000 -P60 6
549
550 roundTripTest -g70000000 -P70 7
551 roundTripTest -g70000000 -P70 8
552 roundTripTest -g70000000 -P70 9
553
554 roundTripTest -g35000000 -P75 10
555 roundTripTest -g35000000 -P75 11
556 roundTripTest -g35000000 -P75 12
557
558 roundTripTest -g18000000 -P80 13
559 roundTripTest -g18000000 -P80 14
560 roundTripTest -g18000000 -P80 15
561 roundTripTest -g18000000 -P80 16
562 roundTripTest -g18000000 -P80 17
563
564 roundTripTest -g50000000 -P94 18
565 roundTripTest -g50000000 -P94 19
566
567 roundTripTest -g99000000 -P99 20
568 roundTripTest -g6000000000 -P99 1
569
570 fileRoundTripTest -g4193M -P99 1
571
572 if [ -n "$hasMT" ]
573 then
574     $ECHO "\n**** zstdmt long round-trip tests **** "
575     roundTripTest -g99000000 -P99 "20 -T2"
576     roundTripTest -g6000000000 -P99 "1 -T2"
577     fileRoundTripTest -g4193M -P98 " -T0"
578 else
579     $ECHO "\n**** no multithreading, skipping zstdmt tests **** "
580 fi
581
582 rm tmp*