-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cli-tests to `make test`. This adds a `python3` dependency to `make test`, but not `make check`. We could make this dependency optional by skipping the tests if `python3` is not present.
- Loading branch information
Showing
18 changed files
with
102 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
#!/bin/sh -e | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
println "+ zstd -h" | ||
zstd -h | ||
println "+ zstd -H" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
#!/bin/sh -e | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
zstd -V | ||
zstd --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
#!/bin/sh | ||
|
||
# Small utility to | ||
|
||
set -e | ||
|
||
usage() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
#!/bin/env sh | ||
#!/bin/sh | ||
printf '%b\n' "${*}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/bin/sh | ||
|
||
source "$COMMON/platform.sh" | ||
. "$COMMON/platform.sh" | ||
|
||
zstd_supports_format() | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
source "$COMMON/platform.sh" | ||
. "$COMMON/platform.sh" | ||
|
||
MTIME="stat -c %Y" | ||
case "$UNAME" in | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
source "$COMMON/platform.sh" | ||
. "$COMMON/platform.sh" | ||
|
||
GET_PERMS="stat -c %a" | ||
case "$UNAME" in | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/bin/sh | ||
|
||
source "$COMMON/format.sh" | ||
. "$COMMON/format.sh" | ||
|
||
set -e | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,71 @@ | ||
+ datagen | ||
+ zstd --fast=10 file -o file-f10.zst | ||
+ zstd --fast=1 file -o file-f1.zst | ||
+ zstd -1 file -o file-1.zst | ||
+ zstd -19 file -o file-19.zst | ||
+ zstd -22 --ultra file -o file-22.zst | ||
+ zstd -t file-f10.zst file-f1.zst file-1.zst file-19.zst file-22.zst | ||
+ cmp_size -ne file-19.zst file-22.zst | ||
+ cmp_size -lt file-19.zst file-1.zst | ||
+ cmp_size -lt file-1.zst file-f1.zst | ||
+ cmp_size -lt file-f1.zst file-f10.zst | ||
+ zstd --fast file -f | ||
+ cmp file.zst file-f1.zst | ||
+ zstd -0 file -o file-0.zst | ||
+ zstd -f file | ||
+ cmp file.zst file-0.zst | ||
+ zstd -99 file -o file-99.zst | ||
|
||
datagen > file | ||
|
||
# Compress with various levels and ensure that their sizes are ordered | ||
zstd --fast=10 file -o file-f10.zst | ||
zstd --fast=1 file -o file-f1.zst | ||
zstd -1 file -o file-1.zst | ||
zstd -19 file -o file-19.zst | ||
zstd -22 --ultra file -o file-22.zst | ||
|
||
zstd -t file-f10.zst file-f1.zst file-1.zst file-19.zst file-22.zst | ||
|
||
cmp_size -ne file-19.zst file-22.zst | ||
cmp_size -lt file-19.zst file-1.zst | ||
cmp_size -lt file-1.zst file-f1.zst | ||
cmp_size -lt file-f1.zst file-f10.zst | ||
|
||
# Test default levels | ||
zstd --fast file -f | ||
cmp file.zst file-f1.zst || die "--fast is not level -1" | ||
|
||
zstd -0 file -o file-0.zst | ||
zstd -f file | ||
cmp file.zst file-0.zst || die "Level 0 is not the default level" | ||
|
||
# Test level clamping | ||
zstd -99 file -o file-99.zst | ||
Warning : compression level higher than max, reduced to 19 | ||
+ cmp file-19.zst file-99.zst | ||
+ zstd --fast=200000 file -c | ||
+ zstd -t | ||
+ zstd -5000000000 -f file | ||
cmp file-19.zst file-99.zst || die "Level 99 is clamped to 19" | ||
zstd --fast=200000 file -c | zstd -t | ||
|
||
zstd -5000000000 -f file && die "Level too large, must fail" ||: | ||
error: numeric value overflows 32-bit unsigned int | ||
+ : | ||
+ zstd --fast=5000000000 -f file | ||
zstd --fast=5000000000 -f file && die "Level too large, must fail" ||: | ||
error: numeric value overflows 32-bit unsigned int | ||
+ : | ||
+ ZSTD_CLEVEL=-10 | ||
+ zstd file -o file-f10-env.zst | ||
+ ZSTD_CLEVEL=1 | ||
+ zstd file -o file-1-env.zst | ||
+ ZSTD_CLEVEL=+19 | ||
+ zstd file -o file-19-env.zst | ||
+ ZSTD_CLEVEL=+99 | ||
+ zstd file -o file-99-env.zst | ||
|
||
# Test setting a level through the environment variable | ||
ZSTD_CLEVEL=-10 zstd file -o file-f10-env.zst | ||
ZSTD_CLEVEL=1 zstd file -o file-1-env.zst | ||
ZSTD_CLEVEL=+19 zstd file -o file-19-env.zst | ||
ZSTD_CLEVEL=+99 zstd file -o file-99-env.zst | ||
Warning : compression level higher than max, reduced to 19 | ||
+ cmp file-f10.zst file-f10-env.zst | ||
+ cmp file-1.zst file-1-env.zst | ||
+ cmp file-19.zst file-19-env.zst | ||
+ cmp file-99.zst file-99-env.zst | ||
+ zstd -f file | ||
+ ZSTD_CLEVEL=- | ||
+ zstd -f file -o file-env.zst | ||
|
||
cmp file-f10.zst file-f10-env.zst || die "Environment variable failed to set level" | ||
cmp file-1.zst file-1-env.zst || die "Environment variable failed to set level" | ||
cmp file-19.zst file-19-env.zst || die "Environment variable failed to set level" | ||
cmp file-99.zst file-99-env.zst || die "Environment variable failed to set level" | ||
|
||
# Test invalid environment clevel is the default level | ||
zstd -f file | ||
ZSTD_CLEVEL=- zstd -f file -o file-env.zst ; cmp file.zst file-env.zst | ||
Ignore environment variable setting ZSTD_CLEVEL=-: not a valid integer value | ||
+ cmp file.zst file-env.zst | ||
+ ZSTD_CLEVEL=+ | ||
+ zstd -f file -o file-env.zst | ||
ZSTD_CLEVEL=+ zstd -f file -o file-env.zst ; cmp file.zst file-env.zst | ||
Ignore environment variable setting ZSTD_CLEVEL=+: not a valid integer value | ||
+ cmp file.zst file-env.zst | ||
+ ZSTD_CLEVEL=a | ||
+ zstd -f file -o file-env.zst | ||
ZSTD_CLEVEL=a zstd -f file -o file-env.zst ; cmp file.zst file-env.zst | ||
Ignore environment variable setting ZSTD_CLEVEL=a: not a valid integer value | ||
+ cmp file.zst file-env.zst | ||
+ ZSTD_CLEVEL=-a | ||
+ zstd -f file -o file-env.zst | ||
ZSTD_CLEVEL=-a zstd -f file -o file-env.zst ; cmp file.zst file-env.zst | ||
Ignore environment variable setting ZSTD_CLEVEL=-a: not a valid integer value | ||
+ cmp file.zst file-env.zst | ||
+ ZSTD_CLEVEL=+a | ||
+ zstd -f file -o file-env.zst | ||
ZSTD_CLEVEL=+a zstd -f file -o file-env.zst ; cmp file.zst file-env.zst | ||
Ignore environment variable setting ZSTD_CLEVEL=+a: not a valid integer value | ||
+ cmp file.zst file-env.zst | ||
+ ZSTD_CLEVEL=3a7 | ||
+ zstd -f file -o file-env.zst | ||
ZSTD_CLEVEL=3a7 zstd -f file -o file-env.zst ; cmp file.zst file-env.zst | ||
Ignore environment variable setting ZSTD_CLEVEL=3a7: not a valid integer value | ||
+ cmp file.zst file-env.zst | ||
+ ZSTD_CLEVEL=5000000000 | ||
+ zstd -f file -o file-env.zst | ||
ZSTD_CLEVEL=5000000000 zstd -f file -o file-env.zst; cmp file.zst file-env.zst | ||
Ignore environment variable setting ZSTD_CLEVEL=5000000000: numeric value too large | ||
+ cmp file.zst file-env.zst | ||
+ ZSTD_CLEVEL=10 | ||
+ zstd -f file -1 -o file-1-env.zst | ||
+ ZSTD_CLEVEL=10 | ||
+ zstd -f file --fast=1 -o file-f1-env.zst | ||
+ cmp file-1.zst file-1-env.zst | ||
+ cmp file-f1.zst file-f1-env.zst | ||
|
||
# Test environment clevel is overridden by command line | ||
ZSTD_CLEVEL=10 zstd -f file -1 -o file-1-env.zst | ||
ZSTD_CLEVEL=10 zstd -f file --fast=1 -o file-f1-env.zst | ||
|
||
cmp file-1.zst file-1-env.zst || die "Environment variable not overridden" | ||
cmp file-f1.zst file-f1-env.zst || die "Environment variable not overridden" |
2 changes: 1 addition & 1 deletion
2
tests/cli-tests/dict-builder/no-inputs → tests/cli-tests/dict-builder/no-inputs.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/bin/sh | ||
set -x | ||
set -v | ||
zstd --train |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...tests/dict-builder/no-inputs.stderr.exact → ...ts/dict-builder/no-inputs.sh.stderr.exact
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 4 additions & 6 deletions
10
tests/cli-tests/dictionaries/dictionary-mismatch.sh.stderr.exact
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
+ zstd files/0 -D dicts/0 | ||
+ zstd -t files/0.zst -D dicts/0 | ||
+ zstd -t files/0.zst -D dicts/1 | ||
zstd files/0 -D dicts/0 | ||
zstd -t files/0.zst -D dicts/0 | ||
zstd -t files/0.zst -D dicts/1 && die "Must fail" ||: | ||
files/0.zst : Decoding error (36) : Dictionary mismatch | ||
+ : | ||
+ zstd -t files/0.zst | ||
zstd -t files/0.zst && die "Must fail" ||: | ||
files/0.zst : Decoding error (36) : Dictionary mismatch | ||
+ : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
set -e | ||
|
||
source "$COMMON/platform.sh" | ||
. "$COMMON/platform.sh" | ||
|
||
|
||
mkdir files/ dicts/ | ||
|