[test] Add new CLI testing platform
Adds the new CLI testing platform that I'm proposing. See the added `README.md` for details.
This commit is contained in:
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# Test --adapt
|
||||
zstd -f file --adapt -c | zstd -t
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# Uncomment the set -x line for debugging
|
||||
# set -x
|
||||
|
||||
# Test compression flags and check that they work
|
||||
zstd file ; zstd -t file.zst
|
||||
zstd -f file ; zstd -t file.zst
|
||||
zstd -f -z file ; zstd -t file.zst
|
||||
zstd -f -k file ; zstd -t file.zst
|
||||
zstd -f -C file ; zstd -t file.zst
|
||||
zstd -f --check file ; zstd -t file.zst
|
||||
zstd -f --no-check file ; zstd -t file.zst
|
||||
zstd -f -- file ; zstd -t file.zst
|
||||
|
||||
# Test output file compression
|
||||
zstd -o file-out.zst ; zstd -t file-out.zst
|
||||
zstd -fo file-out.zst; zstd -t file-out.zst
|
||||
|
||||
# Test compression to stdout
|
||||
zstd -c file | zstd -t
|
||||
zstd --stdout file | zstd -t
|
||||
println bob | zstd | zstd -t
|
||||
|
||||
# Test --rm
|
||||
cp file file-rm
|
||||
zstd --rm file-rm; zstd -t file-rm.zst
|
||||
test ! -f file-rm
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# Test --[no-]compress-literals
|
||||
zstd file --no-compress-literals -1 -c | zstd -t
|
||||
zstd file --no-compress-literals -19 -c | zstd -t
|
||||
zstd file --no-compress-literals --fast=1 -c | zstd -t
|
||||
zstd file --compress-literals -1 -c | zstd -t
|
||||
zstd file --compress-literals --fast=1 -c | zstd -t
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
source "$COMMON/format.sh"
|
||||
|
||||
set -e
|
||||
|
||||
# Test --format
|
||||
zstd --format=zstd file -f
|
||||
zstd -t file.zst
|
||||
for format in "gzip" "lz4" "xz" "lzma"; do
|
||||
if zstd_supports_format $format; then
|
||||
zstd --format=$format file
|
||||
zstd -t file.$(format_extension $format)
|
||||
zstd -c --format=$format file | zstd -t --format=$format
|
||||
fi
|
||||
done
|
||||
Executable
+64
@@ -0,0 +1,64 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
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,f1,1,19,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
|
||||
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" ||:
|
||||
zstd --fast=5000000000 -f file && die "Level too large, must fail" ||:
|
||||
|
||||
# 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
|
||||
|
||||
cmp file-f10{,-env}.zst || die "Environment variable failed to set level"
|
||||
cmp file-1{,-env}.zst || die "Environment variable failed to set level"
|
||||
cmp file-19{,-env}.zst || die "Environment variable failed to set level"
|
||||
cmp 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
|
||||
ZSTD_CLEVEL=+ zstd -f file -o file-env.zst ; cmp file.zst file-env.zst
|
||||
ZSTD_CLEVEL=a zstd -f file -o file-env.zst ; cmp file.zst file-env.zst
|
||||
ZSTD_CLEVEL=-a zstd -f file -o file-env.zst ; cmp file.zst file-env.zst
|
||||
ZSTD_CLEVEL=+a zstd -f file -o file-env.zst ; cmp file.zst file-env.zst
|
||||
ZSTD_CLEVEL=3a7 zstd -f file -o file-env.zst ; cmp file.zst file-env.zst
|
||||
ZSTD_CLEVEL=5000000000 zstd -f file -o file-env.zst; cmp file.zst file-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{,-env}.zst || die "Environment variable not overridden"
|
||||
cmp file-f1{,-env}.zst || die "Environment variable not overridden"
|
||||
@@ -0,0 +1,75 @@
|
||||
+ 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
|
||||
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
|
||||
error: numeric value overflows 32-bit unsigned int
|
||||
+ :
|
||||
+ zstd --fast=5000000000 -f file
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# Test --long
|
||||
zstd -f file --long ; zstd -t file.zst
|
||||
zstd -f file --long=20; zstd -t file.zst
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# Test multi-threaded flags
|
||||
zstd --single-thread file -f ; zstd -t file.zst
|
||||
zstd -T2 -f file ; zstd -t file.zst
|
||||
zstd --rsyncable -f file ; zstd -t file.zst
|
||||
zstd -T0 -f file ; zstd -t file.zst
|
||||
zstd -T0 --auto-threads=logical -f file ; zstd -t file.zst
|
||||
zstd -T0 --auto-threads=physical -f file; zstd -t file.zst
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# Test --[no-]row-match-finder
|
||||
zstd file -7f --row-match-finder
|
||||
zstd file -7f --no-row-match-finder
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
datagen > file
|
||||
datagen > file0
|
||||
datagen > file1
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# Test stream size & hint
|
||||
datagen -g7654 | zstd --stream-size=7654 | zstd -t
|
||||
datagen -g7654 | zstd --size-hint=7000 | zstd -t
|
||||
Reference in New Issue
Block a user