Konstantin Tokarev | d66db2f | 2015-12-08 18:11:10 +0300 | [diff] [blame] | 1 | #!/bin/sh -e |
| 2 | |
| 3 | die() { |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 4 | $ECHO "$@" 1>&2 |
Konstantin Tokarev | d66db2f | 2015-12-08 18:11:10 +0300 | [diff] [blame] | 5 | exit 1 |
| 6 | } |
| 7 | |
Konstantin Tokarev | 76be378 | 2015-12-08 18:36:37 +0300 | [diff] [blame] | 8 | roundTripTest() { |
| 9 | if [ -n "$3" ]; then |
| 10 | local c="$3" |
| 11 | local p="$2" |
| 12 | else |
| 13 | local c="$2" |
| 14 | fi |
| 15 | |
| 16 | rm -f tmp1 tmp2 |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 17 | $ECHO "roundTripTest: ./datagen $1 $p | $ZSTD -v$c | $ZSTD -d" |
inikep | 93fc13e | 2016-05-30 10:17:55 +0200 | [diff] [blame] | 18 | ./datagen $1 $p | $MD5SUM > tmp1 |
Yann Collet | 06dd741 | 2016-07-18 04:06:43 +0200 | [diff] [blame] | 19 | ./datagen $1 $p | $ZSTD -v$c | $ZSTD -d | $MD5SUM > tmp2 |
Konstantin Tokarev | 76be378 | 2015-12-08 18:36:37 +0300 | [diff] [blame] | 20 | diff -q tmp1 tmp2 |
| 21 | } |
| 22 | |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 23 | isWindows=false |
| 24 | ECHO="echo" |
Yann Collet | 391a128 | 2016-06-21 17:06:25 +0200 | [diff] [blame] | 25 | INTOVOID="/dev/null" |
inikep | 993a9df | 2016-05-27 10:07:46 +0200 | [diff] [blame] | 26 | case "$OS" in |
Yann Collet | 673f0d7 | 2016-06-06 00:26:38 +0200 | [diff] [blame] | 27 | Windows*) |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 28 | isWindows=true |
| 29 | ECHO="echo -e" |
Yann Collet | 391a128 | 2016-06-21 17:06:25 +0200 | [diff] [blame] | 30 | INTOVOID="nul" |
inikep | 993a9df | 2016-05-27 10:07:46 +0200 | [diff] [blame] | 31 | ;; |
| 32 | esac |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 33 | |
inikep | 93fc13e | 2016-05-30 10:17:55 +0200 | [diff] [blame] | 34 | MD5SUM="md5sum" |
Yann Collet | 70e3b31 | 2016-08-23 01:18:06 +0200 | [diff] [blame] | 35 | if [[ "$OSTYPE" == "darwin"* ]]; then |
inikep | 93fc13e | 2016-05-30 10:17:55 +0200 | [diff] [blame] | 36 | MD5SUM="md5 -r" |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 37 | fi |
| 38 | |
Przemyslaw Skibinski | e579ab5 | 2016-11-14 12:57:05 +0100 | [diff] [blame^] | 39 | $ECHO "\nStarting playTests.sh isWindows=$isWindows ZSTD='$ZSTD'" |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 40 | |
Konstantin Tokarev | 76be378 | 2015-12-08 18:36:37 +0300 | [diff] [blame] | 41 | [ -n "$ZSTD" ] || die "ZSTD variable must be defined!" |
| 42 | |
inikep | 1dcb2ff | 2016-05-30 11:33:52 +0200 | [diff] [blame] | 43 | file $ZSTD |
Yann Collet | c843142 | 2016-09-01 15:05:57 -0700 | [diff] [blame] | 44 | |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 45 | $ECHO "\n**** simple tests **** " |
Yann Collet | de95f96 | 2016-05-23 19:46:47 +0200 | [diff] [blame] | 46 | |
Yann Collet | 8154c3d | 2016-02-13 03:12:10 +0100 | [diff] [blame] | 47 | ./datagen > tmp |
Yann Collet | b3060f7 | 2016-09-09 16:44:16 +0200 | [diff] [blame] | 48 | $ECHO "test : basic compression " |
Yann Collet | 673f0d7 | 2016-06-06 00:26:38 +0200 | [diff] [blame] | 49 | $ZSTD -f tmp # trivial compression case, creates tmp.zst |
Yann Collet | b3060f7 | 2016-09-09 16:44:16 +0200 | [diff] [blame] | 50 | $ECHO "test : basic decompression" |
Yann Collet | 673f0d7 | 2016-06-06 00:26:38 +0200 | [diff] [blame] | 51 | $ZSTD -df tmp.zst # trivial decompression case (overwrites tmp) |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 52 | $ECHO "test : too large compression level (must fail)" |
Yann Collet | fab0230 | 2016-08-12 19:00:18 +0200 | [diff] [blame] | 53 | $ZSTD -99 -f tmp # too large compression level, automatic sized down |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 54 | $ECHO "test : compress to stdout" |
Yann Collet | 0d348d4 | 2016-05-29 02:02:24 +0200 | [diff] [blame] | 55 | $ZSTD tmp -c > tmpCompressed |
Yann Collet | d693117 | 2016-05-10 05:56:09 +0200 | [diff] [blame] | 56 | $ZSTD tmp --stdout > tmpCompressed # long command format |
Yann Collet | 27b5ac6 | 2016-09-21 14:20:56 +0200 | [diff] [blame] | 57 | $ECHO "test : compress to named file" |
| 58 | rm tmpCompressed |
| 59 | $ZSTD tmp -o tmpCompressed |
| 60 | ls tmpCompressed # must work |
| 61 | $ECHO "test : -o must be followed by filename (must fail)" |
Yann Collet | 714464f | 2016-09-21 16:05:03 +0200 | [diff] [blame] | 62 | $ZSTD tmp -of tmpCompressed && die "-o must be followed by filename " |
Yann Collet | 27b5ac6 | 2016-09-21 14:20:56 +0200 | [diff] [blame] | 63 | $ECHO "test : force write, correct order" |
| 64 | $ZSTD tmp -fo tmpCompressed |
Yann Collet | 714464f | 2016-09-21 16:05:03 +0200 | [diff] [blame] | 65 | $ECHO "test : forgotten argument" |
| 66 | cp tmp tmp2 |
| 67 | $ZSTD tmp2 -fo && die "-o must be followed by filename " |
Yann Collet | c843142 | 2016-09-01 15:05:57 -0700 | [diff] [blame] | 68 | $ECHO "test : implied stdout when input is stdin" |
| 69 | $ECHO bob | $ZSTD | $ZSTD -d |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 70 | $ECHO "test : null-length file roundtrip" |
| 71 | $ECHO -n '' | $ZSTD - --stdout | $ZSTD -d --stdout |
| 72 | $ECHO "test : decompress file with wrong suffix (must fail)" |
Yann Collet | 2d08b09 | 2016-02-16 14:42:08 +0100 | [diff] [blame] | 73 | $ZSTD -d tmpCompressed && die "wrong suffix error not detected!" |
Yann Collet | 391a128 | 2016-06-21 17:06:25 +0200 | [diff] [blame] | 74 | $ZSTD -df tmp && die "should have refused : wrong extension" |
| 75 | $ECHO "test : decompress into stdout" |
Yann Collet | 0d348d4 | 2016-05-29 02:02:24 +0200 | [diff] [blame] | 76 | $ZSTD -d tmpCompressed -c > tmpResult # decompression using stdout |
Yann Collet | 2d08b09 | 2016-02-16 14:42:08 +0100 | [diff] [blame] | 77 | $ZSTD --decompress tmpCompressed -c > tmpResult |
| 78 | $ZSTD --decompress tmpCompressed --stdout > tmpResult |
Yann Collet | 391a128 | 2016-06-21 17:06:25 +0200 | [diff] [blame] | 79 | $ECHO "test : decompress from stdin into stdout" |
| 80 | $ZSTD -dc < tmp.zst > $INTOVOID # combine decompression, stdin & stdout |
| 81 | $ZSTD -dc - < tmp.zst > $INTOVOID |
| 82 | $ZSTD -d < tmp.zst > $INTOVOID # implicit stdout when stdin is used |
| 83 | $ZSTD -d - < tmp.zst > $INTOVOID |
Yann Collet | d4cda27 | 2016-10-14 13:13:13 -0700 | [diff] [blame] | 84 | $ECHO "test : impose memory limitation (must fail)" |
| 85 | $ZSTD -d -f tmp.zst -M2K -c > $INTOVOID && die "decompression needs more memory than allowed" |
Yann Collet | 1122349 | 2016-10-14 14:07:11 -0700 | [diff] [blame] | 86 | $ZSTD -d -f tmp.zst --memlimit=2K -c > $INTOVOID && die "decompression needs more memory than allowed" # long command |
Yann Collet | d7b120a | 2016-10-14 14:22:32 -0700 | [diff] [blame] | 87 | $ZSTD -d -f tmp.zst --memory=2K -c > $INTOVOID && die "decompression needs more memory than allowed" # long command |
| 88 | $ZSTD -d -f tmp.zst --memlimit-decompress=2K -c > $INTOVOID && die "decompression needs more memory than allowed" # long command |
Yann Collet | 391a128 | 2016-06-21 17:06:25 +0200 | [diff] [blame] | 89 | $ECHO "test : overwrite protection" |
Yann Collet | 2d08b09 | 2016-02-16 14:42:08 +0100 | [diff] [blame] | 90 | $ZSTD -q tmp && die "overwrite check failed!" |
Yann Collet | 391a128 | 2016-06-21 17:06:25 +0200 | [diff] [blame] | 91 | $ECHO "test : force overwrite" |
Yann Collet | 2d08b09 | 2016-02-16 14:42:08 +0100 | [diff] [blame] | 92 | $ZSTD -q -f tmp |
| 93 | $ZSTD -q --force tmp |
Yann Collet | b09b12c | 2016-06-09 22:59:51 +0200 | [diff] [blame] | 94 | $ECHO "test : file removal" |
| 95 | $ZSTD -f --rm tmp |
| 96 | ls tmp && die "tmp should no longer be present" |
| 97 | $ZSTD -f -d --rm tmp.zst |
| 98 | ls tmp.zst && die "tmp.zst should no longer be present" |
| 99 | rm tmp |
| 100 | $ZSTD -f tmp && die "tmp not present : should have failed" |
| 101 | ls tmp.zst && die "tmp.zst should not be created" |
Yann Collet | de95f96 | 2016-05-23 19:46:47 +0200 | [diff] [blame] | 102 | |
| 103 | |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 104 | $ECHO "\n**** Pass-Through mode **** " |
| 105 | $ECHO "Hello world !" | $ZSTD -df |
| 106 | $ECHO "Hello world !" | $ZSTD -dcf |
Yann Collet | de95f96 | 2016-05-23 19:46:47 +0200 | [diff] [blame] | 107 | |
Yann Collet | 8154c3d | 2016-02-13 03:12:10 +0100 | [diff] [blame] | 108 | |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 109 | $ECHO "\n**** frame concatenation **** " |
Konstantin Tokarev | d66db2f | 2015-12-08 18:11:10 +0300 | [diff] [blame] | 110 | |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 111 | $ECHO "hello " > hello.tmp |
| 112 | $ECHO "world!" > world.tmp |
Konstantin Tokarev | d66db2f | 2015-12-08 18:11:10 +0300 | [diff] [blame] | 113 | cat hello.tmp world.tmp > helloworld.tmp |
Yann Collet | c8da2c9 | 2016-02-12 02:56:27 +0100 | [diff] [blame] | 114 | $ZSTD -c hello.tmp > hello.zstd |
| 115 | $ZSTD -c world.tmp > world.zstd |
Konstantin Tokarev | d66db2f | 2015-12-08 18:11:10 +0300 | [diff] [blame] | 116 | cat hello.zstd world.zstd > helloworld.zstd |
Yann Collet | c8da2c9 | 2016-02-12 02:56:27 +0100 | [diff] [blame] | 117 | $ZSTD -dc helloworld.zstd > result.tmp |
Konstantin Tokarev | d66db2f | 2015-12-08 18:11:10 +0300 | [diff] [blame] | 118 | cat result.tmp |
| 119 | sdiff helloworld.tmp result.tmp |
Yann Collet | 4c5bbf6 | 2016-07-28 20:30:25 +0200 | [diff] [blame] | 120 | $ECHO "frame concatenation without checksum" |
| 121 | $ZSTD -c hello.tmp > hello.zstd --no-check |
| 122 | $ZSTD -c world.tmp > world.zstd --no-check |
| 123 | cat hello.zstd world.zstd > helloworld.zstd |
| 124 | $ZSTD -dc helloworld.zstd > result.tmp |
| 125 | cat result.tmp |
| 126 | sdiff helloworld.tmp result.tmp |
Konstantin Tokarev | 76be378 | 2015-12-08 18:36:37 +0300 | [diff] [blame] | 127 | rm ./*.tmp ./*.zstd |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 128 | $ECHO "frame concatenation tests completed" |
Konstantin Tokarev | d66db2f | 2015-12-08 18:11:10 +0300 | [diff] [blame] | 129 | |
Yann Collet | f062436 | 2016-02-12 15:56:46 +0100 | [diff] [blame] | 130 | |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 131 | if [ "$isWindows" = false ] ; then |
| 132 | $ECHO "\n**** flush write error test **** " |
Konstantin Tokarev | d66db2f | 2015-12-08 18:11:10 +0300 | [diff] [blame] | 133 | |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 134 | $ECHO "$ECHO foo | $ZSTD > /dev/full" |
| 135 | $ECHO foo | $ZSTD > /dev/full && die "write error not detected!" |
| 136 | $ECHO "$ECHO foo | $ZSTD | $ZSTD -d > /dev/full" |
| 137 | $ECHO foo | $ZSTD | $ZSTD -d > /dev/full && die "write error not detected!" |
| 138 | fi |
Konstantin Tokarev | d66db2f | 2015-12-08 18:11:10 +0300 | [diff] [blame] | 139 | |
Yann Collet | 6a45835 | 2015-12-18 02:51:14 +0100 | [diff] [blame] | 140 | |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 141 | $ECHO "\n**** test sparse file support **** " |
Yann Collet | 32990b5 | 2016-05-23 17:48:57 +0200 | [diff] [blame] | 142 | |
| 143 | ./datagen -g5M -P100 > tmpSparse |
| 144 | $ZSTD tmpSparse -c | $ZSTD -dv -o tmpSparseRegen |
| 145 | diff -s tmpSparse tmpSparseRegen |
| 146 | $ZSTD tmpSparse -c | $ZSTD -dv --sparse -c > tmpOutSparse |
| 147 | diff -s tmpSparse tmpOutSparse |
| 148 | $ZSTD tmpSparse -c | $ZSTD -dv --no-sparse -c > tmpOutNoSparse |
| 149 | diff -s tmpSparse tmpOutNoSparse |
| 150 | ls -ls tmpSparse* |
| 151 | ./datagen -s1 -g1200007 -P100 | $ZSTD | $ZSTD -dv --sparse -c > tmpSparseOdd # Odd size file (to not finish on an exact nb of blocks) |
| 152 | ./datagen -s1 -g1200007 -P100 | diff -s - tmpSparseOdd |
| 153 | ls -ls tmpSparseOdd |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 154 | $ECHO "\n Sparse Compatibility with Console :" |
| 155 | $ECHO "Hello World 1 !" | $ZSTD | $ZSTD -d -c |
| 156 | $ECHO "Hello World 2 !" | $ZSTD | $ZSTD -d | cat |
| 157 | $ECHO "\n Sparse Compatibility with Append :" |
Yann Collet | 32990b5 | 2016-05-23 17:48:57 +0200 | [diff] [blame] | 158 | ./datagen -P100 -g1M > tmpSparse1M |
| 159 | cat tmpSparse1M tmpSparse1M > tmpSparse2M |
| 160 | $ZSTD -v -f tmpSparse1M -o tmpSparseCompressed |
| 161 | $ZSTD -d -v -f tmpSparseCompressed -o tmpSparseRegenerated |
| 162 | $ZSTD -d -v -f tmpSparseCompressed -c >> tmpSparseRegenerated |
| 163 | ls -ls tmpSparse* |
| 164 | diff tmpSparse2M tmpSparseRegenerated |
Yann Collet | 33341de | 2016-05-29 23:09:51 +0200 | [diff] [blame] | 165 | rm tmpSparse* |
Yann Collet | 32990b5 | 2016-05-23 17:48:57 +0200 | [diff] [blame] | 166 | |
| 167 | |
Yann Collet | 9b998e4 | 2016-06-15 23:11:20 +0200 | [diff] [blame] | 168 | $ECHO "\n**** multiple files tests **** " |
| 169 | |
Yann Collet | 391a128 | 2016-06-21 17:06:25 +0200 | [diff] [blame] | 170 | ./datagen -s1 > tmp1 2> $INTOVOID |
| 171 | ./datagen -s2 -g100K > tmp2 2> $INTOVOID |
| 172 | ./datagen -s3 -g1M > tmp3 2> $INTOVOID |
Yann Collet | 9b998e4 | 2016-06-15 23:11:20 +0200 | [diff] [blame] | 173 | $ECHO "compress tmp* : " |
Yann Collet | 60ba31c | 2016-07-28 19:55:09 +0200 | [diff] [blame] | 174 | $ZSTD -f tmp* |
Yann Collet | 9b998e4 | 2016-06-15 23:11:20 +0200 | [diff] [blame] | 175 | ls -ls tmp* |
| 176 | rm tmp1 tmp2 tmp3 |
| 177 | $ECHO "decompress tmp* : " |
| 178 | $ZSTD -df *.zst |
| 179 | ls -ls tmp* |
| 180 | $ECHO "compress tmp* into stdout > tmpall : " |
| 181 | $ZSTD -c tmp1 tmp2 tmp3 > tmpall |
| 182 | ls -ls tmp* |
| 183 | $ECHO "decompress tmpall* into stdout > tmpdec : " |
| 184 | cp tmpall tmpall2 |
| 185 | $ZSTD -dc tmpall* > tmpdec |
| 186 | ls -ls tmp* |
| 187 | $ECHO "compress multiple files including a missing one (notHere) : " |
| 188 | $ZSTD -f tmp1 notHere tmp2 && die "missing file not detected!" |
| 189 | |
| 190 | |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 191 | $ECHO "\n**** dictionary tests **** " |
Yann Collet | f6f3d75 | 2015-12-13 13:35:21 +0100 | [diff] [blame] | 192 | |
inikep | b7d3449 | 2016-08-18 15:13:41 +0200 | [diff] [blame] | 193 | TESTFILE=../programs/zstdcli.c |
Yann Collet | f6f3d75 | 2015-12-13 13:35:21 +0100 | [diff] [blame] | 194 | ./datagen > tmpDict |
inikep | 93fc13e | 2016-05-30 10:17:55 +0200 | [diff] [blame] | 195 | ./datagen -g1M | $MD5SUM > tmp1 |
| 196 | ./datagen -g1M | $ZSTD -D tmpDict | $ZSTD -D tmpDict -dvq | $MD5SUM > tmp2 |
Yann Collet | f6f3d75 | 2015-12-13 13:35:21 +0100 | [diff] [blame] | 197 | diff -q tmp1 tmp2 |
Yann Collet | 531a427 | 2016-06-15 19:02:11 +0200 | [diff] [blame] | 198 | $ECHO "- Create first dictionary" |
inikep | b7d3449 | 2016-08-18 15:13:41 +0200 | [diff] [blame] | 199 | $ZSTD --train *.c ../programs/*.c -o tmpDict |
| 200 | cp $TESTFILE tmp |
Yann Collet | 6381e99 | 2016-05-31 02:29:45 +0200 | [diff] [blame] | 201 | $ZSTD -f tmp -D tmpDict |
Yann Collet | 27b5ac6 | 2016-09-21 14:20:56 +0200 | [diff] [blame] | 202 | $ZSTD -d tmp.zst -D tmpDict -fo result |
inikep | b7d3449 | 2016-08-18 15:13:41 +0200 | [diff] [blame] | 203 | diff $TESTFILE result |
Yann Collet | 531a427 | 2016-06-15 19:02:11 +0200 | [diff] [blame] | 204 | $ECHO "- Create second (different) dictionary" |
inikep | b7d3449 | 2016-08-18 15:13:41 +0200 | [diff] [blame] | 205 | $ZSTD --train *.c ../programs/*.c ../programs/*.h -o tmpDictC |
Yann Collet | 27b5ac6 | 2016-09-21 14:20:56 +0200 | [diff] [blame] | 206 | $ZSTD -d tmp.zst -D tmpDictC -fo result && die "wrong dictionary not detected!" |
Yann Collet | 531a427 | 2016-06-15 19:02:11 +0200 | [diff] [blame] | 207 | $ECHO "- Create dictionary with short dictID" |
inikep | b7d3449 | 2016-08-18 15:13:41 +0200 | [diff] [blame] | 208 | $ZSTD --train *.c ../programs/*.c --dictID 1 -o tmpDict1 |
Yann Collet | 290aaa7 | 2016-05-30 21:18:52 +0200 | [diff] [blame] | 209 | cmp tmpDict tmpDict1 && die "dictionaries should have different ID !" |
Yann Collet | 27b5ac6 | 2016-09-21 14:20:56 +0200 | [diff] [blame] | 210 | $ECHO "- Create dictionary with wrong dictID parameter order (must fail)" |
| 211 | $ZSTD --train *.c ../programs/*.c --dictID -o 1 tmpDict1 && die "wrong order : --dictID must be followed by argument " |
| 212 | $ECHO "- Create dictionary with size limit" |
| 213 | $ZSTD --train *.c ../programs/*.c -o tmpDict2 --maxdict 4K -v |
| 214 | $ECHO "- Create dictionary with wrong parameter order (must fail)" |
| 215 | $ZSTD --train *.c ../programs/*.c -o tmpDict2 --maxdict -v 4K && die "wrong order : --maxdict must be followed by argument " |
Yann Collet | 531a427 | 2016-06-15 19:02:11 +0200 | [diff] [blame] | 216 | $ECHO "- Compress without dictID" |
Yann Collet | 6381e99 | 2016-05-31 02:29:45 +0200 | [diff] [blame] | 217 | $ZSTD -f tmp -D tmpDict1 --no-dictID |
Yann Collet | 27b5ac6 | 2016-09-21 14:20:56 +0200 | [diff] [blame] | 218 | $ZSTD -d tmp.zst -D tmpDict -fo result |
inikep | b7d3449 | 2016-08-18 15:13:41 +0200 | [diff] [blame] | 219 | diff $TESTFILE result |
Yann Collet | 27b5ac6 | 2016-09-21 14:20:56 +0200 | [diff] [blame] | 220 | $ECHO "- Compress with wrong argument order (must fail)" |
| 221 | $ZSTD tmp -Df tmpDict1 -c > /dev/null && die "-D must be followed by dictionary name " |
Yann Collet | 531a427 | 2016-06-15 19:02:11 +0200 | [diff] [blame] | 222 | $ECHO "- Compress multiple files with dictionary" |
Yann Collet | 531a427 | 2016-06-15 19:02:11 +0200 | [diff] [blame] | 223 | rm -rf dirTestDict |
| 224 | mkdir dirTestDict |
| 225 | cp *.c dirTestDict |
inikep | b7d3449 | 2016-08-18 15:13:41 +0200 | [diff] [blame] | 226 | cp ../programs/*.c dirTestDict |
| 227 | cp ../programs/*.h dirTestDict |
Yann Collet | 94376ac | 2016-08-25 19:09:21 +0200 | [diff] [blame] | 228 | $MD5SUM dirTestDict/* > tmph1 |
| 229 | $ZSTD -f --rm dirTestDict/* -D tmpDictC |
Yann Collet | bb93d77 | 2016-08-25 22:22:50 +0200 | [diff] [blame] | 230 | $ZSTD -d --rm dirTestDict/*.zst -D tmpDictC # note : use internal checksum by default |
Yann Collet | 94376ac | 2016-08-25 19:09:21 +0200 | [diff] [blame] | 231 | if [[ "$OSTYPE" == "darwin"* ]]; then |
Yann Collet | 3ecbe6a | 2016-09-14 17:26:59 +0200 | [diff] [blame] | 232 | $ECHO "md5sum -c not supported on OS-X : test skipped" # not compatible with OS-X's md5 |
Yann Collet | 94376ac | 2016-08-25 19:09:21 +0200 | [diff] [blame] | 233 | else |
| 234 | $MD5SUM -c tmph1 |
| 235 | fi |
Yann Collet | 531a427 | 2016-06-15 19:02:11 +0200 | [diff] [blame] | 236 | rm -rf dirTestDict |
Yann Collet | 6381e99 | 2016-05-31 02:29:45 +0200 | [diff] [blame] | 237 | rm tmp* |
Yann Collet | b44be74 | 2016-03-26 20:52:14 +0100 | [diff] [blame] | 238 | |
Yann Collet | f6f3d75 | 2015-12-13 13:35:21 +0100 | [diff] [blame] | 239 | |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 240 | $ECHO "\n**** integrity tests **** " |
Yann Collet | de95f96 | 2016-05-23 19:46:47 +0200 | [diff] [blame] | 241 | |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 242 | $ECHO "test one file (tmp1.zst) " |
Yann Collet | 1a7b8fb | 2016-06-15 23:33:38 +0200 | [diff] [blame] | 243 | ./datagen > tmp1 |
| 244 | $ZSTD tmp1 |
Yann Collet | 459a6b7 | 2016-02-15 20:37:23 +0100 | [diff] [blame] | 245 | $ZSTD -t tmp1.zst |
Yann Collet | 2d08b09 | 2016-02-16 14:42:08 +0100 | [diff] [blame] | 246 | $ZSTD --test tmp1.zst |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 247 | $ECHO "test multiple files (*.zst) " |
Yann Collet | 459a6b7 | 2016-02-15 20:37:23 +0100 | [diff] [blame] | 248 | $ZSTD -t *.zst |
Yann Collet | 24a3d90 | 2016-07-26 01:26:56 +0200 | [diff] [blame] | 249 | $ECHO "test bad files (*) " |
Yann Collet | 459a6b7 | 2016-02-15 20:37:23 +0100 | [diff] [blame] | 250 | $ZSTD -t * && die "bad files not detected !" |
Yann Collet | 24a3d90 | 2016-07-26 01:26:56 +0200 | [diff] [blame] | 251 | $ZSTD -t tmp1 && die "bad file not detected !" |
| 252 | cp tmp1 tmp2.zst |
| 253 | $ZSTD -t tmp2.zst && die "bad file not detected !" |
Yann Collet | 7adc232 | 2016-07-26 15:39:31 +0200 | [diff] [blame] | 254 | ./datagen -g0 > tmp3 |
| 255 | $ZSTD -t tmp3 && die "bad file not detected !" # detects 0-sized files as bad |
Yann Collet | b402490 | 2016-07-26 00:49:47 +0200 | [diff] [blame] | 256 | $ECHO "test --rm and --test combined " |
| 257 | $ZSTD -t --rm tmp1.zst |
| 258 | ls -ls tmp1.zst # check file is still present |
Yann Collet | deb078b | 2015-12-17 20:30:14 +0100 | [diff] [blame] | 259 | |
Yann Collet | de95f96 | 2016-05-23 19:46:47 +0200 | [diff] [blame] | 260 | |
Yann Collet | b9550d6 | 2016-10-28 14:43:24 -0700 | [diff] [blame] | 261 | $ECHO "\n**** benchmark mode tests **** " |
| 262 | |
| 263 | $ECHO "bench one file" |
| 264 | ./datagen > tmp1 |
| 265 | $ZSTD -bi1 tmp1 |
| 266 | $ECHO "bench multiple levels" |
| 267 | $ZSTD -i1b1e3 tmp1 |
| 268 | $ECHO "with recursive and quiet modes" |
| 269 | $ZSTD -rqi1b1e3 tmp1 |
| 270 | |
| 271 | |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 272 | $ECHO "\n**** zstd round-trip tests **** " |
Konstantin Tokarev | 76be378 | 2015-12-08 18:36:37 +0300 | [diff] [blame] | 273 | |
| 274 | roundTripTest |
Yann Collet | 3b71925 | 2016-03-30 19:48:05 +0200 | [diff] [blame] | 275 | roundTripTest -g15K # TableID==3 |
| 276 | roundTripTest -g127K # TableID==2 |
| 277 | roundTripTest -g255K # TableID==1 |
| 278 | roundTripTest -g513K # TableID==0 |
Yann Collet | 459a6b7 | 2016-02-15 20:37:23 +0100 | [diff] [blame] | 279 | roundTripTest -g512K 6 # greedy, hash chain |
Yann Collet | 0d348d4 | 2016-05-29 02:02:24 +0200 | [diff] [blame] | 280 | roundTripTest -g512K 16 # btlazy2 |
Yann Collet | 459a6b7 | 2016-02-15 20:37:23 +0100 | [diff] [blame] | 281 | roundTripTest -g512K 19 # btopt |
| 282 | |
| 283 | rm tmp* |
Konstantin Tokarev | 76be378 | 2015-12-08 18:36:37 +0300 | [diff] [blame] | 284 | |
Konstantin Tokarev | 0b570b5 | 2015-12-08 18:47:43 +0300 | [diff] [blame] | 285 | if [ "$1" != "--test-large-data" ]; then |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 286 | $ECHO "Skipping large data tests" |
Konstantin Tokarev | 0b570b5 | 2015-12-08 18:47:43 +0300 | [diff] [blame] | 287 | exit 0 |
| 288 | fi |
| 289 | |
Konstantin Tokarev | 76be378 | 2015-12-08 18:36:37 +0300 | [diff] [blame] | 290 | roundTripTest -g270000000 1 |
| 291 | roundTripTest -g270000000 2 |
| 292 | roundTripTest -g270000000 3 |
| 293 | |
| 294 | roundTripTest -g140000000 -P60 4 |
| 295 | roundTripTest -g140000000 -P60 5 |
| 296 | roundTripTest -g140000000 -P60 6 |
| 297 | |
| 298 | roundTripTest -g70000000 -P70 7 |
| 299 | roundTripTest -g70000000 -P70 8 |
| 300 | roundTripTest -g70000000 -P70 9 |
| 301 | |
| 302 | roundTripTest -g35000000 -P75 10 |
| 303 | roundTripTest -g35000000 -P75 11 |
| 304 | roundTripTest -g35000000 -P75 12 |
Konstantin Tokarev | d66db2f | 2015-12-08 18:11:10 +0300 | [diff] [blame] | 305 | |
Konstantin Tokarev | 2b46584 | 2015-12-08 19:36:42 +0300 | [diff] [blame] | 306 | roundTripTest -g18000000 -P80 13 |
| 307 | roundTripTest -g18000000 -P80 14 |
| 308 | roundTripTest -g18000000 -P80 15 |
| 309 | roundTripTest -g18000000 -P80 16 |
| 310 | roundTripTest -g18000000 -P80 17 |
| 311 | |
| 312 | roundTripTest -g50000000 -P94 18 |
| 313 | roundTripTest -g50000000 -P94 19 |
| 314 | |
| 315 | roundTripTest -g99000000 -P99 20 |
Yann Collet | ecabfe3 | 2016-03-20 16:20:06 +0100 | [diff] [blame] | 316 | roundTripTest -g6000000000 -P99 1 |
Yann Collet | 459a6b7 | 2016-02-15 20:37:23 +0100 | [diff] [blame] | 317 | |
| 318 | rm tmp* |