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 |
Yann Collet | 4616fad | 2017-07-10 17:16:41 -0700 | [diff] [blame] | 10 | cLevel="$3" |
| 11 | proba="$2" |
Konstantin Tokarev | 76be378 | 2015-12-08 18:36:37 +0300 | [diff] [blame] | 12 | else |
Yann Collet | 4616fad | 2017-07-10 17:16:41 -0700 | [diff] [blame] | 13 | cLevel="$2" |
| 14 | proba="" |
Konstantin Tokarev | 76be378 | 2015-12-08 18:36:37 +0300 | [diff] [blame] | 15 | fi |
Nick Terrell | c233bdb | 2017-09-22 14:04:39 -0700 | [diff] [blame] | 16 | if [ -n "$4" ]; then |
| 17 | dLevel="$4" |
| 18 | else |
| 19 | dLevel="$cLevel" |
| 20 | fi |
Konstantin Tokarev | 76be378 | 2015-12-08 18:36:37 +0300 | [diff] [blame] | 21 | |
| 22 | rm -f tmp1 tmp2 |
Nick Terrell | c233bdb | 2017-09-22 14:04:39 -0700 | [diff] [blame] | 23 | $ECHO "roundTripTest: ./datagen $1 $proba | $ZSTD -v$cLevel | $ZSTD -d$dLevel" |
Yann Collet | 4616fad | 2017-07-10 17:16:41 -0700 | [diff] [blame] | 24 | ./datagen $1 $proba | $MD5SUM > tmp1 |
Nick Terrell | c233bdb | 2017-09-22 14:04:39 -0700 | [diff] [blame] | 25 | ./datagen $1 $proba | $ZSTD --ultra -v$cLevel | $ZSTD -d$dLevel | $MD5SUM > tmp2 |
Przemyslaw Skibinski | 5f5a902 | 2016-12-22 18:05:07 +0100 | [diff] [blame] | 26 | $DIFF -q tmp1 tmp2 |
Konstantin Tokarev | 76be378 | 2015-12-08 18:36:37 +0300 | [diff] [blame] | 27 | } |
| 28 | |
Sean Purcell | eb70d21 | 2017-04-11 17:15:13 -0700 | [diff] [blame] | 29 | fileRoundTripTest() { |
| 30 | if [ -n "$3" ]; then |
| 31 | local_c="$3" |
| 32 | local_p="$2" |
| 33 | else |
| 34 | local_c="$2" |
| 35 | local_p="" |
| 36 | fi |
Nick Terrell | c233bdb | 2017-09-22 14:04:39 -0700 | [diff] [blame] | 37 | if [ -n "$4" ]; then |
| 38 | local_d="$4" |
| 39 | else |
| 40 | local_d="$local_c" |
| 41 | fi |
Sean Purcell | eb70d21 | 2017-04-11 17:15:13 -0700 | [diff] [blame] | 42 | |
| 43 | rm -f tmp.zstd tmp.md5.1 tmp.md5.2 |
Nick Terrell | c233bdb | 2017-09-22 14:04:39 -0700 | [diff] [blame] | 44 | $ECHO "fileRoundTripTest: ./datagen $1 $local_p > tmp && $ZSTD -v$local_c -c tmp | $ZSTD -d$local_d" |
Sean Purcell | eb70d21 | 2017-04-11 17:15:13 -0700 | [diff] [blame] | 45 | ./datagen $1 $local_p > tmp |
Yann Collet | 4252621 | 2017-10-05 20:21:59 -0700 | [diff] [blame] | 46 | < tmp $MD5SUM > tmp.md5.1 |
Nick Terrell | c233bdb | 2017-09-22 14:04:39 -0700 | [diff] [blame] | 47 | $ZSTD --ultra -v$local_c -c tmp | $ZSTD -d$local_d | $MD5SUM > tmp.md5.2 |
Sean Purcell | eb70d21 | 2017-04-11 17:15:13 -0700 | [diff] [blame] | 48 | $DIFF -q tmp.md5.1 tmp.md5.2 |
| 49 | } |
| 50 | |
Sean Purcell | 9a38dfa | 2017-03-17 12:32:18 -0700 | [diff] [blame] | 51 | isTerminal=false |
| 52 | if [ -t 0 ] && [ -t 1 ] |
| 53 | then |
| 54 | isTerminal=true |
| 55 | fi |
| 56 | |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 57 | isWindows=false |
Yann Collet | 391a128 | 2016-06-21 17:06:25 +0200 | [diff] [blame] | 58 | INTOVOID="/dev/null" |
Nick Terrell | 2dde9d5 | 2018-05-08 11:06:01 -0700 | [diff] [blame] | 59 | DEVDEVICE="/dev/random" |
inikep | 993a9df | 2016-05-27 10:07:46 +0200 | [diff] [blame] | 60 | case "$OS" in |
Yann Collet | 673f0d7 | 2016-06-06 00:26:38 +0200 | [diff] [blame] | 61 | Windows*) |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 62 | isWindows=true |
Sean Purcell | 9a38dfa | 2017-03-17 12:32:18 -0700 | [diff] [blame] | 63 | INTOVOID="NUL" |
Nick Terrell | 82bc8fe | 2017-12-13 12:04:46 -0800 | [diff] [blame] | 64 | DEVDEVICE="NUL" |
inikep | 993a9df | 2016-05-27 10:07:46 +0200 | [diff] [blame] | 65 | ;; |
| 66 | esac |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 67 | |
Dimitry Andric | 12df6da | 2016-12-12 19:22:47 +0100 | [diff] [blame] | 68 | UNAME=$(uname) |
| 69 | case "$UNAME" in |
| 70 | Darwin) MD5SUM="md5 -r" ;; |
| 71 | FreeBSD) MD5SUM="gmd5sum" ;; |
bket | daf3ab0 | 2018-04-02 23:12:18 +0200 | [diff] [blame] | 72 | OpenBSD) MD5SUM="md5" ;; |
Yann Collet | 94d1a93 | 2016-12-06 12:02:56 -0800 | [diff] [blame] | 73 | *) MD5SUM="md5sum" ;; |
| 74 | esac |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 75 | |
Przemyslaw Skibinski | 5f5a902 | 2016-12-22 18:05:07 +0100 | [diff] [blame] | 76 | DIFF="diff" |
| 77 | case "$UNAME" in |
| 78 | SunOS) DIFF="gdiff" ;; |
| 79 | esac |
| 80 | |
Yann Collet | 62568c9 | 2017-09-25 14:26:26 -0700 | [diff] [blame] | 81 | ECHO="echo -e" |
| 82 | case "$UNAME" in |
| 83 | Darwin) ECHO="echo" ;; |
| 84 | esac |
| 85 | |
Przemyslaw Skibinski | e579ab5 | 2016-11-14 12:57:05 +0100 | [diff] [blame] | 86 | $ECHO "\nStarting playTests.sh isWindows=$isWindows ZSTD='$ZSTD'" |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 87 | |
Konstantin Tokarev | 76be378 | 2015-12-08 18:36:37 +0300 | [diff] [blame] | 88 | [ -n "$ZSTD" ] || die "ZSTD variable must be defined!" |
| 89 | |
Sean Purcell | c424ec2 | 2017-04-17 11:38:53 -0700 | [diff] [blame] | 90 | if [ -n "$(echo hello | $ZSTD -v -T2 2>&1 > $INTOVOID | grep 'multi-threading is disabled')" ] |
| 91 | then |
| 92 | hasMT="" |
| 93 | else |
| 94 | hasMT="true" |
| 95 | fi |
| 96 | |
Yann Collet | a927fae | 2018-01-06 12:31:26 +0100 | [diff] [blame] | 97 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 98 | $ECHO "\n===> simple tests " |
Yann Collet | de95f96 | 2016-05-23 19:46:47 +0200 | [diff] [blame] | 99 | |
Yann Collet | 8154c3d | 2016-02-13 03:12:10 +0100 | [diff] [blame] | 100 | ./datagen > tmp |
Yann Collet | b3060f7 | 2016-09-09 16:44:16 +0200 | [diff] [blame] | 101 | $ECHO "test : basic compression " |
Yann Collet | 673f0d7 | 2016-06-06 00:26:38 +0200 | [diff] [blame] | 102 | $ZSTD -f tmp # trivial compression case, creates tmp.zst |
Yann Collet | b3060f7 | 2016-09-09 16:44:16 +0200 | [diff] [blame] | 103 | $ECHO "test : basic decompression" |
Yann Collet | 673f0d7 | 2016-06-06 00:26:38 +0200 | [diff] [blame] | 104 | $ZSTD -df tmp.zst # trivial decompression case (overwrites tmp) |
Yann Collet | 6a9b41b | 2018-03-11 19:56:48 -0700 | [diff] [blame] | 105 | $ECHO "test : too large compression level => auto-fix" |
Yann Collet | fab0230 | 2016-08-12 19:00:18 +0200 | [diff] [blame] | 106 | $ZSTD -99 -f tmp # too large compression level, automatic sized down |
Yann Collet | 6a9b41b | 2018-03-11 19:56:48 -0700 | [diff] [blame] | 107 | $ECHO "test : --fast aka negative compression levels" |
| 108 | $ZSTD --fast -f tmp # == -1 |
| 109 | $ZSTD --fast=3 -f tmp # == -3 |
Yann Collet | 93b8262 | 2018-03-21 15:54:44 -0700 | [diff] [blame] | 110 | $ZSTD --fast=200000 -f tmp # == no compression |
Yann Collet | 9cd5c63 | 2018-05-12 14:29:33 -0700 | [diff] [blame] | 111 | $ECHO "test : too large numeric argument" |
| 112 | $ZSTD --fast=9999999999 -f tmp && die "should have refused numeric value" |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 113 | $ECHO "test : compress to stdout" |
Yann Collet | 0d348d4 | 2016-05-29 02:02:24 +0200 | [diff] [blame] | 114 | $ZSTD tmp -c > tmpCompressed |
Yann Collet | d693117 | 2016-05-10 05:56:09 +0200 | [diff] [blame] | 115 | $ZSTD tmp --stdout > tmpCompressed # long command format |
Yann Collet | 27b5ac6 | 2016-09-21 14:20:56 +0200 | [diff] [blame] | 116 | $ECHO "test : compress to named file" |
| 117 | rm tmpCompressed |
| 118 | $ZSTD tmp -o tmpCompressed |
Yann Collet | 01a1abf | 2017-05-05 19:15:24 -0700 | [diff] [blame] | 119 | test -f tmpCompressed # file must be created |
Yann Collet | 27b5ac6 | 2016-09-21 14:20:56 +0200 | [diff] [blame] | 120 | $ECHO "test : -o must be followed by filename (must fail)" |
Yann Collet | 714464f | 2016-09-21 16:05:03 +0200 | [diff] [blame] | 121 | $ZSTD tmp -of tmpCompressed && die "-o must be followed by filename " |
Yann Collet | 27b5ac6 | 2016-09-21 14:20:56 +0200 | [diff] [blame] | 122 | $ECHO "test : force write, correct order" |
| 123 | $ZSTD tmp -fo tmpCompressed |
Yann Collet | 714464f | 2016-09-21 16:05:03 +0200 | [diff] [blame] | 124 | $ECHO "test : forgotten argument" |
| 125 | cp tmp tmp2 |
| 126 | $ZSTD tmp2 -fo && die "-o must be followed by filename " |
Yann Collet | c843142 | 2016-09-01 15:05:57 -0700 | [diff] [blame] | 127 | $ECHO "test : implied stdout when input is stdin" |
| 128 | $ECHO bob | $ZSTD | $ZSTD -d |
Sean Purcell | 9a38dfa | 2017-03-17 12:32:18 -0700 | [diff] [blame] | 129 | if [ "$isTerminal" = true ]; then |
Sean Purcell | d973071 | 2017-03-16 16:25:19 -0700 | [diff] [blame] | 130 | $ECHO "test : compressed data to terminal" |
| 131 | $ECHO bob | $ZSTD && die "should have refused : compressed data to terminal" |
| 132 | $ECHO "test : compressed data from terminal (a hang here is a test fail, zstd is wrongly waiting on data from terminal)" |
| 133 | $ZSTD -d > $INTOVOID && die "should have refused : compressed data from terminal" |
Sean Purcell | 9a38dfa | 2017-03-17 12:32:18 -0700 | [diff] [blame] | 134 | fi |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 135 | $ECHO "test : null-length file roundtrip" |
| 136 | $ECHO -n '' | $ZSTD - --stdout | $ZSTD -d --stdout |
Yann Collet | 281f06e | 2017-12-14 11:47:02 -0800 | [diff] [blame] | 137 | $ECHO "test : ensure small file doesn't add 3-bytes null block" |
Yann Collet | a0e0985 | 2017-12-14 13:32:24 -0800 | [diff] [blame] | 138 | ./datagen -g1 > tmp1 |
| 139 | $ZSTD tmp1 -c | wc -c | grep "14" |
| 140 | $ZSTD < tmp1 | wc -c | grep "14" |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 141 | $ECHO "test : decompress file with wrong suffix (must fail)" |
Yann Collet | 2d08b09 | 2016-02-16 14:42:08 +0100 | [diff] [blame] | 142 | $ZSTD -d tmpCompressed && die "wrong suffix error not detected!" |
Yann Collet | 391a128 | 2016-06-21 17:06:25 +0200 | [diff] [blame] | 143 | $ZSTD -df tmp && die "should have refused : wrong extension" |
| 144 | $ECHO "test : decompress into stdout" |
Yann Collet | 0d348d4 | 2016-05-29 02:02:24 +0200 | [diff] [blame] | 145 | $ZSTD -d tmpCompressed -c > tmpResult # decompression using stdout |
Yann Collet | 2d08b09 | 2016-02-16 14:42:08 +0100 | [diff] [blame] | 146 | $ZSTD --decompress tmpCompressed -c > tmpResult |
| 147 | $ZSTD --decompress tmpCompressed --stdout > tmpResult |
Yann Collet | 391a128 | 2016-06-21 17:06:25 +0200 | [diff] [blame] | 148 | $ECHO "test : decompress from stdin into stdout" |
| 149 | $ZSTD -dc < tmp.zst > $INTOVOID # combine decompression, stdin & stdout |
| 150 | $ZSTD -dc - < tmp.zst > $INTOVOID |
| 151 | $ZSTD -d < tmp.zst > $INTOVOID # implicit stdout when stdin is used |
| 152 | $ZSTD -d - < tmp.zst > $INTOVOID |
Yann Collet | d4cda27 | 2016-10-14 13:13:13 -0700 | [diff] [blame] | 153 | $ECHO "test : impose memory limitation (must fail)" |
| 154 | $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] | 155 | $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] | 156 | $ZSTD -d -f tmp.zst --memory=2K -c > $INTOVOID && die "decompression needs more memory than allowed" # long command |
| 157 | $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] | 158 | $ECHO "test : overwrite protection" |
Yann Collet | 2d08b09 | 2016-02-16 14:42:08 +0100 | [diff] [blame] | 159 | $ZSTD -q tmp && die "overwrite check failed!" |
Yann Collet | 391a128 | 2016-06-21 17:06:25 +0200 | [diff] [blame] | 160 | $ECHO "test : force overwrite" |
Yann Collet | 2d08b09 | 2016-02-16 14:42:08 +0100 | [diff] [blame] | 161 | $ZSTD -q -f tmp |
| 162 | $ZSTD -q --force tmp |
Sean Purcell | 9da11c6 | 2017-04-06 12:58:49 -0700 | [diff] [blame] | 163 | $ECHO "test : overwrite readonly file" |
Sean Purcell | 1652172 | 2017-04-06 17:06:30 -0700 | [diff] [blame] | 164 | rm -f tmpro tmpro.zst |
Sean Purcell | 9da11c6 | 2017-04-06 12:58:49 -0700 | [diff] [blame] | 165 | $ECHO foo > tmpro.zst |
| 166 | $ECHO foo > tmpro |
| 167 | chmod 400 tmpro.zst |
Sean Purcell | 1652172 | 2017-04-06 17:06:30 -0700 | [diff] [blame] | 168 | $ZSTD -q tmpro && die "should have refused to overwrite read-only file" |
| 169 | $ZSTD -q -f tmpro |
| 170 | rm -f tmpro tmpro.zst |
Yann Collet | b09b12c | 2016-06-09 22:59:51 +0200 | [diff] [blame] | 171 | $ECHO "test : file removal" |
| 172 | $ZSTD -f --rm tmp |
Yann Collet | 01a1abf | 2017-05-05 19:15:24 -0700 | [diff] [blame] | 173 | test ! -f tmp # tmp should no longer be present |
Yann Collet | b09b12c | 2016-06-09 22:59:51 +0200 | [diff] [blame] | 174 | $ZSTD -f -d --rm tmp.zst |
Yann Collet | 01a1abf | 2017-05-05 19:15:24 -0700 | [diff] [blame] | 175 | test ! -f tmp.zst # tmp.zst should no longer be present |
Nick Terrell | 82bc8fe | 2017-12-13 12:04:46 -0800 | [diff] [blame] | 176 | $ECHO "test : should quietly not remove non-regular file" |
| 177 | $ECHO hello > tmp |
| 178 | $ZSTD tmp -f -o "$DEVDEVICE" 2>tmplog > "$INTOVOID" |
| 179 | grep -v "Refusing to remove non-regular file" tmplog |
| 180 | rm -f tmplog |
Nick Terrell | 263134c | 2018-05-03 13:03:08 -0700 | [diff] [blame] | 181 | $ZSTD tmp -f -o "$INTOVOID" 2>&1 | grep -v "Refusing to remove non-regular file" |
Yann Collet | 67d86a7 | 2017-02-27 16:09:20 -0800 | [diff] [blame] | 182 | $ECHO "test : --rm on stdin" |
| 183 | $ECHO a | $ZSTD --rm > $INTOVOID # --rm should remain silent |
Yann Collet | b09b12c | 2016-06-09 22:59:51 +0200 | [diff] [blame] | 184 | rm tmp |
| 185 | $ZSTD -f tmp && die "tmp not present : should have failed" |
Yann Collet | 01a1abf | 2017-05-05 19:15:24 -0700 | [diff] [blame] | 186 | test ! -f tmp.zst # tmp.zst should not be created |
Yann Collet | de95f96 | 2016-05-23 19:46:47 +0200 | [diff] [blame] | 187 | |
Nick Terrell | 4680e85 | 2017-12-12 18:32:50 -0800 | [diff] [blame] | 188 | $ECHO "test : compress multiple files" |
| 189 | $ECHO hello > tmp1 |
| 190 | $ECHO world > tmp2 |
| 191 | $ZSTD tmp1 tmp2 -o "$INTOVOID" |
| 192 | $ZSTD tmp1 tmp2 -c | $ZSTD -t |
| 193 | $ZSTD tmp1 tmp2 -o tmp.zst |
| 194 | test ! -f tmp1.zst |
| 195 | test ! -f tmp2.zst |
| 196 | $ZSTD tmp1 tmp2 |
| 197 | $ZSTD -t tmp1.zst tmp2.zst |
| 198 | $ZSTD -dc tmp1.zst tmp2.zst |
| 199 | $ZSTD tmp1.zst tmp2.zst -o "$INTOVOID" |
| 200 | $ZSTD -d tmp1.zst tmp2.zst -o tmp |
Nick Terrell | 8adebbd | 2018-01-03 14:02:44 -0800 | [diff] [blame] | 201 | touch tmpexists |
| 202 | $ZSTD tmp1 tmp2 -f -o tmpexists |
| 203 | $ZSTD tmp1 tmp2 -o tmpexists && die "should have refused to overwrite" |
| 204 | # Bug: PR #972 |
| 205 | if [ "$?" -eq 139 ]; then |
| 206 | die "should not have segfaulted" |
| 207 | fi |
Nick Terrell | 4680e85 | 2017-12-12 18:32:50 -0800 | [diff] [blame] | 208 | rm tmp* |
| 209 | |
| 210 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 211 | $ECHO "\n===> Advanced compression parameters " |
Przemyslaw Skibinski | 24a4236 | 2016-12-14 18:07:31 +0100 | [diff] [blame] | 212 | $ECHO "Hello world!" | $ZSTD --zstd=windowLog=21, - -o tmp.zst && die "wrong parameters not detected!" |
| 213 | $ECHO "Hello world!" | $ZSTD --zstd=windowLo=21 - -o tmp.zst && die "wrong parameters not detected!" |
Przemyslaw Skibinski | f9a5666 | 2016-12-14 18:43:06 +0100 | [diff] [blame] | 214 | $ECHO "Hello world!" | $ZSTD --zstd=windowLog=21,slog - -o tmp.zst && die "wrong parameters not detected!" |
Yann Collet | 01a1abf | 2017-05-05 19:15:24 -0700 | [diff] [blame] | 215 | test ! -f tmp.zst # tmp.zst should not be created |
Przemyslaw Skibinski | 9b4fa0d | 2016-12-14 16:50:00 +0100 | [diff] [blame] | 216 | roundTripTest -g512K |
Przemyslaw Skibinski | ab5ed6f | 2016-12-14 17:10:38 +0100 | [diff] [blame] | 217 | roundTripTest -g512K " --zstd=slen=3,tlen=48,strat=6" |
| 218 | roundTripTest -g512K " --zstd=strat=6,wlog=23,clog=23,hlog=22,slog=6" |
Przemyslaw Skibinski | 9b4fa0d | 2016-12-14 16:50:00 +0100 | [diff] [blame] | 219 | roundTripTest -g512K " --zstd=windowLog=23,chainLog=23,hashLog=22,searchLog=6,searchLength=3,targetLength=48,strategy=6" |
Nick Terrell | f15a17e | 2018-02-27 20:09:18 -0800 | [diff] [blame] | 220 | roundTripTest -g512K " --single-thread --long --zstd=ldmHashLog=20,ldmSearchLength=64,ldmBucketSizeLog=1,ldmHashEveryLog=7" |
| 221 | roundTripTest -g512K " --single-thread --long --zstd=ldmhlog=20,ldmslen=64,ldmblog=1,ldmhevery=7" |
Przemyslaw Skibinski | 9b4fa0d | 2016-12-14 16:50:00 +0100 | [diff] [blame] | 222 | roundTripTest -g512K 19 |
| 223 | |
| 224 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 225 | $ECHO "\n===> Pass-Through mode " |
Yann Collet | 743b33f | 2016-12-02 15:18:57 -0800 | [diff] [blame] | 226 | $ECHO "Hello world 1!" | $ZSTD -df |
| 227 | $ECHO "Hello world 2!" | $ZSTD -dcf |
| 228 | $ECHO "Hello world 3!" > tmp1 |
| 229 | $ZSTD -dcf tmp1 |
Yann Collet | de95f96 | 2016-05-23 19:46:47 +0200 | [diff] [blame] | 230 | |
Yann Collet | 8154c3d | 2016-02-13 03:12:10 +0100 | [diff] [blame] | 231 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 232 | $ECHO "\n===> frame concatenation " |
Konstantin Tokarev | d66db2f | 2015-12-08 18:11:10 +0300 | [diff] [blame] | 233 | |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 234 | $ECHO "hello " > hello.tmp |
| 235 | $ECHO "world!" > world.tmp |
Konstantin Tokarev | d66db2f | 2015-12-08 18:11:10 +0300 | [diff] [blame] | 236 | cat hello.tmp world.tmp > helloworld.tmp |
Yann Collet | c8da2c9 | 2016-02-12 02:56:27 +0100 | [diff] [blame] | 237 | $ZSTD -c hello.tmp > hello.zstd |
| 238 | $ZSTD -c world.tmp > world.zstd |
Konstantin Tokarev | d66db2f | 2015-12-08 18:11:10 +0300 | [diff] [blame] | 239 | cat hello.zstd world.zstd > helloworld.zstd |
Yann Collet | c8da2c9 | 2016-02-12 02:56:27 +0100 | [diff] [blame] | 240 | $ZSTD -dc helloworld.zstd > result.tmp |
Konstantin Tokarev | d66db2f | 2015-12-08 18:11:10 +0300 | [diff] [blame] | 241 | cat result.tmp |
Yann Collet | bd6bc22 | 2017-01-22 15:54:14 -0800 | [diff] [blame] | 242 | $DIFF helloworld.tmp result.tmp |
Yann Collet | 4c5bbf6 | 2016-07-28 20:30:25 +0200 | [diff] [blame] | 243 | $ECHO "frame concatenation without checksum" |
| 244 | $ZSTD -c hello.tmp > hello.zstd --no-check |
| 245 | $ZSTD -c world.tmp > world.zstd --no-check |
| 246 | cat hello.zstd world.zstd > helloworld.zstd |
| 247 | $ZSTD -dc helloworld.zstd > result.tmp |
Yann Collet | bd6bc22 | 2017-01-22 15:54:14 -0800 | [diff] [blame] | 248 | $DIFF helloworld.tmp result.tmp |
Yann Collet | cb5eba8 | 2018-01-19 11:26:35 -0800 | [diff] [blame] | 249 | $ECHO "testing zstdcat symlink" |
| 250 | ln -sf $ZSTD zstdcat |
| 251 | ./zstdcat helloworld.zstd > result.tmp |
| 252 | $DIFF helloworld.tmp result.tmp |
| 253 | rm zstdcat |
| 254 | rm result.tmp |
| 255 | $ECHO "testing zcat symlink" |
| 256 | ln -sf $ZSTD zcat |
| 257 | ./zcat helloworld.zstd > result.tmp |
| 258 | $DIFF helloworld.tmp result.tmp |
| 259 | rm zcat |
Konstantin Tokarev | 76be378 | 2015-12-08 18:36:37 +0300 | [diff] [blame] | 260 | rm ./*.tmp ./*.zstd |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 261 | $ECHO "frame concatenation tests completed" |
Konstantin Tokarev | d66db2f | 2015-12-08 18:11:10 +0300 | [diff] [blame] | 262 | |
Yann Collet | f062436 | 2016-02-12 15:56:46 +0100 | [diff] [blame] | 263 | |
bket | daf3ab0 | 2018-04-02 23:12:18 +0200 | [diff] [blame] | 264 | if [ "$isWindows" = false ] && [ "$UNAME" != 'SunOS' ] && [ "$UNAME" != "OpenBSD" ] ; then |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 265 | $ECHO "\n**** flush write error test **** " |
Konstantin Tokarev | d66db2f | 2015-12-08 18:11:10 +0300 | [diff] [blame] | 266 | |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 267 | $ECHO "$ECHO foo | $ZSTD > /dev/full" |
| 268 | $ECHO foo | $ZSTD > /dev/full && die "write error not detected!" |
| 269 | $ECHO "$ECHO foo | $ZSTD | $ZSTD -d > /dev/full" |
| 270 | $ECHO foo | $ZSTD | $ZSTD -d > /dev/full && die "write error not detected!" |
Sean Purcell | 680e4e0 | 2017-03-23 11:52:09 -0700 | [diff] [blame] | 271 | |
Yann Collet | 01a1abf | 2017-05-05 19:15:24 -0700 | [diff] [blame] | 272 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 273 | $ECHO "\n===> symbolic link test " |
Sean Purcell | 680e4e0 | 2017-03-23 11:52:09 -0700 | [diff] [blame] | 274 | |
| 275 | rm -f hello.tmp world.tmp hello.tmp.zst world.tmp.zst |
| 276 | $ECHO "hello world" > hello.tmp |
| 277 | ln -s hello.tmp world.tmp |
| 278 | $ZSTD world.tmp hello.tmp |
Yann Collet | 01a1abf | 2017-05-05 19:15:24 -0700 | [diff] [blame] | 279 | test -f hello.tmp.zst # regular file should have been compressed! |
| 280 | test ! -f world.tmp.zst # symbolic link should not have been compressed! |
Sean Purcell | 680e4e0 | 2017-03-23 11:52:09 -0700 | [diff] [blame] | 281 | $ZSTD world.tmp hello.tmp -f |
Yann Collet | 01a1abf | 2017-05-05 19:15:24 -0700 | [diff] [blame] | 282 | test -f world.tmp.zst # symbolic link should have been compressed with --force |
Sean Purcell | 680e4e0 | 2017-03-23 11:52:09 -0700 | [diff] [blame] | 283 | rm -f hello.tmp world.tmp hello.tmp.zst world.tmp.zst |
| 284 | |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 285 | fi |
Konstantin Tokarev | d66db2f | 2015-12-08 18:11:10 +0300 | [diff] [blame] | 286 | |
Yann Collet | 6a45835 | 2015-12-18 02:51:14 +0100 | [diff] [blame] | 287 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 288 | $ECHO "\n===> test sparse file support " |
Yann Collet | 32990b5 | 2016-05-23 17:48:57 +0200 | [diff] [blame] | 289 | |
| 290 | ./datagen -g5M -P100 > tmpSparse |
| 291 | $ZSTD tmpSparse -c | $ZSTD -dv -o tmpSparseRegen |
Przemyslaw Skibinski | 5f5a902 | 2016-12-22 18:05:07 +0100 | [diff] [blame] | 292 | $DIFF -s tmpSparse tmpSparseRegen |
Yann Collet | 32990b5 | 2016-05-23 17:48:57 +0200 | [diff] [blame] | 293 | $ZSTD tmpSparse -c | $ZSTD -dv --sparse -c > tmpOutSparse |
Przemyslaw Skibinski | 5f5a902 | 2016-12-22 18:05:07 +0100 | [diff] [blame] | 294 | $DIFF -s tmpSparse tmpOutSparse |
Yann Collet | 32990b5 | 2016-05-23 17:48:57 +0200 | [diff] [blame] | 295 | $ZSTD tmpSparse -c | $ZSTD -dv --no-sparse -c > tmpOutNoSparse |
Przemyslaw Skibinski | 5f5a902 | 2016-12-22 18:05:07 +0100 | [diff] [blame] | 296 | $DIFF -s tmpSparse tmpOutNoSparse |
Yann Collet | 01a1abf | 2017-05-05 19:15:24 -0700 | [diff] [blame] | 297 | ls -ls tmpSparse* # look at file size and block size on disk |
Yann Collet | 32990b5 | 2016-05-23 17:48:57 +0200 | [diff] [blame] | 298 | ./datagen -s1 -g1200007 -P100 | $ZSTD | $ZSTD -dv --sparse -c > tmpSparseOdd # Odd size file (to not finish on an exact nb of blocks) |
Przemyslaw Skibinski | 5f5a902 | 2016-12-22 18:05:07 +0100 | [diff] [blame] | 299 | ./datagen -s1 -g1200007 -P100 | $DIFF -s - tmpSparseOdd |
Yann Collet | 01a1abf | 2017-05-05 19:15:24 -0700 | [diff] [blame] | 300 | ls -ls tmpSparseOdd # look at file size and block size on disk |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 301 | $ECHO "\n Sparse Compatibility with Console :" |
| 302 | $ECHO "Hello World 1 !" | $ZSTD | $ZSTD -d -c |
| 303 | $ECHO "Hello World 2 !" | $ZSTD | $ZSTD -d | cat |
| 304 | $ECHO "\n Sparse Compatibility with Append :" |
Yann Collet | 32990b5 | 2016-05-23 17:48:57 +0200 | [diff] [blame] | 305 | ./datagen -P100 -g1M > tmpSparse1M |
| 306 | cat tmpSparse1M tmpSparse1M > tmpSparse2M |
| 307 | $ZSTD -v -f tmpSparse1M -o tmpSparseCompressed |
| 308 | $ZSTD -d -v -f tmpSparseCompressed -o tmpSparseRegenerated |
| 309 | $ZSTD -d -v -f tmpSparseCompressed -c >> tmpSparseRegenerated |
Yann Collet | 01a1abf | 2017-05-05 19:15:24 -0700 | [diff] [blame] | 310 | ls -ls tmpSparse* # look at file size and block size on disk |
Przemyslaw Skibinski | 5f5a902 | 2016-12-22 18:05:07 +0100 | [diff] [blame] | 311 | $DIFF tmpSparse2M tmpSparseRegenerated |
Yann Collet | 33341de | 2016-05-29 23:09:51 +0200 | [diff] [blame] | 312 | rm tmpSparse* |
Yann Collet | 32990b5 | 2016-05-23 17:48:57 +0200 | [diff] [blame] | 313 | |
| 314 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 315 | $ECHO "\n===> multiple files tests " |
Yann Collet | 9b998e4 | 2016-06-15 23:11:20 +0200 | [diff] [blame] | 316 | |
Yann Collet | 391a128 | 2016-06-21 17:06:25 +0200 | [diff] [blame] | 317 | ./datagen -s1 > tmp1 2> $INTOVOID |
| 318 | ./datagen -s2 -g100K > tmp2 2> $INTOVOID |
| 319 | ./datagen -s3 -g1M > tmp3 2> $INTOVOID |
Yann Collet | 9b998e4 | 2016-06-15 23:11:20 +0200 | [diff] [blame] | 320 | $ECHO "compress tmp* : " |
Yann Collet | 60ba31c | 2016-07-28 19:55:09 +0200 | [diff] [blame] | 321 | $ZSTD -f tmp* |
Yann Collet | 9b998e4 | 2016-06-15 23:11:20 +0200 | [diff] [blame] | 322 | ls -ls tmp* |
| 323 | rm tmp1 tmp2 tmp3 |
| 324 | $ECHO "decompress tmp* : " |
| 325 | $ZSTD -df *.zst |
| 326 | ls -ls tmp* |
| 327 | $ECHO "compress tmp* into stdout > tmpall : " |
| 328 | $ZSTD -c tmp1 tmp2 tmp3 > tmpall |
Yann Collet | 01a1abf | 2017-05-05 19:15:24 -0700 | [diff] [blame] | 329 | ls -ls tmp* # check size of tmpall (should be tmp1.zst + tmp2.zst + tmp3.zst) |
Yann Collet | 9b998e4 | 2016-06-15 23:11:20 +0200 | [diff] [blame] | 330 | $ECHO "decompress tmpall* into stdout > tmpdec : " |
| 331 | cp tmpall tmpall2 |
| 332 | $ZSTD -dc tmpall* > tmpdec |
Yann Collet | 01a1abf | 2017-05-05 19:15:24 -0700 | [diff] [blame] | 333 | ls -ls tmp* # check size of tmpdec (should be 2*(tmp1 + tmp2 + tmp3)) |
Yann Collet | 9b998e4 | 2016-06-15 23:11:20 +0200 | [diff] [blame] | 334 | $ECHO "compress multiple files including a missing one (notHere) : " |
| 335 | $ZSTD -f tmp1 notHere tmp2 && die "missing file not detected!" |
| 336 | |
| 337 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 338 | $ECHO "\n===> dictionary tests " |
Yann Collet | f6f3d75 | 2015-12-13 13:35:21 +0100 | [diff] [blame] | 339 | |
Yann Collet | bd7fa21 | 2017-02-26 14:43:07 -0800 | [diff] [blame] | 340 | $ECHO "- test with raw dict (content only) " |
Yann Collet | f6f3d75 | 2015-12-13 13:35:21 +0100 | [diff] [blame] | 341 | ./datagen > tmpDict |
inikep | 93fc13e | 2016-05-30 10:17:55 +0200 | [diff] [blame] | 342 | ./datagen -g1M | $MD5SUM > tmp1 |
| 343 | ./datagen -g1M | $ZSTD -D tmpDict | $ZSTD -D tmpDict -dvq | $MD5SUM > tmp2 |
Przemyslaw Skibinski | 5f5a902 | 2016-12-22 18:05:07 +0100 | [diff] [blame] | 344 | $DIFF -q tmp1 tmp2 |
Yann Collet | bd7fa21 | 2017-02-26 14:43:07 -0800 | [diff] [blame] | 345 | $ECHO "- Create first dictionary " |
| 346 | TESTFILE=../programs/zstdcli.c |
inikep | b7d3449 | 2016-08-18 15:13:41 +0200 | [diff] [blame] | 347 | $ZSTD --train *.c ../programs/*.c -o tmpDict |
| 348 | cp $TESTFILE tmp |
Yann Collet | d228b6b | 2017-12-29 19:14:18 +0100 | [diff] [blame] | 349 | $ECHO "- Dictionary compression roundtrip" |
Yann Collet | 6381e99 | 2016-05-31 02:29:45 +0200 | [diff] [blame] | 350 | $ZSTD -f tmp -D tmpDict |
Yann Collet | 27b5ac6 | 2016-09-21 14:20:56 +0200 | [diff] [blame] | 351 | $ZSTD -d tmp.zst -D tmpDict -fo result |
Przemyslaw Skibinski | 5f5a902 | 2016-12-22 18:05:07 +0100 | [diff] [blame] | 352 | $DIFF $TESTFILE result |
Yann Collet | d228b6b | 2017-12-29 19:14:18 +0100 | [diff] [blame] | 353 | $ECHO "- Dictionary compression with btlazy2 strategy" |
| 354 | $ZSTD -f tmp -D tmpDict --zstd=strategy=6 |
| 355 | $ZSTD -d tmp.zst -D tmpDict -fo result |
| 356 | $DIFF $TESTFILE result |
Yann Collet | 311878d | 2017-12-13 11:48:30 -0800 | [diff] [blame] | 357 | if [ -n "$hasMT" ] |
| 358 | then |
| 359 | $ECHO "- Test dictionary compression with multithreading " |
Yann Collet | 281f06e | 2017-12-14 11:47:02 -0800 | [diff] [blame] | 360 | ./datagen -g5M | $ZSTD -T2 -D tmpDict | $ZSTD -t -D tmpDict # fails with v1.3.2 |
Yann Collet | 311878d | 2017-12-13 11:48:30 -0800 | [diff] [blame] | 361 | fi |
Yann Collet | bd7fa21 | 2017-02-26 14:43:07 -0800 | [diff] [blame] | 362 | $ECHO "- Create second (different) dictionary " |
inikep | b7d3449 | 2016-08-18 15:13:41 +0200 | [diff] [blame] | 363 | $ZSTD --train *.c ../programs/*.c ../programs/*.h -o tmpDictC |
Yann Collet | 27b5ac6 | 2016-09-21 14:20:56 +0200 | [diff] [blame] | 364 | $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] | 365 | $ECHO "- Create dictionary with short dictID" |
Yann Collet | 4c41d37 | 2017-03-24 18:36:56 -0700 | [diff] [blame] | 366 | $ZSTD --train *.c ../programs/*.c --dictID=1 -o tmpDict1 |
Yann Collet | 290aaa7 | 2016-05-30 21:18:52 +0200 | [diff] [blame] | 367 | cmp tmpDict tmpDict1 && die "dictionaries should have different ID !" |
Yann Collet | 27b5ac6 | 2016-09-21 14:20:56 +0200 | [diff] [blame] | 368 | $ECHO "- Create dictionary with wrong dictID parameter order (must fail)" |
| 369 | $ZSTD --train *.c ../programs/*.c --dictID -o 1 tmpDict1 && die "wrong order : --dictID must be followed by argument " |
| 370 | $ECHO "- Create dictionary with size limit" |
Yann Collet | 4c41d37 | 2017-03-24 18:36:56 -0700 | [diff] [blame] | 371 | $ZSTD --train *.c ../programs/*.c -o tmpDict2 --maxdict=4K -v |
Nick Terrell | 3587556 | 2017-08-21 11:16:47 -0700 | [diff] [blame] | 372 | $ECHO "- Create dictionary with small size limit" |
| 373 | $ZSTD --train *.c ../programs/*.c -o tmpDict3 --maxdict=1K -v |
Yann Collet | 27b5ac6 | 2016-09-21 14:20:56 +0200 | [diff] [blame] | 374 | $ECHO "- Create dictionary with wrong parameter order (must fail)" |
Nick Terrell | 3587556 | 2017-08-21 11:16:47 -0700 | [diff] [blame] | 375 | $ZSTD --train *.c ../programs/*.c -o tmpDict3 --maxdict -v 4K && die "wrong order : --maxdict must be followed by argument " |
Yann Collet | 531a427 | 2016-06-15 19:02:11 +0200 | [diff] [blame] | 376 | $ECHO "- Compress without dictID" |
Yann Collet | 6381e99 | 2016-05-31 02:29:45 +0200 | [diff] [blame] | 377 | $ZSTD -f tmp -D tmpDict1 --no-dictID |
Yann Collet | 27b5ac6 | 2016-09-21 14:20:56 +0200 | [diff] [blame] | 378 | $ZSTD -d tmp.zst -D tmpDict -fo result |
Przemyslaw Skibinski | 5f5a902 | 2016-12-22 18:05:07 +0100 | [diff] [blame] | 379 | $DIFF $TESTFILE result |
Yann Collet | 27b5ac6 | 2016-09-21 14:20:56 +0200 | [diff] [blame] | 380 | $ECHO "- Compress with wrong argument order (must fail)" |
Sean Purcell | 9a38dfa | 2017-03-17 12:32:18 -0700 | [diff] [blame] | 381 | $ZSTD tmp -Df tmpDict1 -c > $INTOVOID && die "-D must be followed by dictionary name " |
Yann Collet | 531a427 | 2016-06-15 19:02:11 +0200 | [diff] [blame] | 382 | $ECHO "- Compress multiple files with dictionary" |
Yann Collet | 531a427 | 2016-06-15 19:02:11 +0200 | [diff] [blame] | 383 | rm -rf dirTestDict |
| 384 | mkdir dirTestDict |
| 385 | cp *.c dirTestDict |
inikep | b7d3449 | 2016-08-18 15:13:41 +0200 | [diff] [blame] | 386 | cp ../programs/*.c dirTestDict |
| 387 | cp ../programs/*.h dirTestDict |
Yann Collet | 94376ac | 2016-08-25 19:09:21 +0200 | [diff] [blame] | 388 | $MD5SUM dirTestDict/* > tmph1 |
| 389 | $ZSTD -f --rm dirTestDict/* -D tmpDictC |
Yann Collet | bb93d77 | 2016-08-25 22:22:50 +0200 | [diff] [blame] | 390 | $ZSTD -d --rm dirTestDict/*.zst -D tmpDictC # note : use internal checksum by default |
Dimitry Andric | 12df6da | 2016-12-12 19:22:47 +0100 | [diff] [blame] | 391 | case "$UNAME" in |
| 392 | Darwin) $ECHO "md5sum -c not supported on OS-X : test skipped" ;; # not compatible with OS-X's md5 |
Yann Collet | 94d1a93 | 2016-12-06 12:02:56 -0800 | [diff] [blame] | 393 | *) $MD5SUM -c tmph1 ;; |
| 394 | esac |
Yann Collet | 531a427 | 2016-06-15 19:02:11 +0200 | [diff] [blame] | 395 | rm -rf dirTestDict |
Yann Collet | f332ece | 2017-03-23 16:24:02 -0700 | [diff] [blame] | 396 | $ECHO "- dictionary builder on bogus input" |
| 397 | $ECHO "Hello World" > tmp |
Nick Terrell | f376d47 | 2017-05-01 23:40:20 -0700 | [diff] [blame] | 398 | $ZSTD --train-legacy -q tmp && die "Dictionary training should fail : not enough input source" |
Yann Collet | f332ece | 2017-03-23 16:24:02 -0700 | [diff] [blame] | 399 | ./datagen -P0 -g10M > tmp |
Nick Terrell | f376d47 | 2017-05-01 23:40:20 -0700 | [diff] [blame] | 400 | $ZSTD --train-legacy -q tmp && die "Dictionary training should fail : source is pure noise" |
Yann Collet | 6381e99 | 2016-05-31 02:29:45 +0200 | [diff] [blame] | 401 | rm tmp* |
Yann Collet | b44be74 | 2016-03-26 20:52:14 +0100 | [diff] [blame] | 402 | |
Yann Collet | f6f3d75 | 2015-12-13 13:35:21 +0100 | [diff] [blame] | 403 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 404 | $ECHO "\n===> cover dictionary builder : advanced options " |
Nick Terrell | cbb3ce3 | 2017-01-01 01:59:51 -0500 | [diff] [blame] | 405 | |
| 406 | TESTFILE=../programs/zstdcli.c |
| 407 | ./datagen > tmpDict |
| 408 | $ECHO "- Create first dictionary" |
Nick Terrell | f376d47 | 2017-05-01 23:40:20 -0700 | [diff] [blame] | 409 | $ZSTD --train-cover=k=46,d=8 *.c ../programs/*.c -o tmpDict |
Nick Terrell | cbb3ce3 | 2017-01-01 01:59:51 -0500 | [diff] [blame] | 410 | cp $TESTFILE tmp |
| 411 | $ZSTD -f tmp -D tmpDict |
| 412 | $ZSTD -d tmp.zst -D tmpDict -fo result |
| 413 | $DIFF $TESTFILE result |
| 414 | $ECHO "- Create second (different) dictionary" |
Nick Terrell | f376d47 | 2017-05-01 23:40:20 -0700 | [diff] [blame] | 415 | $ZSTD --train-cover=k=56,d=8 *.c ../programs/*.c ../programs/*.h -o tmpDictC |
Nick Terrell | cbb3ce3 | 2017-01-01 01:59:51 -0500 | [diff] [blame] | 416 | $ZSTD -d tmp.zst -D tmpDictC -fo result && die "wrong dictionary not detected!" |
| 417 | $ECHO "- Create dictionary with short dictID" |
Nick Terrell | f376d47 | 2017-05-01 23:40:20 -0700 | [diff] [blame] | 418 | $ZSTD --train-cover=k=46,d=8 *.c ../programs/*.c --dictID=1 -o tmpDict1 |
Nick Terrell | cbb3ce3 | 2017-01-01 01:59:51 -0500 | [diff] [blame] | 419 | cmp tmpDict tmpDict1 && die "dictionaries should have different ID !" |
| 420 | $ECHO "- Create dictionary with size limit" |
Nick Terrell | f376d47 | 2017-05-01 23:40:20 -0700 | [diff] [blame] | 421 | $ZSTD --train-cover=steps=8 *.c ../programs/*.c -o tmpDict2 --maxdict=4K |
| 422 | rm tmp* |
| 423 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 424 | $ECHO "\n===> legacy dictionary builder " |
Nick Terrell | f376d47 | 2017-05-01 23:40:20 -0700 | [diff] [blame] | 425 | |
| 426 | TESTFILE=../programs/zstdcli.c |
| 427 | ./datagen > tmpDict |
| 428 | $ECHO "- Create first dictionary" |
| 429 | $ZSTD --train-legacy=selectivity=8 *.c ../programs/*.c -o tmpDict |
| 430 | cp $TESTFILE tmp |
| 431 | $ZSTD -f tmp -D tmpDict |
| 432 | $ZSTD -d tmp.zst -D tmpDict -fo result |
| 433 | $DIFF $TESTFILE result |
| 434 | $ECHO "- Create second (different) dictionary" |
| 435 | $ZSTD --train-legacy=s=5 *.c ../programs/*.c ../programs/*.h -o tmpDictC |
| 436 | $ZSTD -d tmp.zst -D tmpDictC -fo result && die "wrong dictionary not detected!" |
| 437 | $ECHO "- Create dictionary with short dictID" |
| 438 | $ZSTD --train-legacy -s5 *.c ../programs/*.c --dictID=1 -o tmpDict1 |
| 439 | cmp tmpDict tmpDict1 && die "dictionaries should have different ID !" |
| 440 | $ECHO "- Create dictionary with size limit" |
| 441 | $ZSTD --train-legacy -s9 *.c ../programs/*.c -o tmpDict2 --maxdict=4K |
Nick Terrell | cbb3ce3 | 2017-01-01 01:59:51 -0500 | [diff] [blame] | 442 | rm tmp* |
| 443 | |
| 444 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 445 | $ECHO "\n===> integrity tests " |
Yann Collet | de95f96 | 2016-05-23 19:46:47 +0200 | [diff] [blame] | 446 | |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 447 | $ECHO "test one file (tmp1.zst) " |
Yann Collet | 1a7b8fb | 2016-06-15 23:33:38 +0200 | [diff] [blame] | 448 | ./datagen > tmp1 |
| 449 | $ZSTD tmp1 |
Yann Collet | 459a6b7 | 2016-02-15 20:37:23 +0100 | [diff] [blame] | 450 | $ZSTD -t tmp1.zst |
Yann Collet | 2d08b09 | 2016-02-16 14:42:08 +0100 | [diff] [blame] | 451 | $ZSTD --test tmp1.zst |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 452 | $ECHO "test multiple files (*.zst) " |
Yann Collet | 459a6b7 | 2016-02-15 20:37:23 +0100 | [diff] [blame] | 453 | $ZSTD -t *.zst |
Yann Collet | 24a3d90 | 2016-07-26 01:26:56 +0200 | [diff] [blame] | 454 | $ECHO "test bad files (*) " |
Yann Collet | 459a6b7 | 2016-02-15 20:37:23 +0100 | [diff] [blame] | 455 | $ZSTD -t * && die "bad files not detected !" |
Yann Collet | 24a3d90 | 2016-07-26 01:26:56 +0200 | [diff] [blame] | 456 | $ZSTD -t tmp1 && die "bad file not detected !" |
| 457 | cp tmp1 tmp2.zst |
| 458 | $ZSTD -t tmp2.zst && die "bad file not detected !" |
Yann Collet | 7adc232 | 2016-07-26 15:39:31 +0200 | [diff] [blame] | 459 | ./datagen -g0 > tmp3 |
| 460 | $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] | 461 | $ECHO "test --rm and --test combined " |
| 462 | $ZSTD -t --rm tmp1.zst |
Yann Collet | 01a1abf | 2017-05-05 19:15:24 -0700 | [diff] [blame] | 463 | test -f tmp1.zst # check file is still present |
| 464 | split -b16384 tmp1.zst tmpSplit. |
| 465 | $ZSTD -t tmpSplit.* && die "bad file not detected !" |
Nick Terrell | d0b2748 | 2017-07-18 14:45:49 -0700 | [diff] [blame] | 466 | ./datagen | $ZSTD -c | $ZSTD -t |
Yann Collet | deb078b | 2015-12-17 20:30:14 +0100 | [diff] [blame] | 467 | |
Yann Collet | de95f96 | 2016-05-23 19:46:47 +0200 | [diff] [blame] | 468 | |
Nick Terrell | abe12b3 | 2017-07-28 11:54:28 -0700 | [diff] [blame] | 469 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 470 | $ECHO "\n===> golden files tests " |
Nick Terrell | abe12b3 | 2017-07-28 11:54:28 -0700 | [diff] [blame] | 471 | |
| 472 | $ZSTD -t -r files |
| 473 | $ZSTD -c -r files | $ZSTD -t |
| 474 | |
| 475 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 476 | $ECHO "\n===> benchmark mode tests " |
Yann Collet | b9550d6 | 2016-10-28 14:43:24 -0700 | [diff] [blame] | 477 | |
| 478 | $ECHO "bench one file" |
| 479 | ./datagen > tmp1 |
Yann Collet | c1c040e | 2017-03-01 16:49:20 -0800 | [diff] [blame] | 480 | $ZSTD -bi0 tmp1 |
Yann Collet | b9550d6 | 2016-10-28 14:43:24 -0700 | [diff] [blame] | 481 | $ECHO "bench multiple levels" |
Yann Collet | c1c040e | 2017-03-01 16:49:20 -0800 | [diff] [blame] | 482 | $ZSTD -i0b0e3 tmp1 |
Yann Collet | 6a9b41b | 2018-03-11 19:56:48 -0700 | [diff] [blame] | 483 | $ECHO "bench negative level" |
| 484 | $ZSTD -bi0 --fast tmp1 |
Yann Collet | b9550d6 | 2016-10-28 14:43:24 -0700 | [diff] [blame] | 485 | $ECHO "with recursive and quiet modes" |
Yann Collet | c1c040e | 2017-03-01 16:49:20 -0800 | [diff] [blame] | 486 | $ZSTD -rqi1b1e2 tmp1 |
| 487 | |
| 488 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 489 | $ECHO "\n===> gzip compatibility tests " |
Yann Collet | c1c040e | 2017-03-01 16:49:20 -0800 | [diff] [blame] | 490 | |
| 491 | GZIPMODE=1 |
| 492 | $ZSTD --format=gzip -V || GZIPMODE=0 |
| 493 | if [ $GZIPMODE -eq 1 ]; then |
Yann Collet | 27526c7 | 2017-03-01 17:02:49 -0800 | [diff] [blame] | 494 | $ECHO "gzip support detected" |
Yann Collet | c1c040e | 2017-03-01 16:49:20 -0800 | [diff] [blame] | 495 | GZIPEXE=1 |
Yann Collet | 27526c7 | 2017-03-01 17:02:49 -0800 | [diff] [blame] | 496 | gzip -V || GZIPEXE=0 |
Yann Collet | c1c040e | 2017-03-01 16:49:20 -0800 | [diff] [blame] | 497 | if [ $GZIPEXE -eq 1 ]; then |
| 498 | ./datagen > tmp |
| 499 | $ZSTD --format=gzip -f tmp |
| 500 | gzip -t -v tmp.gz |
| 501 | gzip -f tmp |
| 502 | $ZSTD -d -f -v tmp.gz |
Nick Terrell | aa8bcf3 | 2017-03-13 18:11:07 -0700 | [diff] [blame] | 503 | rm tmp* |
Yann Collet | c1c040e | 2017-03-01 16:49:20 -0800 | [diff] [blame] | 504 | else |
| 505 | $ECHO "gzip binary not detected" |
| 506 | fi |
| 507 | else |
| 508 | $ECHO "gzip mode not supported" |
| 509 | fi |
Yann Collet | b9550d6 | 2016-10-28 14:43:24 -0700 | [diff] [blame] | 510 | |
| 511 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 512 | $ECHO "\n===> gzip frame tests " |
Nick Terrell | aa8bcf3 | 2017-03-13 18:11:07 -0700 | [diff] [blame] | 513 | |
| 514 | if [ $GZIPMODE -eq 1 ]; then |
| 515 | ./datagen > tmp |
| 516 | $ZSTD -f --format=gzip tmp |
| 517 | $ZSTD -f tmp |
| 518 | cat tmp.gz tmp.zst tmp.gz tmp.zst | $ZSTD -d -f -o tmp |
Sean Purcell | 4de8632 | 2017-04-24 16:48:25 -0700 | [diff] [blame] | 519 | head -c -1 tmp.gz | $ZSTD -t > $INTOVOID && die "incomplete frame not detected !" |
Nick Terrell | aa8bcf3 | 2017-03-13 18:11:07 -0700 | [diff] [blame] | 520 | rm tmp* |
| 521 | else |
| 522 | $ECHO "gzip mode not supported" |
| 523 | fi |
| 524 | |
| 525 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 526 | $ECHO "\n===> xz compatibility tests " |
Nick Terrell | aa8bcf3 | 2017-03-13 18:11:07 -0700 | [diff] [blame] | 527 | |
| 528 | LZMAMODE=1 |
| 529 | $ZSTD --format=xz -V || LZMAMODE=0 |
| 530 | if [ $LZMAMODE -eq 1 ]; then |
| 531 | $ECHO "xz support detected" |
| 532 | XZEXE=1 |
| 533 | xz -V && lzma -V || XZEXE=0 |
| 534 | if [ $XZEXE -eq 1 ]; then |
Nick Terrell | 6aeb50e | 2017-06-26 11:24:36 -0700 | [diff] [blame] | 535 | $ECHO "Testing zstd xz and lzma support" |
Nick Terrell | aa8bcf3 | 2017-03-13 18:11:07 -0700 | [diff] [blame] | 536 | ./datagen > tmp |
| 537 | $ZSTD --format=lzma -f tmp |
| 538 | $ZSTD --format=xz -f tmp |
| 539 | xz -t -v tmp.xz |
| 540 | xz -t -v tmp.lzma |
| 541 | xz -f -k tmp |
| 542 | lzma -f -k --lzma1 tmp |
| 543 | $ZSTD -d -f -v tmp.xz |
| 544 | $ZSTD -d -f -v tmp.lzma |
| 545 | rm tmp* |
Nick Terrell | 6aeb50e | 2017-06-26 11:24:36 -0700 | [diff] [blame] | 546 | $ECHO "Creating symlinks" |
| 547 | ln -s $ZSTD ./xz |
| 548 | ln -s $ZSTD ./unxz |
| 549 | ln -s $ZSTD ./lzma |
| 550 | ln -s $ZSTD ./unlzma |
| 551 | $ECHO "Testing xz and lzma symlinks" |
| 552 | ./datagen > tmp |
| 553 | ./xz tmp |
| 554 | xz -d tmp.xz |
| 555 | ./lzma tmp |
| 556 | lzma -d tmp.lzma |
| 557 | $ECHO "Testing unxz and unlzma symlinks" |
| 558 | xz tmp |
| 559 | ./xz -d tmp.xz |
| 560 | lzma tmp |
| 561 | ./lzma -d tmp.lzma |
| 562 | rm xz unxz lzma unlzma |
| 563 | rm tmp* |
Nick Terrell | aa8bcf3 | 2017-03-13 18:11:07 -0700 | [diff] [blame] | 564 | else |
| 565 | $ECHO "xz binary not detected" |
| 566 | fi |
| 567 | else |
| 568 | $ECHO "xz mode not supported" |
| 569 | fi |
| 570 | |
| 571 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 572 | $ECHO "\n===> xz frame tests " |
Nick Terrell | aa8bcf3 | 2017-03-13 18:11:07 -0700 | [diff] [blame] | 573 | |
| 574 | if [ $LZMAMODE -eq 1 ]; then |
| 575 | ./datagen > tmp |
| 576 | $ZSTD -f --format=xz tmp |
| 577 | $ZSTD -f --format=lzma tmp |
| 578 | $ZSTD -f tmp |
| 579 | cat tmp.xz tmp.lzma tmp.zst tmp.lzma tmp.xz tmp.zst | $ZSTD -d -f -o tmp |
Sean Purcell | 4de8632 | 2017-04-24 16:48:25 -0700 | [diff] [blame] | 580 | head -c -1 tmp.xz | $ZSTD -t > $INTOVOID && die "incomplete frame not detected !" |
| 581 | head -c -1 tmp.lzma | $ZSTD -t > $INTOVOID && die "incomplete frame not detected !" |
Nick Terrell | aa8bcf3 | 2017-03-13 18:11:07 -0700 | [diff] [blame] | 582 | rm tmp* |
| 583 | else |
| 584 | $ECHO "xz mode not supported" |
| 585 | fi |
| 586 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 587 | $ECHO "\n===> lz4 compatibility tests " |
Sean Purcell | 4de8632 | 2017-04-24 16:48:25 -0700 | [diff] [blame] | 588 | |
| 589 | LZ4MODE=1 |
| 590 | $ZSTD --format=lz4 -V || LZ4MODE=0 |
| 591 | if [ $LZ4MODE -eq 1 ]; then |
| 592 | $ECHO "lz4 support detected" |
| 593 | LZ4EXE=1 |
| 594 | lz4 -V || LZ4EXE=0 |
| 595 | if [ $LZ4EXE -eq 1 ]; then |
| 596 | ./datagen > tmp |
| 597 | $ZSTD --format=lz4 -f tmp |
| 598 | lz4 -t -v tmp.lz4 |
| 599 | lz4 -f tmp |
| 600 | $ZSTD -d -f -v tmp.lz4 |
| 601 | rm tmp* |
| 602 | else |
| 603 | $ECHO "lz4 binary not detected" |
| 604 | fi |
| 605 | else |
| 606 | $ECHO "lz4 mode not supported" |
| 607 | fi |
| 608 | |
| 609 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 610 | $ECHO "\n===> lz4 frame tests " |
Sean Purcell | 4de8632 | 2017-04-24 16:48:25 -0700 | [diff] [blame] | 611 | |
| 612 | if [ $LZ4MODE -eq 1 ]; then |
| 613 | ./datagen > tmp |
| 614 | $ZSTD -f --format=lz4 tmp |
| 615 | $ZSTD -f tmp |
| 616 | cat tmp.lz4 tmp.zst tmp.lz4 tmp.zst | $ZSTD -d -f -o tmp |
| 617 | head -c -1 tmp.lz4 | $ZSTD -t > $INTOVOID && die "incomplete frame not detected !" |
| 618 | rm tmp* |
| 619 | else |
| 620 | $ECHO "lz4 mode not supported" |
| 621 | fi |
Nick Terrell | aa8bcf3 | 2017-03-13 18:11:07 -0700 | [diff] [blame] | 622 | |
George Lu | 53ea32c | 2018-06-01 10:43:06 -0700 | [diff] [blame] | 623 | $ECHO "\n===> suffix list test" |
| 624 | |
George Lu | 110ec90 | 2018-06-01 12:45:02 -0700 | [diff] [blame^] | 625 | ! $ZSTD -d tmp.abc 2> tmplg |
George Lu | 53ea32c | 2018-06-01 10:43:06 -0700 | [diff] [blame] | 626 | |
| 627 | if [ $GZIPMODE -ne 1 ]; then |
| 628 | grep ".gz" tmplg > $INTOVOID && die "Unsupported suffix listed" |
| 629 | fi |
| 630 | |
| 631 | if [ $LZMAMODE -ne 1 ]; then |
| 632 | grep ".lzma" tmplg > $INTOVOID && die "Unsupported suffix listed" |
| 633 | grep ".xz" tmplg > $INTOVOID && die "Unsupported suffix listed" |
| 634 | fi |
| 635 | |
| 636 | if [ $LZ4MODE -ne 1 ]; then |
| 637 | grep ".lz4" tmplg > $INTOVOID && die "Unsupported suffix listed" |
| 638 | fi |
| 639 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 640 | $ECHO "\n===> zstd round-trip tests " |
Konstantin Tokarev | 76be378 | 2015-12-08 18:36:37 +0300 | [diff] [blame] | 641 | |
| 642 | roundTripTest |
Yann Collet | 3b71925 | 2016-03-30 19:48:05 +0200 | [diff] [blame] | 643 | roundTripTest -g15K # TableID==3 |
| 644 | roundTripTest -g127K # TableID==2 |
| 645 | roundTripTest -g255K # TableID==1 |
Yann Collet | c1c040e | 2017-03-01 16:49:20 -0800 | [diff] [blame] | 646 | roundTripTest -g522K # TableID==0 |
| 647 | roundTripTest -g519K 6 # greedy, hash chain |
| 648 | roundTripTest -g517K 16 # btlazy2 |
| 649 | roundTripTest -g516K 19 # btopt |
Yann Collet | 459a6b7 | 2016-02-15 20:37:23 +0100 | [diff] [blame] | 650 | |
Sean Purcell | eb70d21 | 2017-04-11 17:15:13 -0700 | [diff] [blame] | 651 | fileRoundTripTest -g500K |
| 652 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 653 | $ECHO "\n===> zstd long distance matching round-trip tests " |
Nick Terrell | f15a17e | 2018-02-27 20:09:18 -0800 | [diff] [blame] | 654 | roundTripTest -g0 "2 --single-thread --long" |
| 655 | roundTripTest -g1000K "1 --single-thread --long" |
| 656 | roundTripTest -g517K "6 --single-thread --long" |
| 657 | roundTripTest -g516K "16 --single-thread --long" |
| 658 | roundTripTest -g518K "19 --single-thread --long" |
| 659 | fileRoundTripTest -g5M "3 --single-thread --long" |
Stella Lau | 6a546ef | 2017-07-28 15:51:33 -0700 | [diff] [blame] | 660 | |
| 661 | |
Yann Collet | 7568983 | 2018-02-09 15:53:27 -0800 | [diff] [blame] | 662 | roundTripTest -g96K "5 --single-thread" |
Sean Purcell | c424ec2 | 2017-04-17 11:38:53 -0700 | [diff] [blame] | 663 | if [ -n "$hasMT" ] |
| 664 | then |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 665 | $ECHO "\n===> zstdmt round-trip tests " |
Sean Purcell | d845dab | 2017-04-17 12:10:58 -0700 | [diff] [blame] | 666 | roundTripTest -g4M "1 -T0" |
| 667 | roundTripTest -g8M "3 -T2" |
Yann Collet | 230d7ac | 2017-04-21 11:38:13 -0700 | [diff] [blame] | 668 | roundTripTest -g8000K "2 --threads=2" |
Sean Purcell | d845dab | 2017-04-17 12:10:58 -0700 | [diff] [blame] | 669 | fileRoundTripTest -g4M "19 -T2 -B1M" |
Stella Lau | 6a546ef | 2017-07-28 15:51:33 -0700 | [diff] [blame] | 670 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 671 | $ECHO "\n===> zstdmt long distance matching round-trip tests " |
Nick Terrell | f15a17e | 2018-02-27 20:09:18 -0800 | [diff] [blame] | 672 | roundTripTest -g8M "3 --long=24 -T2" |
Yann Collet | 96b480a | 2018-03-29 13:07:28 -0600 | [diff] [blame] | 673 | |
| 674 | $ECHO "\n===> ovLog tests " |
| 675 | ./datagen -g2MB > tmp |
| 676 | refSize=$($ZSTD tmp -6 -c --zstd=wlog=18 | wc -c) |
| 677 | ov9Size=$($ZSTD tmp -6 -c --zstd=wlog=18,ovlog=9 | wc -c) |
| 678 | ov0Size=$($ZSTD tmp -6 -c --zstd=wlog=18,ovlog=0 | wc -c) |
| 679 | if [ $refSize -eq $ov9Size ]; then |
| 680 | echo ov9Size should be different from refSize |
| 681 | exit 1 |
| 682 | fi |
| 683 | if [ $refSize -eq $ov0Size ]; then |
| 684 | echo ov0Size should be different from refSize |
| 685 | exit 1 |
| 686 | fi |
| 687 | if [ $ov9Size -ge $ov0Size ]; then |
| 688 | echo ov9Size=$ov9Size should be smaller than ov0Size=$ov0Size |
| 689 | exit 1 |
| 690 | fi |
| 691 | |
Sean Purcell | c424ec2 | 2017-04-17 11:38:53 -0700 | [diff] [blame] | 692 | else |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 693 | $ECHO "\n===> no multithreading, skipping zstdmt tests " |
Sean Purcell | c424ec2 | 2017-04-17 11:38:53 -0700 | [diff] [blame] | 694 | fi |
| 695 | |
Yann Collet | 459a6b7 | 2016-02-15 20:37:23 +0100 | [diff] [blame] | 696 | rm tmp* |
Konstantin Tokarev | 76be378 | 2015-12-08 18:36:37 +0300 | [diff] [blame] | 697 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 698 | $ECHO "\n===> zstd --list/-l single frame tests " |
Paul Cruz | ddd1ab7 | 2017-06-15 16:53:03 -0700 | [diff] [blame] | 699 | ./datagen > tmp1 |
| 700 | ./datagen > tmp2 |
| 701 | ./datagen > tmp3 |
Paul Cruz | ddd1ab7 | 2017-06-15 16:53:03 -0700 | [diff] [blame] | 702 | $ZSTD tmp* |
Paul Cruz | 6a99de2 | 2017-06-20 10:45:06 -0700 | [diff] [blame] | 703 | $ZSTD -l *.zst |
Yann Collet | 43914f6 | 2017-10-13 23:47:01 -0700 | [diff] [blame] | 704 | $ZSTD -lv *.zst | grep "Decompressed Size:" # check that decompressed size is present in header |
Paul Cruz | 6a99de2 | 2017-06-20 10:45:06 -0700 | [diff] [blame] | 705 | $ZSTD --list *.zst |
| 706 | $ZSTD --list -v *.zst |
Paul Cruz | ddd1ab7 | 2017-06-15 16:53:03 -0700 | [diff] [blame] | 707 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 708 | $ECHO "\n===> zstd --list/-l multiple frame tests " |
Paul Cruz | ddd1ab7 | 2017-06-15 16:53:03 -0700 | [diff] [blame] | 709 | cat tmp1.zst tmp2.zst > tmp12.zst |
Yann Collet | 60059df | 2017-09-27 15:16:27 -0700 | [diff] [blame] | 710 | cat tmp12.zst tmp3.zst > tmp123.zst |
Paul Cruz | 6a99de2 | 2017-06-20 10:45:06 -0700 | [diff] [blame] | 711 | $ZSTD -l *.zst |
| 712 | $ZSTD -lv *.zst |
Paul Cruz | ddd1ab7 | 2017-06-15 16:53:03 -0700 | [diff] [blame] | 713 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 714 | $ECHO "\n===> zstd --list/-l error detection tests " |
Paul Cruz | 58c19b4 | 2017-06-20 14:14:53 -0700 | [diff] [blame] | 715 | ! $ZSTD -l tmp1 tmp1.zst |
| 716 | ! $ZSTD --list tmp* |
| 717 | ! $ZSTD -lv tmp1* |
Yann Collet | 60059df | 2017-09-27 15:16:27 -0700 | [diff] [blame] | 718 | ! $ZSTD --list -v tmp2 tmp12.zst |
Paul Cruz | b07d0af | 2017-06-20 11:54:44 -0700 | [diff] [blame] | 719 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 720 | $ECHO "\n===> zstd --list/-l test with null files " |
Paul Cruz | a73c2a4 | 2017-06-20 14:33:08 -0700 | [diff] [blame] | 721 | ./datagen -g0 > tmp5 |
| 722 | $ZSTD tmp5 |
Yann Collet | c16748b | 2017-06-21 12:09:53 -0700 | [diff] [blame] | 723 | $ZSTD -l tmp5.zst |
Paul Cruz | a73c2a4 | 2017-06-20 14:33:08 -0700 | [diff] [blame] | 724 | ! $ZSTD -l tmp5* |
Yann Collet | 5891f1d | 2017-10-17 16:23:20 -0700 | [diff] [blame] | 725 | $ZSTD -lv tmp5.zst | grep "Decompressed Size: 0.00 KB (0 B)" # check that 0 size is present in header |
Paul Cruz | a73c2a4 | 2017-06-20 14:33:08 -0700 | [diff] [blame] | 726 | ! $ZSTD -lv tmp5* |
Paul Cruz | a73c2a4 | 2017-06-20 14:33:08 -0700 | [diff] [blame] | 727 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 728 | $ECHO "\n===> zstd --list/-l test with no content size field " |
Yann Collet | 43914f6 | 2017-10-13 23:47:01 -0700 | [diff] [blame] | 729 | ./datagen -g513K | $ZSTD > tmp6.zst |
Paul Cruz | db3606e | 2017-06-20 17:43:36 -0700 | [diff] [blame] | 730 | $ZSTD -l tmp6.zst |
Yann Collet | 43914f6 | 2017-10-13 23:47:01 -0700 | [diff] [blame] | 731 | ! $ZSTD -lv tmp6.zst | grep "Decompressed Size:" # must NOT be present in header |
Yann Collet | c16748b | 2017-06-21 12:09:53 -0700 | [diff] [blame] | 732 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 733 | $ECHO "\n===> zstd --list/-l test with no checksum " |
Yann Collet | c16748b | 2017-06-21 12:09:53 -0700 | [diff] [blame] | 734 | $ZSTD -f --no-check tmp1 |
| 735 | $ZSTD -l tmp1.zst |
| 736 | $ZSTD -lv tmp1.zst |
Paul Cruz | db3606e | 2017-06-20 17:43:36 -0700 | [diff] [blame] | 737 | |
Paul Cruz | ddd1ab7 | 2017-06-15 16:53:03 -0700 | [diff] [blame] | 738 | rm tmp* |
| 739 | |
Yann Collet | c16748b | 2017-06-21 12:09:53 -0700 | [diff] [blame] | 740 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 741 | $ECHO "\n===> zstd long distance matching tests " |
Nick Terrell | f15a17e | 2018-02-27 20:09:18 -0800 | [diff] [blame] | 742 | roundTripTest -g0 " --single-thread --long" |
| 743 | roundTripTest -g9M "2 --single-thread --long" |
Yann Collet | 0250219 | 2017-09-27 15:48:06 -0700 | [diff] [blame] | 744 | # Test parameter parsing |
Nick Terrell | f15a17e | 2018-02-27 20:09:18 -0800 | [diff] [blame] | 745 | roundTripTest -g1M -P50 "1 --single-thread --long=29" " --memory=512MB" |
| 746 | roundTripTest -g1M -P50 "1 --single-thread --long=29 --zstd=wlog=28" " --memory=256MB" |
| 747 | roundTripTest -g1M -P50 "1 --single-thread --long=29" " --long=28 --memory=512MB" |
| 748 | roundTripTest -g1M -P50 "1 --single-thread --long=29" " --zstd=wlog=28 --memory=512MB" |
Yann Collet | 0250219 | 2017-09-27 15:48:06 -0700 | [diff] [blame] | 749 | |
| 750 | |
Konstantin Tokarev | 0b570b5 | 2015-12-08 18:47:43 +0300 | [diff] [blame] | 751 | if [ "$1" != "--test-large-data" ]; then |
inikep | 5d58956 | 2016-05-25 10:50:28 +0200 | [diff] [blame] | 752 | $ECHO "Skipping large data tests" |
Konstantin Tokarev | 0b570b5 | 2015-12-08 18:47:43 +0300 | [diff] [blame] | 753 | exit 0 |
| 754 | fi |
| 755 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 756 | $ECHO "\n===> large files tests " |
Yann Collet | 0250219 | 2017-09-27 15:48:06 -0700 | [diff] [blame] | 757 | |
Konstantin Tokarev | 76be378 | 2015-12-08 18:36:37 +0300 | [diff] [blame] | 758 | roundTripTest -g270000000 1 |
Yann Collet | 60059df | 2017-09-27 15:16:27 -0700 | [diff] [blame] | 759 | roundTripTest -g250000000 2 |
| 760 | roundTripTest -g230000000 3 |
Konstantin Tokarev | 76be378 | 2015-12-08 18:36:37 +0300 | [diff] [blame] | 761 | |
| 762 | roundTripTest -g140000000 -P60 4 |
Yann Collet | 60059df | 2017-09-27 15:16:27 -0700 | [diff] [blame] | 763 | roundTripTest -g130000000 -P62 5 |
| 764 | roundTripTest -g120000000 -P65 6 |
Konstantin Tokarev | 76be378 | 2015-12-08 18:36:37 +0300 | [diff] [blame] | 765 | |
| 766 | roundTripTest -g70000000 -P70 7 |
Yann Collet | 60059df | 2017-09-27 15:16:27 -0700 | [diff] [blame] | 767 | roundTripTest -g60000000 -P71 8 |
| 768 | roundTripTest -g50000000 -P73 9 |
Konstantin Tokarev | 76be378 | 2015-12-08 18:36:37 +0300 | [diff] [blame] | 769 | |
| 770 | roundTripTest -g35000000 -P75 10 |
Yann Collet | 60059df | 2017-09-27 15:16:27 -0700 | [diff] [blame] | 771 | roundTripTest -g30000000 -P76 11 |
| 772 | roundTripTest -g25000000 -P78 12 |
Konstantin Tokarev | d66db2f | 2015-12-08 18:11:10 +0300 | [diff] [blame] | 773 | |
Yann Collet | 4616fad | 2017-07-10 17:16:41 -0700 | [diff] [blame] | 774 | roundTripTest -g18000013 -P80 13 |
| 775 | roundTripTest -g18000014 -P80 14 |
Yann Collet | 60059df | 2017-09-27 15:16:27 -0700 | [diff] [blame] | 776 | roundTripTest -g18000015 -P81 15 |
| 777 | roundTripTest -g18000016 -P84 16 |
| 778 | roundTripTest -g18000017 -P88 17 |
Yann Collet | 4616fad | 2017-07-10 17:16:41 -0700 | [diff] [blame] | 779 | roundTripTest -g18000018 -P94 18 |
Yann Collet | 60059df | 2017-09-27 15:16:27 -0700 | [diff] [blame] | 780 | roundTripTest -g18000019 -P96 19 |
Konstantin Tokarev | 2b46584 | 2015-12-08 19:36:42 +0300 | [diff] [blame] | 781 | |
Yann Collet | 60059df | 2017-09-27 15:16:27 -0700 | [diff] [blame] | 782 | roundTripTest -g5000000000 -P99 1 |
Yann Collet | 4c7f137 | 2017-12-29 17:40:36 +0100 | [diff] [blame] | 783 | roundTripTest -g1700000000 -P0 "1 --zstd=strategy=6" # ensure btlazy2 can survive an overflow rescale |
Yann Collet | 459a6b7 | 2016-02-15 20:37:23 +0100 | [diff] [blame] | 784 | |
Sean Purcell | eb70d21 | 2017-04-11 17:15:13 -0700 | [diff] [blame] | 785 | fileRoundTripTest -g4193M -P99 1 |
| 786 | |
Yann Collet | 0250219 | 2017-09-27 15:48:06 -0700 | [diff] [blame] | 787 | |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 788 | $ECHO "\n===> zstd long, long distance matching round-trip tests " |
Nick Terrell | f15a17e | 2018-02-27 20:09:18 -0800 | [diff] [blame] | 789 | roundTripTest -g270000000 "1 --single-thread --long" |
| 790 | roundTripTest -g130000000 -P60 "5 --single-thread --long" |
| 791 | roundTripTest -g35000000 -P70 "8 --single-thread --long" |
| 792 | roundTripTest -g18000001 -P80 "18 --single-thread --long" |
Nick Terrell | c233bdb | 2017-09-22 14:04:39 -0700 | [diff] [blame] | 793 | # Test large window logs |
Nick Terrell | f15a17e | 2018-02-27 20:09:18 -0800 | [diff] [blame] | 794 | roundTripTest -g700M -P50 "1 --single-thread --long=29" |
| 795 | roundTripTest -g600M -P50 "1 --single-thread --long --zstd=wlog=29,clog=28" |
Stella Lau | 6a546ef | 2017-07-28 15:51:33 -0700 | [diff] [blame] | 796 | |
| 797 | |
Sean Purcell | c424ec2 | 2017-04-17 11:38:53 -0700 | [diff] [blame] | 798 | if [ -n "$hasMT" ] |
| 799 | then |
Yann Collet | 241c57a | 2017-10-16 14:01:42 -0700 | [diff] [blame] | 800 | $ECHO "\n===> zstdmt long round-trip tests " |
Yann Collet | 60059df | 2017-09-27 15:16:27 -0700 | [diff] [blame] | 801 | roundTripTest -g80000000 -P99 "19 -T2" " " |
| 802 | roundTripTest -g5000000000 -P99 "1 -T2" " " |
| 803 | roundTripTest -g500000000 -P97 "1 -T999" " " |
| 804 | fileRoundTripTest -g4103M -P98 " -T0" " " |
| 805 | roundTripTest -g400000000 -P97 "1 --long=24 -T2" " " |
Sean Purcell | c424ec2 | 2017-04-17 11:38:53 -0700 | [diff] [blame] | 806 | else |
| 807 | $ECHO "\n**** no multithreading, skipping zstdmt tests **** " |
| 808 | fi |
| 809 | |
Yann Collet | 459a6b7 | 2016-02-15 20:37:23 +0100 | [diff] [blame] | 810 | rm tmp* |