mirror of
https://github.com/facebook/zstd.git
synced 2025-08-08 17:22:10 +03:00
[test] Add tests for determinism
Run compression & validate the compressed file matches a known checksum. To update the output run: ``` make -C tests update-cli-tests ```
This commit is contained in:
committed by
Nick Terrell
parent
0de4991942
commit
b16d193512
36
tests/cli-tests/determinism/basic.sh
Executable file
36
tests/cli-tests/determinism/basic.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
|
||||
. "$COMMON/platform.sh"
|
||||
|
||||
set -e
|
||||
|
||||
# To update checksums on version change run this from the tests/ directory
|
||||
# make update-cli-tests
|
||||
|
||||
if [ -n "$NON_DETERMINISTIC" ]; then
|
||||
# Skip tests if we have a non-deterministic build
|
||||
cat "$CLI_TESTS/determinism/basic.sh.stdout.exact"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for level in $(seq 1 19); do
|
||||
for file in $(ls files/); do
|
||||
file="files/$file"
|
||||
echo "level $level, file $file"
|
||||
zstd --single-thread -q -$level $file -c | md5hash
|
||||
done
|
||||
done
|
||||
|
||||
for file in $(ls files/); do
|
||||
file="files/$file"
|
||||
echo "level 1, long=18, file $file"
|
||||
zstd --long=18 --single-thread -q -1 $file -c | md5hash
|
||||
echo "level 19, long=18, file $file"
|
||||
zstd --long=18 --single-thread -q -19 $file -c | md5hash
|
||||
done
|
||||
|
||||
for file in $(ls files/); do
|
||||
file="files/$file"
|
||||
echo "level -1, file $file"
|
||||
zstd -q --single-thread --fast=1 $file -c | md5hash
|
||||
done
|
Reference in New Issue
Block a user