mirror of
https://github.com/facebook/zstd.git
synced 2025-08-01 09:47:01 +03:00
initial commit
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
# THIS BENCHMARK IS BEING REPLACED BY automated-bencmarking.py
|
||||
|
||||
# ################################################################
|
||||
# Copyright (c) Przemyslaw Skibinski, Yann Collet, Facebook, Inc.
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
# ################################################################
|
||||
# Copyright (c) Yann Collet, Facebook, Inc.
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
@ -169,7 +169,7 @@ fuzzer-dll : $(ZSTDDIR)/common/xxhash.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PR
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(filter %.c,$^) $(LDFLAGS) -o $@$(EXT)
|
||||
|
||||
CLEAN += zstreamtest zstreamtest32
|
||||
ZSTREAM_LOCAL_FILES := $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c seqgen.c zstreamtest.c
|
||||
ZSTREAM_LOCAL_FILES := $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c seqgen.c zstreamtest.c external_matchfinder.c
|
||||
ZSTREAM_PROPER_FILES := $(ZDICT_FILES) $(ZSTREAM_LOCAL_FILES)
|
||||
ZSTREAMFILES := $(ZSTD_FILES) $(ZSTREAM_PROPER_FILES)
|
||||
zstreamtest32 : CFLAGS += -m32
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ################################################################
|
||||
# Copyright (c) Facebook, Inc.
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
31
tests/check_size.py
Executable file
31
tests/check_size.py
Executable file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
# ################################################################
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
||||
# in the COPYING file in the root directory of this source tree).
|
||||
# You may select, at your option, one of the above-listed licenses.
|
||||
# ################################################################
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print(f"Usage: {sys.argv[0]} FILE SIZE_LIMIT")
|
||||
sys.exit(1)
|
||||
|
||||
file = sys.argv[1]
|
||||
limit = int(sys.argv[2])
|
||||
|
||||
if not os.path.exists(file):
|
||||
print(f"{file} does not exist")
|
||||
sys.exit(1)
|
||||
|
||||
size = os.path.getsize(file)
|
||||
|
||||
if size > limit:
|
||||
print(f"file {file} is {size} bytes, which is greater than the limit of {limit} bytes")
|
||||
sys.exit(1)
|
@ -45,6 +45,16 @@ Examples:
|
||||
./run.py --preserve --verbose basic/help.sh
|
||||
```
|
||||
|
||||
### Updating exact output
|
||||
|
||||
If a test is failing because a `.stderr.exact` or `.stdout.exact` no longer matches, you can re-run the tests with `--set-exact-output` and the correct output will be written.
|
||||
|
||||
Example:
|
||||
```
|
||||
./run.py --set-exact-output
|
||||
./run.py basic/help.sh --set-exact-output
|
||||
```
|
||||
|
||||
## Writing a test
|
||||
|
||||
Test cases are arbitrary executables, and can be written in any language, but are generally shell scripts.
|
||||
|
@ -1,25 +1,34 @@
|
||||
+ zstd -h
|
||||
Usage: zstd *OPTION*... *FILE*... *-o file*
|
||||
Compress or uncompress FILEs (with no FILE or when FILE is `-`, read from standard input).
|
||||
Compress or decompress the INPUT file(s); reads from STDIN if INPUT is `-` or not provided.
|
||||
|
||||
-o file result stored into `file` (only 1 output file)
|
||||
-1 .. -19 compression level (faster .. better; default: 3)
|
||||
-d, --decompress decompression
|
||||
-f, --force disable input and output checks. Allows overwriting existing files,
|
||||
input from console, output to stdout, operating on links,
|
||||
block devices, etc. During decompression and when the output
|
||||
destination is stdout, pass-through unrecognized formats as-is.
|
||||
--rm remove source file(s) after successful de/compression
|
||||
-k, --keep preserve source file(s) (default)
|
||||
-D DICT use DICT as Dictionary for compression or decompression
|
||||
-h display usage and exit
|
||||
-H,--help display long help and exit
|
||||
Usage: zstd *OPTIONS...* *INPUT... | -* *-o OUTPUT*
|
||||
|
||||
Options:
|
||||
-o OUTPUT Write output to a single file, OUTPUT.
|
||||
-k, --keep Preserve INPUT file(s). *Default*
|
||||
--rm Remove INPUT file(s) after successful (de)compression.
|
||||
|
||||
-# Desired compression level, where `#` is a number between 1 and 19;
|
||||
lower numbers provide faster compression, higher numbers yield
|
||||
better compression ratios. *Default: 3*
|
||||
|
||||
-d, --decompress Perform decompression.
|
||||
-D DICT Use DICT as the dictionary for compression or decompression.
|
||||
|
||||
-f, --force Disable input and output checks. Allows overwriting existing files,
|
||||
receiving input from the console, printing ouput to STDOUT, and
|
||||
operating on links, block devices, etc. Unrecognized formats will be
|
||||
passed-through through as-is.
|
||||
|
||||
-h Display short usage and exit.
|
||||
-H, --help Display full help and exit.
|
||||
-V, --version Display the program version and exit.
|
||||
|
||||
+ zstd -H
|
||||
...
|
||||
Advanced options :
|
||||
Advanced options:
|
||||
...
|
||||
+ zstd --help
|
||||
...
|
||||
Advanced options :
|
||||
Advanced options:
|
||||
...
|
||||
|
@ -1,2 +1,2 @@
|
||||
*** zstd command line interface *-bits v1.*.*, by Yann Collet ***
|
||||
*** zstd command line interface *-bits v1.*.*, by Yann Collet ***
|
||||
*** Zstandard CLI (*-bit) v1.*.*, by Yann Collet ***
|
||||
*** Zstandard CLI (*-bit) v1.*.*, by Yann Collet ***
|
||||
|
@ -10,11 +10,9 @@ 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
|
||||
zstd -t file-f10.zst file-f1.zst file-1.zst file-19.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
|
||||
|
@ -6,11 +6,9 @@ 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
|
||||
zstd -t file-f10.zst file-f1.zst file-1.zst file-19.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
|
||||
|
8
tests/cli-tests/file-stat/compress-file-to-file.sh
Executable file
8
tests/cli-tests/file-stat/compress-file-to-file.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
datagen > file
|
||||
|
||||
zstd file -q --trace-file-stat -o file.zst
|
||||
zstd -tq file.zst
|
@ -0,0 +1,36 @@
|
||||
Trace:FileStat: > UTIL_isLink(file)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isConsole(2)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_getFileSize(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 65537
|
||||
Trace:FileStat: > UTIL_isDirectory(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_isSameFile(file, file.zst)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(file.zst)
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(file.zst)
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_getFileSize(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 65537
|
||||
Trace:FileStat: > UTIL_utime(file.zst)
|
||||
Trace:FileStat: < 0
|
8
tests/cli-tests/file-stat/compress-file-to-stdout.sh
Executable file
8
tests/cli-tests/file-stat/compress-file-to-stdout.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
datagen > file
|
||||
|
||||
zstd file -cq --trace-file-stat > file.zst
|
||||
zstd -tq file.zst
|
@ -0,0 +1,22 @@
|
||||
Trace:FileStat: > UTIL_isLink(file)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isConsole(1)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_getFileSize(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 65537
|
||||
Trace:FileStat: > UTIL_isDirectory(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_isRegularFile(/*stdout*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdout*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_getFileSize(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 65537
|
8
tests/cli-tests/file-stat/compress-stdin-to-file.sh
Executable file
8
tests/cli-tests/file-stat/compress-stdin-to-file.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
datagen > file
|
||||
|
||||
zstd < file -q --trace-file-stat -o file.zst
|
||||
zstd -tq file.zst
|
@ -0,0 +1,28 @@
|
||||
Trace:FileStat: > UTIL_isConsole(0)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isConsole(2)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_getFileSize(/*stdin*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < -1
|
||||
Trace:FileStat: > UTIL_isDirectory(/*stdin*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isSameFile(/*stdin*\, file.zst)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(file.zst)
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(file.zst)
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_getFileSize(/*stdin*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < -1
|
8
tests/cli-tests/file-stat/compress-stdin-to-stdout.sh
Executable file
8
tests/cli-tests/file-stat/compress-stdin-to-stdout.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
datagen > file
|
||||
|
||||
zstd < file -cq --trace-file-stat > file.zst
|
||||
zstd -tq file.zst
|
@ -0,0 +1,20 @@
|
||||
Trace:FileStat: > UTIL_isConsole(0)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isConsole(1)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_getFileSize(/*stdin*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < -1
|
||||
Trace:FileStat: > UTIL_isDirectory(/*stdin*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(/*stdout*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdout*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_getFileSize(/*stdin*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < -1
|
7
tests/cli-tests/file-stat/decompress-file-to-file.sh
Executable file
7
tests/cli-tests/file-stat/decompress-file-to-file.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
datagen | zstd -q > file.zst
|
||||
|
||||
zstd -dq --trace-file-stat file.zst
|
@ -0,0 +1,30 @@
|
||||
Trace:FileStat: > UTIL_isLink(file.zst)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isConsole(1)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isConsole(2)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isDirectory(file.zst)
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_isSameFile(file.zst, file)
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_utime(file)
|
||||
Trace:FileStat: < 0
|
7
tests/cli-tests/file-stat/decompress-file-to-stdout.sh
Executable file
7
tests/cli-tests/file-stat/decompress-file-to-stdout.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
datagen | zstd -q > file.zst
|
||||
|
||||
zstd -dcq --trace-file-stat file.zst > file
|
@ -0,0 +1,14 @@
|
||||
Trace:FileStat: > UTIL_isLink(file.zst)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isConsole(1)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isDirectory(file.zst)
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_isRegularFile(/*stdout*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdout*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
7
tests/cli-tests/file-stat/decompress-stdin-to-file.sh
Executable file
7
tests/cli-tests/file-stat/decompress-stdin-to-file.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
datagen | zstd -q > file.zst
|
||||
|
||||
zstd -dcq --trace-file-stat < file.zst -o file
|
@ -0,0 +1,20 @@
|
||||
Trace:FileStat: > UTIL_isConsole(0)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isConsole(2)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isDirectory(/*stdin*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isSameFile(/*stdin*\, file)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 1
|
7
tests/cli-tests/file-stat/decompress-stdin-to-stdout.sh
Executable file
7
tests/cli-tests/file-stat/decompress-stdin-to-stdout.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
datagen | zstd -q > file.zst
|
||||
|
||||
zstd -dcq --trace-file-stat < file.zst > file
|
@ -0,0 +1,12 @@
|
||||
Trace:FileStat: > UTIL_isConsole(0)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isConsole(1)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isDirectory(/*stdin*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(/*stdout*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdout*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
@ -55,36 +55,36 @@ decompress 2 files
|
||||
|
||||
args = --no-progress --fake-stderr-is-console -v
|
||||
compress file to file
|
||||
*zstd*
|
||||
*Zstandard CLI*
|
||||
hello*hello.zst*
|
||||
compress pipe to pipe
|
||||
*zstd*
|
||||
*Zstandard CLI*
|
||||
*stdin*stdout*
|
||||
compress pipe to file
|
||||
*zstd*
|
||||
*Zstandard CLI*
|
||||
*stdin*hello.zst*
|
||||
compress file to pipe
|
||||
*zstd*
|
||||
*Zstandard CLI*
|
||||
*hello*stdout*
|
||||
compress 2 files
|
||||
*zstd*
|
||||
*Zstandard CLI*
|
||||
*hello*hello.zst*
|
||||
*world*world.zst*
|
||||
2 files compressed*
|
||||
decompress file to file
|
||||
*zstd*
|
||||
*Zstandard CLI*
|
||||
hello.zst*
|
||||
decompress pipe to pipe
|
||||
*zstd*
|
||||
*Zstandard CLI*
|
||||
*stdin*
|
||||
decompress pipe to file
|
||||
*zstd*
|
||||
*Zstandard CLI*
|
||||
*stdin*
|
||||
decompress file to pipe
|
||||
*zstd*
|
||||
*Zstandard CLI*
|
||||
hello.zst*
|
||||
decompress 2 files
|
||||
*zstd*
|
||||
*Zstandard CLI*
|
||||
hello.zst*
|
||||
world.zst*
|
||||
2 files decompressed*
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
# ################################################################
|
||||
# Copyright (c) Facebook, Inc.
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
@ -209,6 +209,7 @@ class Options:
|
||||
preserve: bool,
|
||||
scratch_dir: str,
|
||||
test_dir: str,
|
||||
set_exact_output: bool,
|
||||
) -> None:
|
||||
self.env = env
|
||||
self.timeout = timeout
|
||||
@ -216,6 +217,7 @@ class Options:
|
||||
self.preserve = preserve
|
||||
self.scratch_dir = scratch_dir
|
||||
self.test_dir = test_dir
|
||||
self.set_exact_output = set_exact_output
|
||||
|
||||
|
||||
class TestCase:
|
||||
@ -335,7 +337,7 @@ class TestCase:
|
||||
self._test_stdin.close()
|
||||
self._test_stdin = None
|
||||
|
||||
def _check_output_exact(self, out_name: str, expected: bytes) -> None:
|
||||
def _check_output_exact(self, out_name: str, expected: bytes, exact_name: str) -> None:
|
||||
"""
|
||||
Check the output named :out_name: for an exact match against the :expected: content.
|
||||
Saves the success and message.
|
||||
@ -349,6 +351,10 @@ class TestCase:
|
||||
self._success[check_name] = False
|
||||
self._message[check_name] = f"{out_name} does not match!\n> diff expected actual\n{diff(expected, actual)}"
|
||||
|
||||
if self._opts.set_exact_output:
|
||||
with open(exact_name, "wb") as f:
|
||||
f.write(actual)
|
||||
|
||||
def _check_output_glob(self, out_name: str, expected: bytes) -> None:
|
||||
"""
|
||||
Check the output named :out_name: for a glob match against the :expected: glob.
|
||||
@ -386,7 +392,7 @@ class TestCase:
|
||||
ignore_name = f"{self._test_file}.{out_name}.ignore"
|
||||
|
||||
if os.path.exists(exact_name):
|
||||
return self._check_output_exact(out_name, read_file(exact_name))
|
||||
return self._check_output_exact(out_name, read_file(exact_name), exact_name)
|
||||
elif os.path.exists(glob_name):
|
||||
return self._check_output_glob(out_name, read_file(glob_name))
|
||||
elif os.path.exists(ignore_name):
|
||||
@ -394,7 +400,7 @@ class TestCase:
|
||||
self._success[check_name] = True
|
||||
self._message[check_name] = f"{out_name} ignored!"
|
||||
else:
|
||||
return self._check_output_exact(out_name, bytes())
|
||||
return self._check_output_exact(out_name, bytes(), exact_name)
|
||||
|
||||
def _check_stderr(self) -> None:
|
||||
"""Checks the stderr output against the expectation."""
|
||||
@ -678,6 +684,11 @@ if __name__ == "__main__":
|
||||
"Scratch directory located in TEST_DIR/scratch/."
|
||||
)
|
||||
)
|
||||
parser.add_argument(
|
||||
"--set-exact-output",
|
||||
action="store_true",
|
||||
help="Set stderr.exact and stdout.exact for all failing tests, unless .ignore or .glob already exists"
|
||||
)
|
||||
parser.add_argument(
|
||||
"tests",
|
||||
nargs="*",
|
||||
@ -714,6 +725,7 @@ if __name__ == "__main__":
|
||||
preserve=args.preserve,
|
||||
test_dir=args.test_dir,
|
||||
scratch_dir=scratch_dir,
|
||||
set_exact_output=args.set_exact_output,
|
||||
)
|
||||
|
||||
if len(args.tests) == 0:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
@ -136,7 +136,7 @@ static void RAND_genDist(U32* seed, BYTE* dist, double weight)
|
||||
BYTE step = (BYTE) ((RAND(seed) % 256) | 1); /* force it to be odd so it's relatively prime to 256 */
|
||||
|
||||
while (i < DISTSIZE) {
|
||||
size_t states = ((size_t)(weight * statesLeft)) + 1;
|
||||
size_t states = ((size_t)(weight * (double)statesLeft)) + 1;
|
||||
size_t j;
|
||||
for (j = 0; j < states && i < DISTSIZE; j++, i++) {
|
||||
dist[i] = symb;
|
||||
@ -662,11 +662,11 @@ generateSequences(U32* seed, frame_t* frame, seqStore_t* seqStore,
|
||||
* ensure nice numbers */
|
||||
U32 matchLen =
|
||||
MIN_SEQ_LEN +
|
||||
ROUND(RAND_exp(seed, excessMatch / (double)(numSequences - i)));
|
||||
ROUND(RAND_exp(seed, (double)excessMatch / (double)(numSequences - i)));
|
||||
U32 literalLen =
|
||||
(RAND(seed) & 7)
|
||||
? ROUND(RAND_exp(seed,
|
||||
literalsSize /
|
||||
(double)literalsSize /
|
||||
(double)(numSequences - i)))
|
||||
: 0;
|
||||
/* actual offset, code to send, and point to copy up to when shifting
|
||||
|
117
tests/external_matchfinder.c
Normal file
117
tests/external_matchfinder.c
Normal file
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (c) Yann Collet, Meta Platforms, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
||||
* in the COPYING file in the root directory of this source tree).
|
||||
* You may select, at your option, one of the above-listed licenses.
|
||||
*/
|
||||
|
||||
#include "external_matchfinder.h"
|
||||
#include <string.h>
|
||||
#include "zstd_compress_internal.h"
|
||||
|
||||
#define HSIZE 1024
|
||||
static U32 const HLOG = 10;
|
||||
static U32 const MLS = 4;
|
||||
static U32 const BADIDX = 0xffffffff;
|
||||
|
||||
static size_t simpleExternalMatchFinder(
|
||||
void* externalMatchState,
|
||||
ZSTD_Sequence* outSeqs, size_t outSeqsCapacity,
|
||||
const void* src, size_t srcSize,
|
||||
const void* dict, size_t dictSize,
|
||||
int compressionLevel,
|
||||
size_t windowSize
|
||||
) {
|
||||
const BYTE* const istart = (const BYTE*)src;
|
||||
const BYTE* const iend = istart + srcSize;
|
||||
const BYTE* ip = istart;
|
||||
const BYTE* anchor = istart;
|
||||
size_t seqCount = 0;
|
||||
U32 hashTable[HSIZE];
|
||||
|
||||
(void)externalMatchState;
|
||||
(void)dict;
|
||||
(void)dictSize;
|
||||
(void)outSeqsCapacity;
|
||||
(void)compressionLevel;
|
||||
|
||||
{ int i;
|
||||
for (i=0; i < HSIZE; i++) {
|
||||
hashTable[i] = BADIDX;
|
||||
} }
|
||||
|
||||
while (ip + MLS < iend) {
|
||||
size_t const hash = ZSTD_hashPtr(ip, HLOG, MLS);
|
||||
U32 const matchIndex = hashTable[hash];
|
||||
hashTable[hash] = (U32)(ip - istart);
|
||||
|
||||
if (matchIndex != BADIDX) {
|
||||
const BYTE* const match = istart + matchIndex;
|
||||
U32 const matchLen = (U32)ZSTD_count(ip, match, iend);
|
||||
if (matchLen >= ZSTD_MINMATCH_MIN) {
|
||||
U32 const litLen = (U32)(ip - anchor);
|
||||
U32 const offset = (U32)(ip - match);
|
||||
ZSTD_Sequence const seq = {
|
||||
offset, litLen, matchLen, 0
|
||||
};
|
||||
|
||||
/* Note: it's crucial to stay within the window size! */
|
||||
if (offset <= windowSize) {
|
||||
outSeqs[seqCount++] = seq;
|
||||
ip += matchLen;
|
||||
anchor = ip;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ip++;
|
||||
}
|
||||
|
||||
{ ZSTD_Sequence const finalSeq = {
|
||||
0, (U32)(iend - anchor), 0, 0
|
||||
};
|
||||
outSeqs[seqCount++] = finalSeq;
|
||||
}
|
||||
|
||||
return seqCount;
|
||||
}
|
||||
|
||||
size_t zstreamExternalMatchFinder(
|
||||
void* externalMatchState,
|
||||
ZSTD_Sequence* outSeqs, size_t outSeqsCapacity,
|
||||
const void* src, size_t srcSize,
|
||||
const void* dict, size_t dictSize,
|
||||
int compressionLevel,
|
||||
size_t windowSize
|
||||
) {
|
||||
EMF_testCase const testCase = *((EMF_testCase*)externalMatchState);
|
||||
memset(outSeqs, 0, outSeqsCapacity);
|
||||
|
||||
switch (testCase) {
|
||||
case EMF_ZERO_SEQS:
|
||||
return 0;
|
||||
case EMF_ONE_BIG_SEQ:
|
||||
outSeqs[0].offset = 0;
|
||||
outSeqs[0].matchLength = 0;
|
||||
outSeqs[0].litLength = (U32)(srcSize);
|
||||
return 1;
|
||||
case EMF_LOTS_OF_SEQS:
|
||||
return simpleExternalMatchFinder(
|
||||
externalMatchState,
|
||||
outSeqs, outSeqsCapacity,
|
||||
src, srcSize,
|
||||
dict, dictSize,
|
||||
compressionLevel,
|
||||
windowSize
|
||||
);
|
||||
case EMF_SMALL_ERROR:
|
||||
return outSeqsCapacity + 1;
|
||||
case EMF_BIG_ERROR:
|
||||
default:
|
||||
return ZSTD_EXTERNAL_MATCHFINDER_ERROR;
|
||||
}
|
||||
}
|
35
tests/external_matchfinder.h
Normal file
35
tests/external_matchfinder.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) Yann Collet, Meta Platforms, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
||||
* in the COPYING file in the root directory of this source tree).
|
||||
* You may select, at your option, one of the above-listed licenses.
|
||||
*/
|
||||
|
||||
#ifndef EXTERNAL_MATCHFINDER
|
||||
#define EXTERNAL_MATCHFINDER
|
||||
|
||||
#define ZSTD_STATIC_LINKING_ONLY
|
||||
#include "zstd.h"
|
||||
|
||||
/* See external_matchfinder.c for details on each test case */
|
||||
typedef enum {
|
||||
EMF_ZERO_SEQS = 0,
|
||||
EMF_ONE_BIG_SEQ = 1,
|
||||
EMF_LOTS_OF_SEQS = 2,
|
||||
EMF_BIG_ERROR = 3,
|
||||
EMF_SMALL_ERROR = 4
|
||||
} EMF_testCase;
|
||||
|
||||
size_t zstreamExternalMatchFinder(
|
||||
void* externalMatchState,
|
||||
ZSTD_Sequence* outSeqs, size_t outSeqsCapacity,
|
||||
const void* src, size_t srcSize,
|
||||
const void* dict, size_t dictSize,
|
||||
int compressionLevel,
|
||||
size_t windowSize
|
||||
);
|
||||
|
||||
#endif // EXTERNAL_MATCHFINDER
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ################################################################
|
||||
# Copyright (c) Facebook, Inc.
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# ################################################################
|
||||
# Copyright (c) Facebook, Inc.
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
270
tests/fuzzer.c
270
tests/fuzzer.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
@ -82,8 +82,8 @@ static UTIL_time_t g_displayClock = UTIL_TIME_INITIALIZER;
|
||||
void FUZ_bug976(void);
|
||||
void FUZ_bug976(void)
|
||||
{ /* these constants shall not depend on MIN() macro */
|
||||
assert(ZSTD_HASHLOG_MAX < 31);
|
||||
assert(ZSTD_CHAINLOG_MAX < 31);
|
||||
DEBUG_STATIC_ASSERT(ZSTD_HASHLOG_MAX < 31);
|
||||
DEBUG_STATIC_ASSERT(ZSTD_CHAINLOG_MAX < 31);
|
||||
}
|
||||
|
||||
|
||||
@ -118,23 +118,24 @@ static U32 FUZ_highbit32(U32 v32)
|
||||
/*=============================================
|
||||
* Test macros
|
||||
=============================================*/
|
||||
#define CHECK_Z(f) { \
|
||||
size_t const err = f; \
|
||||
if (ZSTD_isError(err)) { \
|
||||
DISPLAY("Error => %s : %s ", \
|
||||
#f, ZSTD_getErrorName(err)); \
|
||||
exit(1); \
|
||||
#define CHECK(fn) { if(!(fn)) { DISPLAYLEVEL(1, "Error : test (%s) failed \n", #fn); exit(1); } }
|
||||
|
||||
#define CHECK_Z(f) { \
|
||||
size_t const err = f; \
|
||||
if (ZSTD_isError(err)) { \
|
||||
DISPLAY("Error => %s : %s ", \
|
||||
#f, ZSTD_getErrorName(err)); \
|
||||
exit(1); \
|
||||
} }
|
||||
|
||||
#define CHECK_VAR(var, fn) var = fn; if (ZSTD_isError(var)) { DISPLAYLEVEL(1, "%s : fails : %s \n", #fn, ZSTD_getErrorName(var)); goto _output_error; }
|
||||
#define CHECK_VAR(var, fn) var = fn; if (ZSTD_isError(var)) { DISPLAYLEVEL(1, "%s : fails : %s \n", #fn, ZSTD_getErrorName(var)); exit(1); }
|
||||
#define CHECK_NEWV(var, fn) size_t const CHECK_VAR(var, fn)
|
||||
#define CHECK(fn) { CHECK_NEWV(__err, fn); }
|
||||
#define CHECKPLUS(var, fn, more) { CHECK_NEWV(var, fn); more; }
|
||||
|
||||
#define CHECK_OP(op, lhs, rhs) { \
|
||||
if (!((lhs) op (rhs))) { \
|
||||
DISPLAY("Error L%u => FAILED %s %s %s ", __LINE__, #lhs, #op, #rhs); \
|
||||
goto _output_error; \
|
||||
exit(1); \
|
||||
} \
|
||||
}
|
||||
#define CHECK_EQ(lhs, rhs) CHECK_OP(==, lhs, rhs)
|
||||
@ -338,6 +339,7 @@ static void FUZ_decodeSequences(BYTE* dst, ZSTD_Sequence* seqs, size_t seqsSize,
|
||||
}
|
||||
|
||||
#ifdef ZSTD_MULTITHREAD
|
||||
|
||||
typedef struct {
|
||||
ZSTD_CCtx* cctx;
|
||||
ZSTD_threadPool* pool;
|
||||
@ -429,8 +431,8 @@ static int threadPoolTests(void) {
|
||||
|
||||
ZSTD_pthread_create(&t1, NULL, threadPoolTests_compressionJob, &p1);
|
||||
ZSTD_pthread_create(&t2, NULL, threadPoolTests_compressionJob, &p2);
|
||||
ZSTD_pthread_join(t1, NULL);
|
||||
ZSTD_pthread_join(t2, NULL);
|
||||
ZSTD_pthread_join(t1);
|
||||
ZSTD_pthread_join(t2);
|
||||
|
||||
assert(!memcmp(decodedBuffer, decodedBuffer2, CNBuffSize));
|
||||
free(decodedBuffer2);
|
||||
@ -461,6 +463,101 @@ _output_error:
|
||||
* Unit tests
|
||||
=============================================*/
|
||||
|
||||
static void test_compressBound(unsigned tnb)
|
||||
{
|
||||
DISPLAYLEVEL(3, "test%3u : compressBound : ", tnb);
|
||||
|
||||
/* check ZSTD_compressBound == ZSTD_COMPRESSBOUND
|
||||
* for a large range of known valid values */
|
||||
DEBUG_STATIC_ASSERT(sizeof(size_t) >= 4);
|
||||
{ int s;
|
||||
for (s=0; s<30; s++) {
|
||||
size_t const w = (size_t)1 << s;
|
||||
CHECK_EQ(ZSTD_compressBound(w), ZSTD_COMPRESSBOUND(w));
|
||||
} }
|
||||
|
||||
// Ensure error if srcSize too big
|
||||
{ size_t const w = ZSTD_MAX_INPUT_SIZE + 1;
|
||||
CHECK(ZSTD_isError(ZSTD_compressBound(w))); /* must fail */
|
||||
CHECK_EQ(ZSTD_COMPRESSBOUND(w), 0);
|
||||
}
|
||||
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
}
|
||||
|
||||
static void test_decompressBound(unsigned tnb)
|
||||
{
|
||||
DISPLAYLEVEL(3, "test%3u : decompressBound : ", tnb);
|
||||
|
||||
// Simple compression, with size : should provide size;
|
||||
{ const char example[] = "abcd";
|
||||
char cBuffer[ZSTD_COMPRESSBOUND(sizeof(example))];
|
||||
size_t const cSize = ZSTD_compress(cBuffer, sizeof(cBuffer), example, sizeof(example), 0);
|
||||
CHECK_Z(cSize);
|
||||
CHECK_EQ(ZSTD_decompressBound(cBuffer, cSize), (unsigned long long)sizeof(example));
|
||||
}
|
||||
|
||||
// Simple small compression without size : should provide 1 block size
|
||||
{ char cBuffer[ZSTD_COMPRESSBOUND(0)];
|
||||
ZSTD_outBuffer out = { cBuffer, sizeof(cBuffer), 0 };
|
||||
ZSTD_inBuffer in = { NULL, 0, 0 };
|
||||
ZSTD_CCtx* const cctx = ZSTD_createCCtx();
|
||||
assert(cctx);
|
||||
CHECK_Z( ZSTD_initCStream(cctx, 0) );
|
||||
CHECK_Z( ZSTD_compressStream(cctx, &out, &in) );
|
||||
CHECK_EQ( ZSTD_endStream(cctx, &out), 0 );
|
||||
CHECK_EQ( ZSTD_decompressBound(cBuffer, out.pos), ZSTD_BLOCKSIZE_MAX );
|
||||
ZSTD_freeCCtx(cctx);
|
||||
}
|
||||
|
||||
// Attempt to overflow 32-bit intermediate multiplication result
|
||||
// This requires dBound >= 4 GB, aka 2^32.
|
||||
// This requires 2^32 / 2^17 = 2^15 blocks
|
||||
// => create 2^15 blocks (can be empty, or just 1 byte).
|
||||
{ const char input[] = "a";
|
||||
size_t const nbBlocks = (1 << 15) + 1;
|
||||
size_t blockNb;
|
||||
size_t const outCapacity = 1 << 18; // large margin
|
||||
char* const outBuffer = malloc (outCapacity);
|
||||
ZSTD_outBuffer out = { outBuffer, outCapacity, 0 };
|
||||
ZSTD_CCtx* const cctx = ZSTD_createCCtx();
|
||||
assert(cctx);
|
||||
assert(outBuffer);
|
||||
CHECK_Z( ZSTD_initCStream(cctx, 0) );
|
||||
for (blockNb=0; blockNb<nbBlocks; blockNb++) {
|
||||
ZSTD_inBuffer in = { input, sizeof(input), 0 };
|
||||
CHECK_Z( ZSTD_compressStream(cctx, &out, &in) );
|
||||
CHECK_EQ( ZSTD_flushStream(cctx, &out), 0 );
|
||||
}
|
||||
CHECK_EQ( ZSTD_endStream(cctx, &out), 0 );
|
||||
CHECK( ZSTD_decompressBound(outBuffer, out.pos) > 0x100000000LLU /* 4 GB */ );
|
||||
ZSTD_freeCCtx(cctx);
|
||||
free(outBuffer);
|
||||
}
|
||||
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
}
|
||||
|
||||
static void test_setCParams(unsigned tnb)
|
||||
{
|
||||
ZSTD_CCtx* const cctx = ZSTD_createCCtx();
|
||||
ZSTD_compressionParameters cparams;
|
||||
assert(cctx);
|
||||
|
||||
DISPLAYLEVEL(3, "test%3u : ZSTD_CCtx_setCParams : ", tnb);
|
||||
|
||||
/* valid cparams */
|
||||
cparams = ZSTD_getCParams(1, 0, 0);
|
||||
CHECK_Z(ZSTD_CCtx_setCParams(cctx, cparams));
|
||||
|
||||
/* invalid cparams (must fail) */
|
||||
cparams.windowLog = 99;
|
||||
CHECK(ZSTD_isError(ZSTD_CCtx_setCParams(cctx, cparams)));
|
||||
|
||||
free(cctx);
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
}
|
||||
|
||||
static int basicUnitTests(U32 const seed, double compressibility)
|
||||
{
|
||||
size_t const CNBuffSize = 5 MB;
|
||||
@ -507,6 +604,12 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
DISPLAYLEVEL(3, "%u (OK) \n", vn);
|
||||
}
|
||||
|
||||
test_compressBound(testNb++);
|
||||
|
||||
test_decompressBound(testNb++);
|
||||
|
||||
test_setCParams(testNb++);
|
||||
|
||||
DISPLAYLEVEL(3, "test%3u : ZSTD_adjustCParams : ", testNb++);
|
||||
{
|
||||
ZSTD_compressionParameters params;
|
||||
@ -1579,7 +1682,7 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
|
||||
DISPLAYLEVEL(3, "test%3i : init CCtx for small level %u (should work again) : ", testNb++, 1);
|
||||
CHECK( ZSTD_compressBegin(staticCCtx, 1) );
|
||||
CHECK_Z( ZSTD_compressBegin(staticCCtx, 1) );
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
|
||||
DISPLAYLEVEL(3, "test%3i : use CStream on CCtx-sized static context (should fail) : ", testNb++);
|
||||
@ -1647,8 +1750,8 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
testResult = 1;
|
||||
goto _end;
|
||||
}
|
||||
CHECK( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_nbWorkers, 2) );
|
||||
CHECK( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_compressionLevel, 1) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_nbWorkers, 2) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_compressionLevel, 1) );
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
|
||||
DISPLAYLEVEL(3, "test%3u : compress %u bytes with 2 threads : ", testNb++, (unsigned)CNBuffSize);
|
||||
@ -1678,9 +1781,9 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
|
||||
DISPLAYLEVEL(3, "test%3i : compress -T2 with checksum : ", testNb++);
|
||||
CHECK( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_checksumFlag, 1) );
|
||||
CHECK( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_contentSizeFlag, 1) );
|
||||
CHECK( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_overlapLog, 3) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_checksumFlag, 1) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_contentSizeFlag, 1) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_overlapLog, 3) );
|
||||
CHECK_VAR(cSize, ZSTD_compress2(mtctx,
|
||||
compressedBuffer, compressedBufferSize,
|
||||
CNBuffer, CNBuffSize) );
|
||||
@ -1699,11 +1802,11 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
ZSTD_DCtx* const dctx = ZSTD_createDCtx();
|
||||
char out[32];
|
||||
if (cctx == NULL || dctx == NULL) goto _output_error;
|
||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_contentSizeFlag, 0) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_contentSizeFlag, 0) );
|
||||
CHECK_VAR(cSize, ZSTD_compress2(cctx, out, sizeof(out), NULL, 0) );
|
||||
DISPLAYLEVEL(3, "OK (%u bytes)\n", (unsigned)cSize);
|
||||
|
||||
CHECK( ZSTD_DCtx_setParameter(dctx, ZSTD_d_windowLogMax, 10) );
|
||||
CHECK_Z( ZSTD_DCtx_setParameter(dctx, ZSTD_d_windowLogMax, 10) );
|
||||
{ char const* outPtr = out;
|
||||
ZSTD_inBuffer inBuffer = { outPtr, cSize, 0 };
|
||||
ZSTD_outBuffer outBuffer = { NULL, 0, 0 };
|
||||
@ -1718,9 +1821,9 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
|
||||
DISPLAYLEVEL(3, "test%3i : compress with block splitting : ", testNb++)
|
||||
{ ZSTD_CCtx* cctx = ZSTD_createCCtx();
|
||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_useBlockSplitter, ZSTD_ps_enable) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_useBlockSplitter, ZSTD_ps_enable) );
|
||||
cSize = ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize, CNBuffer, CNBuffSize);
|
||||
CHECK(cSize);
|
||||
CHECK_Z(cSize);
|
||||
ZSTD_freeCCtx(cctx);
|
||||
}
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
@ -1728,13 +1831,13 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
DISPLAYLEVEL(3, "test%3i : compress -T2 with/without literals compression : ", testNb++)
|
||||
{ ZSTD_CCtx* cctx = ZSTD_createCCtx();
|
||||
size_t cSize1, cSize2;
|
||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 1) );
|
||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, 2) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 1) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, 2) );
|
||||
cSize1 = ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize, CNBuffer, CNBuffSize);
|
||||
CHECK(cSize1);
|
||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_literalCompressionMode, ZSTD_ps_disable) );
|
||||
CHECK_Z(cSize1);
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_literalCompressionMode, ZSTD_ps_disable) );
|
||||
cSize2 = ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize, CNBuffer, CNBuffSize);
|
||||
CHECK(cSize2);
|
||||
CHECK_Z(cSize2);
|
||||
CHECK_LT(cSize1, cSize2);
|
||||
ZSTD_freeCCtx(cctx);
|
||||
}
|
||||
@ -1745,10 +1848,10 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
/* Set rsyncable and don't give the ZSTD_compressBound(CNBuffSize) so
|
||||
* ZSTDMT is forced to not take the shortcut.
|
||||
*/
|
||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 1) );
|
||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, 1) );
|
||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_rsyncable, 1) );
|
||||
CHECK( ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize - 1, CNBuffer, CNBuffSize) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 1) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, 1) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_rsyncable, 1) );
|
||||
CHECK_Z( ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize - 1, CNBuffer, CNBuffSize) );
|
||||
ZSTD_freeCCtx(cctx);
|
||||
}
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
@ -1758,22 +1861,22 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
int const jobSize = 512 KB;
|
||||
int value;
|
||||
/* Check that the overlap log and job size are unset. */
|
||||
CHECK( ZSTD_CCtxParams_getParameter(params, ZSTD_c_overlapLog, &value) );
|
||||
CHECK_Z( ZSTD_CCtxParams_getParameter(params, ZSTD_c_overlapLog, &value) );
|
||||
CHECK_EQ(value, 0);
|
||||
CHECK( ZSTD_CCtxParams_getParameter(params, ZSTD_c_jobSize, &value) );
|
||||
CHECK_Z( ZSTD_CCtxParams_getParameter(params, ZSTD_c_jobSize, &value) );
|
||||
CHECK_EQ(value, 0);
|
||||
/* Set and check the overlap log and job size. */
|
||||
CHECK( ZSTD_CCtxParams_setParameter(params, ZSTD_c_overlapLog, 5) );
|
||||
CHECK( ZSTD_CCtxParams_setParameter(params, ZSTD_c_jobSize, jobSize) );
|
||||
CHECK( ZSTD_CCtxParams_getParameter(params, ZSTD_c_overlapLog, &value) );
|
||||
CHECK_Z( ZSTD_CCtxParams_setParameter(params, ZSTD_c_overlapLog, 5) );
|
||||
CHECK_Z( ZSTD_CCtxParams_setParameter(params, ZSTD_c_jobSize, jobSize) );
|
||||
CHECK_Z( ZSTD_CCtxParams_getParameter(params, ZSTD_c_overlapLog, &value) );
|
||||
CHECK_EQ(value, 5);
|
||||
CHECK( ZSTD_CCtxParams_getParameter(params, ZSTD_c_jobSize, &value) );
|
||||
CHECK_Z( ZSTD_CCtxParams_getParameter(params, ZSTD_c_jobSize, &value) );
|
||||
CHECK_EQ(value, jobSize);
|
||||
/* Set the number of workers and check the overlap log and job size. */
|
||||
CHECK( ZSTD_CCtxParams_setParameter(params, ZSTD_c_nbWorkers, 2) );
|
||||
CHECK( ZSTD_CCtxParams_getParameter(params, ZSTD_c_overlapLog, &value) );
|
||||
CHECK_Z( ZSTD_CCtxParams_setParameter(params, ZSTD_c_nbWorkers, 2) );
|
||||
CHECK_Z( ZSTD_CCtxParams_getParameter(params, ZSTD_c_overlapLog, &value) );
|
||||
CHECK_EQ(value, 5);
|
||||
CHECK( ZSTD_CCtxParams_getParameter(params, ZSTD_c_jobSize, &value) );
|
||||
CHECK_Z( ZSTD_CCtxParams_getParameter(params, ZSTD_c_jobSize, &value) );
|
||||
CHECK_EQ(value, jobSize);
|
||||
ZSTD_freeCCtxParams(params);
|
||||
}
|
||||
@ -1884,8 +1987,8 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
|
||||
DISPLAYLEVEL(3, "test%3i : load dictionary into context : ", testNb++);
|
||||
CHECK( ZSTD_compressBegin_usingDict(ctxOrig, CNBuffer, dictSize, 2) );
|
||||
CHECK( ZSTD_copyCCtx(ctxDuplicated, ctxOrig, 0) ); /* Begin_usingDict implies unknown srcSize, so match that */
|
||||
CHECK_Z( ZSTD_compressBegin_usingDict(ctxOrig, CNBuffer, dictSize, 2) );
|
||||
CHECK_Z( ZSTD_copyCCtx(ctxDuplicated, ctxOrig, 0) ); /* Begin_usingDict implies unknown srcSize, so match that */
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
|
||||
DISPLAYLEVEL(3, "test%3i : compress with flat dictionary : ", testNb++);
|
||||
@ -1945,8 +2048,8 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
|
||||
DISPLAYLEVEL(3, "test%3i : check content size on duplicated context : ", testNb++);
|
||||
{ size_t const testSize = CNBuffSize / 3;
|
||||
CHECK( ZSTD_compressBegin(ctxOrig, ZSTD_defaultCLevel()) );
|
||||
CHECK( ZSTD_copyCCtx(ctxDuplicated, ctxOrig, testSize) );
|
||||
CHECK_Z( ZSTD_compressBegin(ctxOrig, ZSTD_defaultCLevel()) );
|
||||
CHECK_Z( ZSTD_copyCCtx(ctxDuplicated, ctxOrig, testSize) );
|
||||
|
||||
CHECK_VAR(cSize, ZSTD_compressEnd(ctxDuplicated, compressedBuffer, ZSTD_compressBound(testSize),
|
||||
(const char*)CNBuffer + dictSize, testSize) );
|
||||
@ -2780,7 +2883,7 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
size_t const wrongSrcSize = (srcSize + 1000);
|
||||
ZSTD_parameters params = ZSTD_getParams(1, wrongSrcSize, 0);
|
||||
params.fParams.contentSizeFlag = 1;
|
||||
CHECK( ZSTD_compressBegin_advanced(cctx, NULL, 0, params, wrongSrcSize) );
|
||||
CHECK_Z( ZSTD_compressBegin_advanced(cctx, NULL, 0, params, wrongSrcSize) );
|
||||
{ size_t const result = ZSTD_compressEnd(cctx, decodedBuffer, CNBuffSize, CNBuffer, srcSize);
|
||||
if (!ZSTD_isError(result)) goto _output_error;
|
||||
if (ZSTD_getErrorCode(result) != ZSTD_error_srcSize_wrong) goto _output_error;
|
||||
@ -2800,7 +2903,7 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
CNBuffer, srcSize, compressionLevel);
|
||||
if (ZSTD_isError(cSize_1pass)) goto _output_error;
|
||||
|
||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, compressionLevel) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, compressionLevel) );
|
||||
{ size_t const compressionResult = ZSTD_compress2(cctx,
|
||||
compressedBuffer, compressedBufferSize,
|
||||
CNBuffer, srcSize);
|
||||
@ -2819,13 +2922,13 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
{ ZSTD_CCtx* const cctx = ZSTD_createCCtx();
|
||||
DISPLAYLEVEL(3, "test%3i : parameters in order : ", testNb++);
|
||||
assert(cctx != NULL);
|
||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 2) );
|
||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_enableLongDistanceMatching, ZSTD_ps_enable) );
|
||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_windowLog, 18) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 2) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_enableLongDistanceMatching, ZSTD_ps_enable) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_windowLog, 18) );
|
||||
{ size_t const compressedSize = ZSTD_compress2(cctx,
|
||||
compressedBuffer, ZSTD_compressBound(inputSize),
|
||||
CNBuffer, inputSize);
|
||||
CHECK(compressedSize);
|
||||
CHECK_Z(compressedSize);
|
||||
cSize = compressedSize;
|
||||
xxh64 = XXH64(compressedBuffer, compressedSize, 0);
|
||||
}
|
||||
@ -2835,13 +2938,13 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
|
||||
{ ZSTD_CCtx* cctx = ZSTD_createCCtx();
|
||||
DISPLAYLEVEL(3, "test%3i : parameters disordered : ", testNb++);
|
||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_windowLog, 18) );
|
||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_enableLongDistanceMatching, ZSTD_ps_enable) );
|
||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 2) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_windowLog, 18) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_enableLongDistanceMatching, ZSTD_ps_enable) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 2) );
|
||||
{ size_t const result = ZSTD_compress2(cctx,
|
||||
compressedBuffer, ZSTD_compressBound(inputSize),
|
||||
CNBuffer, inputSize);
|
||||
CHECK(result);
|
||||
CHECK_Z(result);
|
||||
if (result != cSize) goto _output_error; /* must result in same compressed result, hence same size */
|
||||
if (XXH64(compressedBuffer, result, 0) != xxh64) goto _output_error; /* must result in exactly same content, hence same hash */
|
||||
DISPLAYLEVEL(3, "OK (compress : %u -> %u bytes)\n", (unsigned)inputSize, (unsigned)result);
|
||||
@ -2856,7 +2959,7 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
|
||||
DISPLAYLEVEL(3, "test%3i : get dParameter bounds ", testNb++);
|
||||
{ ZSTD_bounds const bounds = ZSTD_dParam_getBounds(ZSTD_d_windowLogMax);
|
||||
CHECK(bounds.error);
|
||||
CHECK_Z(bounds.error);
|
||||
}
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
|
||||
@ -2890,7 +2993,7 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
|
||||
/* basic block compression */
|
||||
DISPLAYLEVEL(3, "test%3i : magic-less format test : ", testNb++);
|
||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_format, ZSTD_f_zstd1_magicless) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_format, ZSTD_f_zstd1_magicless) );
|
||||
{ ZSTD_inBuffer in = { CNBuffer, inputSize, 0 };
|
||||
ZSTD_outBuffer out = { compressedBuffer, ZSTD_compressBound(inputSize), 0 };
|
||||
size_t const result = ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_end);
|
||||
@ -2908,7 +3011,7 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
|
||||
DISPLAYLEVEL(3, "test%3i : decompress of magic-less frame : ", testNb++);
|
||||
ZSTD_DCtx_reset(dctx, ZSTD_reset_session_and_parameters);
|
||||
CHECK( ZSTD_DCtx_setParameter(dctx, ZSTD_d_format, ZSTD_f_zstd1_magicless) );
|
||||
CHECK_Z( ZSTD_DCtx_setParameter(dctx, ZSTD_d_format, ZSTD_f_zstd1_magicless) );
|
||||
{ ZSTD_frameHeader zfh;
|
||||
size_t const zfhrt = ZSTD_getFrameHeader_advanced(&zfh, compressedBuffer, cSize, ZSTD_f_zstd1_magicless);
|
||||
if (zfhrt != 0) goto _output_error;
|
||||
@ -2930,7 +3033,7 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
|
||||
/* basic block compression */
|
||||
DISPLAYLEVEL(3, "test%3i : empty magic-less format test : ", testNb++);
|
||||
CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_format, ZSTD_f_zstd1_magicless) );
|
||||
CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_format, ZSTD_f_zstd1_magicless) );
|
||||
{ ZSTD_inBuffer in = { CNBuffer, 0, 0 };
|
||||
ZSTD_outBuffer out = { compressedBuffer, ZSTD_compressBound(0), 0 };
|
||||
size_t const result = ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_end);
|
||||
@ -2942,7 +3045,7 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
|
||||
DISPLAYLEVEL(3, "test%3i : decompress of empty magic-less frame : ", testNb++);
|
||||
ZSTD_DCtx_reset(dctx, ZSTD_reset_session_and_parameters);
|
||||
CHECK( ZSTD_DCtx_setParameter(dctx, ZSTD_d_format, ZSTD_f_zstd1_magicless) );
|
||||
CHECK_Z( ZSTD_DCtx_setParameter(dctx, ZSTD_d_format, ZSTD_f_zstd1_magicless) );
|
||||
/* one shot */
|
||||
{ size_t const result = ZSTD_decompressDCtx(dctx, decodedBuffer, CNBuffSize, compressedBuffer, cSize);
|
||||
if (result != 0) goto _output_error;
|
||||
@ -2977,13 +3080,13 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
int check;
|
||||
if (ZSTD_isError(bounds.error))
|
||||
continue;
|
||||
CHECK(ZSTD_DCtx_getParameter(dctx, dParam, &value1));
|
||||
CHECK_Z(ZSTD_DCtx_getParameter(dctx, dParam, &value1));
|
||||
value2 = (value1 != bounds.lowerBound) ? bounds.lowerBound : bounds.upperBound;
|
||||
CHECK(ZSTD_DCtx_setParameter(dctx, dParam, value2));
|
||||
CHECK(ZSTD_DCtx_getParameter(dctx, dParam, &check));
|
||||
CHECK_Z(ZSTD_DCtx_setParameter(dctx, dParam, value2));
|
||||
CHECK_Z(ZSTD_DCtx_getParameter(dctx, dParam, &check));
|
||||
if (check != value2) goto _output_error;
|
||||
CHECK(ZSTD_DCtx_reset(dctx, ZSTD_reset_parameters));
|
||||
CHECK(ZSTD_DCtx_getParameter(dctx, dParam, &check));
|
||||
CHECK_Z(ZSTD_DCtx_reset(dctx, ZSTD_reset_parameters));
|
||||
CHECK_Z(ZSTD_DCtx_getParameter(dctx, dParam, &check));
|
||||
if (check != value1) goto _output_error;
|
||||
}
|
||||
ZSTD_freeDCtx(dctx);
|
||||
@ -3000,21 +3103,21 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
|
||||
/* basic block compression */
|
||||
DISPLAYLEVEL(3, "test%3i : Block compression test : ", testNb++);
|
||||
CHECK( ZSTD_compressBegin(cctx, 5) );
|
||||
CHECK( ZSTD_getBlockSize(cctx) >= blockSize);
|
||||
CHECK_Z( ZSTD_compressBegin(cctx, 5) );
|
||||
CHECK_Z( ZSTD_getBlockSize(cctx) >= blockSize);
|
||||
CHECK_VAR(cSize, ZSTD_compressBlock(cctx, compressedBuffer, ZSTD_compressBound(blockSize), CNBuffer, blockSize) );
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
|
||||
DISPLAYLEVEL(3, "test%3i : Block decompression test : ", testNb++);
|
||||
CHECK( ZSTD_decompressBegin(dctx) );
|
||||
CHECK_Z( ZSTD_decompressBegin(dctx) );
|
||||
{ CHECK_NEWV(r, ZSTD_decompressBlock(dctx, decodedBuffer, CNBuffSize, compressedBuffer, cSize) );
|
||||
if (r != blockSize) goto _output_error; }
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
|
||||
/* very long stream of block compression */
|
||||
DISPLAYLEVEL(3, "test%3i : Huge block streaming compression test : ", testNb++);
|
||||
CHECK( ZSTD_compressBegin(cctx, -199) ); /* we just want to quickly overflow internal U32 index */
|
||||
CHECK( ZSTD_getBlockSize(cctx) >= blockSize);
|
||||
CHECK_Z( ZSTD_compressBegin(cctx, -199) ); /* we just want to quickly overflow internal U32 index */
|
||||
CHECK_Z( ZSTD_getBlockSize(cctx) >= blockSize);
|
||||
{ U64 const toCompress = 5000000000ULL; /* > 4 GB */
|
||||
U64 compressed = 0;
|
||||
while (compressed < toCompress) {
|
||||
@ -3027,7 +3130,7 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
|
||||
/* dictionary block compression */
|
||||
DISPLAYLEVEL(3, "test%3i : Dictionary Block compression test : ", testNb++);
|
||||
CHECK( ZSTD_compressBegin_usingDict(cctx, CNBuffer, dictSize, 5) );
|
||||
CHECK_Z( ZSTD_compressBegin_usingDict(cctx, CNBuffer, dictSize, 5) );
|
||||
CHECK_VAR(cSize, ZSTD_compressBlock(cctx, compressedBuffer, ZSTD_compressBound(blockSize), (char*)CNBuffer+dictSize, blockSize));
|
||||
RDG_genBuffer((char*)CNBuffer+dictSize+blockSize, blockSize, 0.0, 0.0, seed); /* create a non-compressible second block */
|
||||
{ CHECK_NEWV(r, ZSTD_compressBlock(cctx, (char*)compressedBuffer+cSize, ZSTD_compressBound(blockSize), (char*)CNBuffer+dictSize+blockSize, blockSize) ); /* for cctx history consistency */
|
||||
@ -3038,7 +3141,7 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
|
||||
DISPLAYLEVEL(3, "test%3i : Dictionary Block decompression test : ", testNb++);
|
||||
CHECK( ZSTD_decompressBegin_usingDict(dctx, CNBuffer, dictSize) );
|
||||
CHECK_Z( ZSTD_decompressBegin_usingDict(dctx, CNBuffer, dictSize) );
|
||||
{ CHECK_NEWV( r, ZSTD_decompressBlock(dctx, decodedBuffer, blockSize, compressedBuffer, cSize) );
|
||||
if (r != blockSize) {
|
||||
DISPLAYLEVEL(1, "ZSTD_decompressBlock() with _usingDict() fails : %u, instead of %u expected \n", (unsigned)r, (unsigned)blockSize);
|
||||
@ -3057,8 +3160,8 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
DISPLAYLEVEL(3, "test%3i : Block compression with CDict : ", testNb++);
|
||||
{ ZSTD_CDict* const cdict = ZSTD_createCDict(CNBuffer, dictSize, 3);
|
||||
if (cdict==NULL) goto _output_error;
|
||||
CHECK( ZSTD_compressBegin_usingCDict(cctx, cdict) );
|
||||
CHECK( ZSTD_compressBlock(cctx, compressedBuffer, ZSTD_compressBound(blockSize), (char*)CNBuffer+dictSize, blockSize) );
|
||||
CHECK_Z( ZSTD_compressBegin_usingCDict(cctx, cdict) );
|
||||
CHECK_Z( ZSTD_compressBlock(cctx, compressedBuffer, ZSTD_compressBound(blockSize), (char*)CNBuffer+dictSize, blockSize) );
|
||||
ZSTD_freeCDict(cdict);
|
||||
}
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
@ -3227,7 +3330,7 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
size_t const bound = ZSTD_compressBound(_3BYTESTESTLENGTH);
|
||||
size_t nbSeq = 1;
|
||||
while (nbSeq <= maxNbSeq) {
|
||||
CHECK(ZSTD_compressCCtx(cctx, compressedBuffer, bound, CNBuffer, nbSeq * 3, 19));
|
||||
CHECK_Z(ZSTD_compressCCtx(cctx, compressedBuffer, bound, CNBuffer, nbSeq * 3, 19));
|
||||
/* Check every sequence for the first 100, then skip more rapidly. */
|
||||
if (nbSeq < 100) {
|
||||
++nbSeq;
|
||||
@ -3256,7 +3359,7 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
size_t const bound = ZSTD_compressBound(CNBuffSize);
|
||||
size_t size = 1;
|
||||
while (size <= CNBuffSize) {
|
||||
CHECK(ZSTD_compressCCtx(cctx, compressedBuffer, bound, CNBuffer, size, 3));
|
||||
CHECK_Z(ZSTD_compressCCtx(cctx, compressedBuffer, bound, CNBuffer, size, 3));
|
||||
/* Check every size for the first 100, then skip more rapidly. */
|
||||
if (size < 100) {
|
||||
++size;
|
||||
@ -3291,7 +3394,7 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
void* const outputBuffer = malloc(outputSize);
|
||||
ZSTD_CCtx* const cctx = ZSTD_createCCtx();
|
||||
if (!outputBuffer || !cctx) goto _output_error;
|
||||
CHECK(ZSTD_compress_usingDict(cctx, outputBuffer, outputSize, CNBuffer, inputSize, dictBuffer, dictSize, 1));
|
||||
CHECK_Z(ZSTD_compress_usingDict(cctx, outputBuffer, outputSize, CNBuffer, inputSize, dictBuffer, dictSize, 1));
|
||||
free(outputBuffer);
|
||||
ZSTD_freeCCtx(cctx);
|
||||
}
|
||||
@ -3628,7 +3731,7 @@ static int longUnitTests(U32 const seed, double compressibility)
|
||||
while (approxIndex <= (maxIndex / 4) * 3) {
|
||||
CHECK_Z(ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_flush));
|
||||
approxIndex += in.pos;
|
||||
CHECK(in.pos == in.size);
|
||||
CHECK_Z(in.pos == in.size);
|
||||
in.pos = 0;
|
||||
out.pos = 0;
|
||||
}
|
||||
@ -3654,7 +3757,7 @@ static int longUnitTests(U32 const seed, double compressibility)
|
||||
while (approxIndex <= maxIndex) {
|
||||
CHECK_Z(ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_flush));
|
||||
approxIndex += in.pos;
|
||||
CHECK(in.pos == in.size);
|
||||
CHECK_Z(in.pos == in.size);
|
||||
in.pos = 0;
|
||||
out.pos = 0;
|
||||
}
|
||||
@ -3737,7 +3840,7 @@ static int longUnitTests(U32 const seed, double compressibility)
|
||||
RDG_genBuffer(dict, dictSize, 0.5, 0.5, seed);
|
||||
RDG_genBuffer(CNBuffer, CNBuffSize, 0.6, 0.6, seed);
|
||||
|
||||
CHECK(cctx_params != NULL);
|
||||
CHECK_Z(cctx_params != NULL);
|
||||
|
||||
for (dictSize = CNBuffSize; dictSize; dictSize = dictSize >> 3) {
|
||||
DISPLAYLEVEL(3, "\n Testing with dictSize %u ", (U32)dictSize);
|
||||
@ -3780,11 +3883,6 @@ _end:
|
||||
free(compressedBuffer);
|
||||
free(decodedBuffer);
|
||||
return testResult;
|
||||
|
||||
_output_error:
|
||||
testResult = 1;
|
||||
DISPLAY("Error detected in Unit tests ! \n");
|
||||
goto _end;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ################################################################
|
||||
# Copyright (c) Facebook, Inc.
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
@ -36,27 +36,27 @@ compress(ZSTD_CStream *ctx, ZSTD_outBuffer out, const void *data, size_t size)
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
ZSTD_CStream* ctx;
|
||||
ZSTD_parameters params;
|
||||
size_t rc;
|
||||
unsigned windowLog;
|
||||
unsigned windowLog = 18;
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
/* Create stream */
|
||||
ctx = ZSTD_createCStream();
|
||||
ctx = ZSTD_createCCtx();
|
||||
if (!ctx) { return 1; }
|
||||
/* Set parameters */
|
||||
memset(¶ms, 0, sizeof(params));
|
||||
params.cParams.windowLog = 18;
|
||||
params.cParams.chainLog = 13;
|
||||
params.cParams.hashLog = 14;
|
||||
params.cParams.searchLog = 1;
|
||||
params.cParams.minMatch = 7;
|
||||
params.cParams.targetLength = 16;
|
||||
params.cParams.strategy = ZSTD_fast;
|
||||
windowLog = params.cParams.windowLog;
|
||||
/* Initialize stream */
|
||||
rc = ZSTD_initCStream_advanced(ctx, NULL, 0, params, 0);
|
||||
if (ZSTD_isError(rc)) { return 2; }
|
||||
if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_windowLog, windowLog)))
|
||||
return 2;
|
||||
if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_chainLog, 13)))
|
||||
return 2;
|
||||
if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_hashLog, 14)))
|
||||
return 2;
|
||||
if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_searchLog, 1)))
|
||||
return 2;
|
||||
if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_minMatch, 7)))
|
||||
return 2;
|
||||
if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_targetLength, 16)))
|
||||
return 2;
|
||||
if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_strategy, ZSTD_fast)))
|
||||
return 2;
|
||||
{
|
||||
U64 compressed = 0;
|
||||
const U64 toCompress = ((U64)1) << 33;
|
||||
@ -97,5 +97,6 @@ int main(int argc, const char** argv)
|
||||
free(srcBuffer);
|
||||
free(dstBuffer);
|
||||
}
|
||||
ZSTD_freeCCtx(ctx);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
@ -566,10 +566,10 @@ resultScore(const BMK_benchResult_t res, const size_t srcSize, const constraint_
|
||||
double cs = 0., ds = 0., rt, cm = 0.;
|
||||
const double r1 = 1, r2 = 0.1, rtr = 0.5;
|
||||
double ret;
|
||||
if(target.cSpeed) { cs = res.cSpeed / (double)target.cSpeed; }
|
||||
if(target.dSpeed) { ds = res.dSpeed / (double)target.dSpeed; }
|
||||
if(target.cMem != (U32)-1) { cm = (double)target.cMem / res.cMem; }
|
||||
rt = ((double)srcSize / res.cSize);
|
||||
if(target.cSpeed) { cs = (double)res.cSpeed / (double)target.cSpeed; }
|
||||
if(target.dSpeed) { ds = (double)res.dSpeed / (double)target.dSpeed; }
|
||||
if(target.cMem != (U32)-1) { cm = (double)target.cMem / (double)res.cMem; }
|
||||
rt = ((double)srcSize / (double)res.cSize);
|
||||
|
||||
ret = (MIN(1, cs) + MIN(1, ds) + MIN(1, cm))*r1 + rt * rtr +
|
||||
(MAX(0, log(cs))+ MAX(0, log(ds))+ MAX(0, log(cm))) * r2;
|
||||
@ -581,8 +581,8 @@ resultScore(const BMK_benchResult_t res, const size_t srcSize, const constraint_
|
||||
static double
|
||||
resultDistLvl(const BMK_benchResult_t result1, const BMK_benchResult_t lvlRes)
|
||||
{
|
||||
double normalizedCSpeedGain1 = ((double)result1.cSpeed / lvlRes.cSpeed) - 1;
|
||||
double normalizedRatioGain1 = ((double)lvlRes.cSize / result1.cSize) - 1;
|
||||
double normalizedCSpeedGain1 = ((double)result1.cSpeed / (double)lvlRes.cSpeed) - 1;
|
||||
double normalizedRatioGain1 = ((double)lvlRes.cSize / (double)result1.cSize) - 1;
|
||||
if(normalizedRatioGain1 < 0 || normalizedCSpeedGain1 < 0) {
|
||||
return 0.0;
|
||||
}
|
||||
@ -854,7 +854,7 @@ BMK_displayOneResult(FILE* f, winnerInfo_t res, const size_t srcSize)
|
||||
}
|
||||
|
||||
{ double const ratio = res.result.cSize ?
|
||||
(double)srcSize / res.result.cSize : 0;
|
||||
(double)srcSize / (double)res.result.cSize : 0;
|
||||
double const cSpeedMBps = (double)res.result.cSpeed / MB_UNIT;
|
||||
double const dSpeedMBps = (double)res.result.dSpeed / MB_UNIT;
|
||||
|
||||
@ -937,7 +937,7 @@ BMK_printWinnerOpt(FILE* f, const U32 cLevel, const BMK_benchResult_t result, co
|
||||
}
|
||||
fprintf(f, "================================\n");
|
||||
fprintf(f, "Level Bounds: R: > %.3f AND C: < %.1f MB/s \n\n",
|
||||
(double)srcSize / g_lvltarget.cSize, (double)g_lvltarget.cSpeed / MB_UNIT);
|
||||
(double)srcSize / (double)g_lvltarget.cSize, (double)g_lvltarget.cSpeed / MB_UNIT);
|
||||
|
||||
|
||||
fprintf(f, "Overall Winner: \n");
|
||||
@ -977,7 +977,7 @@ BMK_print_cLevelEntry(FILE* f, const int cLevel,
|
||||
}
|
||||
/* print comment */
|
||||
{ double const ratio = result.cSize ?
|
||||
(double)srcSize / result.cSize : 0;
|
||||
(double)srcSize / (double)result.cSize : 0;
|
||||
double const cSpeedMBps = (double)result.cSpeed / MB_UNIT;
|
||||
double const dSpeedMBps = (double)result.dSpeed / MB_UNIT;
|
||||
|
||||
@ -1726,19 +1726,19 @@ static int allBench(BMK_benchResult_t* resultPtr,
|
||||
|
||||
/* calculate uncertainty in compression / decompression runs */
|
||||
if (benchres.cSpeed) {
|
||||
U64 const loopDurationC = (((U64)buf.srcSize * TIMELOOP_NANOSEC) / benchres.cSpeed);
|
||||
double const loopDurationC = (double)(((U64)buf.srcSize * TIMELOOP_NANOSEC) / benchres.cSpeed);
|
||||
uncertaintyConstantC = ((loopDurationC + (double)(2 * g_clockGranularity))/loopDurationC);
|
||||
}
|
||||
|
||||
if (benchres.dSpeed) {
|
||||
U64 const loopDurationD = (((U64)buf.srcSize * TIMELOOP_NANOSEC) / benchres.dSpeed);
|
||||
double const loopDurationD = (double)(((U64)buf.srcSize * TIMELOOP_NANOSEC) / benchres.dSpeed);
|
||||
uncertaintyConstantD = ((loopDurationD + (double)(2 * g_clockGranularity))/loopDurationD);
|
||||
}
|
||||
|
||||
/* optimistic assumption of benchres */
|
||||
{ BMK_benchResult_t resultMax = benchres;
|
||||
resultMax.cSpeed = (unsigned long long)(resultMax.cSpeed * uncertaintyConstantC * VARIANCE);
|
||||
resultMax.dSpeed = (unsigned long long)(resultMax.dSpeed * uncertaintyConstantD * VARIANCE);
|
||||
resultMax.cSpeed = (unsigned long long)((double)resultMax.cSpeed * uncertaintyConstantC * VARIANCE);
|
||||
resultMax.dSpeed = (unsigned long long)((double)resultMax.dSpeed * uncertaintyConstantD * VARIANCE);
|
||||
|
||||
/* disregard infeasible results in feas mode */
|
||||
/* disregard if resultMax < winner in infeas mode */
|
||||
@ -1850,8 +1850,8 @@ static int BMK_seed(winnerInfo_t* winners,
|
||||
|
||||
if ((double)testResult.cSize <= ((double)winners[cLevel].result.cSize * (1. + (0.02 / cLevel))) ) {
|
||||
/* Validate solution is "good enough" */
|
||||
double W_ratio = (double)buf.srcSize / testResult.cSize;
|
||||
double O_ratio = (double)buf.srcSize / winners[cLevel].result.cSize;
|
||||
double W_ratio = (double)buf.srcSize / (double)testResult.cSize;
|
||||
double O_ratio = (double)buf.srcSize / (double)winners[cLevel].result.cSize;
|
||||
double W_ratioNote = log (W_ratio);
|
||||
double O_ratioNote = log (O_ratio);
|
||||
size_t W_DMemUsed = (1 << params.vals[wlog_ind]) + (16 KB);
|
||||
@ -1864,11 +1864,11 @@ static int BMK_seed(winnerInfo_t* winners,
|
||||
double W_CMemUsed_note = W_ratioNote * ( 50 + 13*cLevel) - log((double)W_CMemUsed);
|
||||
double O_CMemUsed_note = O_ratioNote * ( 50 + 13*cLevel) - log((double)O_CMemUsed);
|
||||
|
||||
double W_CSpeed_note = W_ratioNote * (double)( 30 + 10*cLevel) + log(testResult.cSpeed);
|
||||
double O_CSpeed_note = O_ratioNote * (double)( 30 + 10*cLevel) + log(winners[cLevel].result.cSpeed);
|
||||
double W_CSpeed_note = W_ratioNote * (double)( 30 + 10*cLevel) + log((double)testResult.cSpeed);
|
||||
double O_CSpeed_note = O_ratioNote * (double)( 30 + 10*cLevel) + log((double)winners[cLevel].result.cSpeed);
|
||||
|
||||
double W_DSpeed_note = W_ratioNote * (double)( 20 + 2*cLevel) + log(testResult.dSpeed);
|
||||
double O_DSpeed_note = O_ratioNote * (double)( 20 + 2*cLevel) + log(winners[cLevel].result.dSpeed);
|
||||
double W_DSpeed_note = W_ratioNote * (double)( 20 + 2*cLevel) + log((double)testResult.dSpeed);
|
||||
double O_DSpeed_note = O_ratioNote * (double)( 20 + 2*cLevel) + log((double)winners[cLevel].result.dSpeed);
|
||||
|
||||
if (W_DMemUsed_note < O_DMemUsed_note) {
|
||||
/* uses too much Decompression memory for too little benefit */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# ################################################################
|
||||
# Copyright (c) Facebook, Inc.
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ################################################################
|
||||
# Copyright (c) Facebook, Inc.
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -11,10 +11,10 @@ silesia.tar, level 6, compress
|
||||
silesia.tar, level 7, compress simple, 4576661
|
||||
silesia.tar, level 9, compress simple, 4552899
|
||||
silesia.tar, level 13, compress simple, 4502956
|
||||
silesia.tar, level 16, compress simple, 4360527
|
||||
silesia.tar, level 19, compress simple, 4266970
|
||||
silesia.tar, level 16, compress simple, 4360546
|
||||
silesia.tar, level 19, compress simple, 4265911
|
||||
silesia.tar, uncompressed literals, compress simple, 4854086
|
||||
silesia.tar, uncompressed literals optimal, compress simple, 4266970
|
||||
silesia.tar, uncompressed literals optimal, compress simple, 4265911
|
||||
silesia.tar, huffman literals, compress simple, 6179047
|
||||
github.tar, level -5, compress simple, 52115
|
||||
github.tar, level -3, compress simple, 45678
|
||||
@ -28,10 +28,10 @@ github.tar, level 6, compress
|
||||
github.tar, level 7, compress simple, 38110
|
||||
github.tar, level 9, compress simple, 36760
|
||||
github.tar, level 13, compress simple, 35501
|
||||
github.tar, level 16, compress simple, 40471
|
||||
github.tar, level 19, compress simple, 32149
|
||||
github.tar, level 16, compress simple, 40466
|
||||
github.tar, level 19, compress simple, 32276
|
||||
github.tar, uncompressed literals, compress simple, 38831
|
||||
github.tar, uncompressed literals optimal, compress simple, 32149
|
||||
github.tar, uncompressed literals optimal, compress simple, 32276
|
||||
github.tar, huffman literals, compress simple, 42560
|
||||
silesia, level -5, compress cctx, 6857372
|
||||
silesia, level -3, compress cctx, 6503412
|
||||
@ -45,8 +45,8 @@ silesia, level 6, compress
|
||||
silesia, level 7, compress cctx, 4566984
|
||||
silesia, level 9, compress cctx, 4543018
|
||||
silesia, level 13, compress cctx, 4493990
|
||||
silesia, level 16, compress cctx, 4359864
|
||||
silesia, level 19, compress cctx, 4296438
|
||||
silesia, level 16, compress cctx, 4360041
|
||||
silesia, level 19, compress cctx, 4296055
|
||||
silesia, long distance mode, compress cctx, 4842075
|
||||
silesia, multithreaded, compress cctx, 4842075
|
||||
silesia, multithreaded long distance mode, compress cctx, 4842075
|
||||
@ -55,7 +55,7 @@ silesia, small hash log, compress
|
||||
silesia, small chain log, compress cctx, 4912197
|
||||
silesia, explicit params, compress cctx, 4794052
|
||||
silesia, uncompressed literals, compress cctx, 4842075
|
||||
silesia, uncompressed literals optimal, compress cctx, 4296438
|
||||
silesia, uncompressed literals optimal, compress cctx, 4296055
|
||||
silesia, huffman literals, compress cctx, 6172202
|
||||
silesia, multithreaded with advanced params, compress cctx, 4842075
|
||||
github, level -5, compress cctx, 204407
|
||||
@ -80,11 +80,11 @@ github, level 7, compress
|
||||
github, level 7 with dict, compress cctx, 38755
|
||||
github, level 9, compress cctx, 135122
|
||||
github, level 9 with dict, compress cctx, 39398
|
||||
github, level 13, compress cctx, 132729
|
||||
github, level 13, compress cctx, 132878
|
||||
github, level 13 with dict, compress cctx, 39948
|
||||
github, level 16, compress cctx, 132729
|
||||
github, level 16, compress cctx, 133209
|
||||
github, level 16 with dict, compress cctx, 37568
|
||||
github, level 19, compress cctx, 132729
|
||||
github, level 19, compress cctx, 132879
|
||||
github, level 19 with dict, compress cctx, 37567
|
||||
github, long distance mode, compress cctx, 141069
|
||||
github, multithreaded, compress cctx, 141069
|
||||
@ -94,7 +94,7 @@ github, small hash log, compress
|
||||
github, small chain log, compress cctx, 139242
|
||||
github, explicit params, compress cctx, 140932
|
||||
github, uncompressed literals, compress cctx, 136332
|
||||
github, uncompressed literals optimal, compress cctx, 132729
|
||||
github, uncompressed literals optimal, compress cctx, 132879
|
||||
github, huffman literals, compress cctx, 175468
|
||||
github, multithreaded with advanced params, compress cctx, 141069
|
||||
silesia, level -5, zstdcli, 6857420
|
||||
@ -109,8 +109,8 @@ silesia, level 6, zstdcli,
|
||||
silesia, level 7, zstdcli, 4567032
|
||||
silesia, level 9, zstdcli, 4543066
|
||||
silesia, level 13, zstdcli, 4494038
|
||||
silesia, level 16, zstdcli, 4359912
|
||||
silesia, level 19, zstdcli, 4296486
|
||||
silesia, level 16, zstdcli, 4360089
|
||||
silesia, level 19, zstdcli, 4296103
|
||||
silesia, long distance mode, zstdcli, 4833785
|
||||
silesia, multithreaded, zstdcli, 4842123
|
||||
silesia, multithreaded long distance mode, zstdcli, 4833785
|
||||
@ -134,14 +134,14 @@ silesia.tar, level 6, zstdcli,
|
||||
silesia.tar, level 7, zstdcli, 4578719
|
||||
silesia.tar, level 9, zstdcli, 4552903
|
||||
silesia.tar, level 13, zstdcli, 4502960
|
||||
silesia.tar, level 16, zstdcli, 4360531
|
||||
silesia.tar, level 19, zstdcli, 4266974
|
||||
silesia.tar, level 16, zstdcli, 4360550
|
||||
silesia.tar, level 19, zstdcli, 4265915
|
||||
silesia.tar, no source size, zstdcli, 4854160
|
||||
silesia.tar, long distance mode, zstdcli, 4845745
|
||||
silesia.tar, multithreaded, zstdcli, 4854164
|
||||
silesia.tar, multithreaded long distance mode, zstdcli, 4845745
|
||||
silesia.tar, small window log, zstdcli, 7100701
|
||||
silesia.tar, small hash log, zstdcli, 6529289
|
||||
silesia.tar, small hash log, zstdcli, 6529264
|
||||
silesia.tar, small chain log, zstdcli, 4917022
|
||||
silesia.tar, explicit params, zstdcli, 4820713
|
||||
silesia.tar, uncompressed literals, zstdcli, 5122571
|
||||
@ -170,11 +170,11 @@ github, level 7, zstdcli,
|
||||
github, level 7 with dict, zstdcli, 40745
|
||||
github, level 9, zstdcli, 137122
|
||||
github, level 9 with dict, zstdcli, 41393
|
||||
github, level 13, zstdcli, 134729
|
||||
github, level 13, zstdcli, 134878
|
||||
github, level 13 with dict, zstdcli, 41900
|
||||
github, level 16, zstdcli, 134729
|
||||
github, level 16, zstdcli, 135209
|
||||
github, level 16 with dict, zstdcli, 39577
|
||||
github, level 19, zstdcli, 134729
|
||||
github, level 19, zstdcli, 134879
|
||||
github, level 19 with dict, zstdcli, 39576
|
||||
github, long distance mode, zstdcli, 138332
|
||||
github, multithreaded, zstdcli, 138332
|
||||
@ -184,7 +184,7 @@ github, small hash log, zstdcli,
|
||||
github, small chain log, zstdcli, 138341
|
||||
github, explicit params, zstdcli, 136197
|
||||
github, uncompressed literals, zstdcli, 167911
|
||||
github, uncompressed literals optimal, zstdcli, 159227
|
||||
github, uncompressed literals optimal, zstdcli, 154667
|
||||
github, huffman literals, zstdcli, 144365
|
||||
github, multithreaded with advanced params, zstdcli, 167911
|
||||
github.tar, level -5, zstdcli, 52119
|
||||
@ -211,9 +211,9 @@ github.tar, level 9, zstdcli,
|
||||
github.tar, level 9 with dict, zstdcli, 36632
|
||||
github.tar, level 13, zstdcli, 35505
|
||||
github.tar, level 13 with dict, zstdcli, 37134
|
||||
github.tar, level 16, zstdcli, 40475
|
||||
github.tar, level 16, zstdcli, 40470
|
||||
github.tar, level 16 with dict, zstdcli, 33378
|
||||
github.tar, level 19, zstdcli, 32153
|
||||
github.tar, level 19, zstdcli, 32280
|
||||
github.tar, level 19 with dict, zstdcli, 32716
|
||||
github.tar, no source size, zstdcli, 38832
|
||||
github.tar, no source size with dict, zstdcli, 38004
|
||||
@ -248,8 +248,8 @@ silesia, level 11 row 2, advanced
|
||||
silesia, level 12 row 1, advanced one pass, 4505046
|
||||
silesia, level 12 row 2, advanced one pass, 4503116
|
||||
silesia, level 13, advanced one pass, 4493990
|
||||
silesia, level 16, advanced one pass, 4359864
|
||||
silesia, level 19, advanced one pass, 4296438
|
||||
silesia, level 16, advanced one pass, 4360041
|
||||
silesia, level 19, advanced one pass, 4296055
|
||||
silesia, no source size, advanced one pass, 4842075
|
||||
silesia, long distance mode, advanced one pass, 4833710
|
||||
silesia, multithreaded, advanced one pass, 4842075
|
||||
@ -282,14 +282,14 @@ silesia.tar, level 11 row 2, advanced
|
||||
silesia.tar, level 12 row 1, advanced one pass, 4514049
|
||||
silesia.tar, level 12 row 2, advanced one pass, 4513797
|
||||
silesia.tar, level 13, advanced one pass, 4502956
|
||||
silesia.tar, level 16, advanced one pass, 4360527
|
||||
silesia.tar, level 19, advanced one pass, 4266970
|
||||
silesia.tar, level 16, advanced one pass, 4360546
|
||||
silesia.tar, level 19, advanced one pass, 4265911
|
||||
silesia.tar, no source size, advanced one pass, 4854086
|
||||
silesia.tar, long distance mode, advanced one pass, 4840452
|
||||
silesia.tar, multithreaded, advanced one pass, 4854160
|
||||
silesia.tar, multithreaded long distance mode, advanced one pass, 4845741
|
||||
silesia.tar, small window log, advanced one pass, 7100655
|
||||
silesia.tar, small hash log, advanced one pass, 6529231
|
||||
silesia.tar, small hash log, advanced one pass, 6529206
|
||||
silesia.tar, small chain log, advanced one pass, 4917041
|
||||
silesia.tar, explicit params, advanced one pass, 4806855
|
||||
silesia.tar, uncompressed literals, advanced one pass, 5122473
|
||||
@ -370,39 +370,39 @@ github, level 9 with dict dms, advanced
|
||||
github, level 9 with dict dds, advanced one pass, 39393
|
||||
github, level 9 with dict copy, advanced one pass, 39398
|
||||
github, level 9 with dict load, advanced one pass, 41710
|
||||
github, level 11 row 1, advanced one pass, 135119
|
||||
github, level 11 row 1, advanced one pass, 135367
|
||||
github, level 11 row 1 with dict dms, advanced one pass, 39671
|
||||
github, level 11 row 1 with dict dds, advanced one pass, 39671
|
||||
github, level 11 row 1 with dict copy, advanced one pass, 39651
|
||||
github, level 11 row 1 with dict load, advanced one pass, 41360
|
||||
github, level 11 row 2, advanced one pass, 135119
|
||||
github, level 11 row 2, advanced one pass, 135367
|
||||
github, level 11 row 2 with dict dms, advanced one pass, 39671
|
||||
github, level 11 row 2 with dict dds, advanced one pass, 39671
|
||||
github, level 11 row 2 with dict copy, advanced one pass, 39651
|
||||
github, level 11 row 2 with dict load, advanced one pass, 41360
|
||||
github, level 12 row 1, advanced one pass, 134180
|
||||
github, level 12 row 1, advanced one pass, 134402
|
||||
github, level 12 row 1 with dict dms, advanced one pass, 39677
|
||||
github, level 12 row 1 with dict dds, advanced one pass, 39677
|
||||
github, level 12 row 1 with dict copy, advanced one pass, 39677
|
||||
github, level 12 row 1 with dict load, advanced one pass, 41166
|
||||
github, level 12 row 2, advanced one pass, 134180
|
||||
github, level 12 row 2, advanced one pass, 134402
|
||||
github, level 12 row 2 with dict dms, advanced one pass, 39677
|
||||
github, level 12 row 2 with dict dds, advanced one pass, 39677
|
||||
github, level 12 row 2 with dict copy, advanced one pass, 39677
|
||||
github, level 12 row 2 with dict load, advanced one pass, 41166
|
||||
github, level 13, advanced one pass, 132729
|
||||
github, level 13, advanced one pass, 132878
|
||||
github, level 13 with dict, advanced one pass, 39900
|
||||
github, level 13 with dict dms, advanced one pass, 39900
|
||||
github, level 13 with dict dds, advanced one pass, 39900
|
||||
github, level 13 with dict copy, advanced one pass, 39948
|
||||
github, level 13 with dict load, advanced one pass, 42624
|
||||
github, level 16, advanced one pass, 132729
|
||||
github, level 16, advanced one pass, 133209
|
||||
github, level 16 with dict, advanced one pass, 37577
|
||||
github, level 16 with dict dms, advanced one pass, 37577
|
||||
github, level 16 with dict dds, advanced one pass, 37577
|
||||
github, level 16 with dict copy, advanced one pass, 37568
|
||||
github, level 16 with dict load, advanced one pass, 42338
|
||||
github, level 19, advanced one pass, 132729
|
||||
github, level 19, advanced one pass, 132879
|
||||
github, level 19 with dict, advanced one pass, 37576
|
||||
github, level 19 with dict dms, advanced one pass, 37576
|
||||
github, level 19 with dict dds, advanced one pass, 37576
|
||||
@ -418,7 +418,7 @@ github, small hash log, advanced
|
||||
github, small chain log, advanced one pass, 136341
|
||||
github, explicit params, advanced one pass, 137727
|
||||
github, uncompressed literals, advanced one pass, 165911
|
||||
github, uncompressed literals optimal, advanced one pass, 157227
|
||||
github, uncompressed literals optimal, advanced one pass, 152667
|
||||
github, huffman literals, advanced one pass, 142365
|
||||
github, multithreaded with advanced params, advanced one pass, 165911
|
||||
github.tar, level -5, advanced one pass, 52115
|
||||
@ -521,13 +521,13 @@ github.tar, level 13 with dict dms, advanced
|
||||
github.tar, level 13 with dict dds, advanced one pass, 37220
|
||||
github.tar, level 13 with dict copy, advanced one pass, 37130
|
||||
github.tar, level 13 with dict load, advanced one pass, 36010
|
||||
github.tar, level 16, advanced one pass, 40471
|
||||
github.tar, level 16, advanced one pass, 40466
|
||||
github.tar, level 16 with dict, advanced one pass, 33374
|
||||
github.tar, level 16 with dict dms, advanced one pass, 33206
|
||||
github.tar, level 16 with dict dds, advanced one pass, 33206
|
||||
github.tar, level 16 with dict copy, advanced one pass, 33374
|
||||
github.tar, level 16 with dict load, advanced one pass, 39081
|
||||
github.tar, level 19, advanced one pass, 32149
|
||||
github.tar, level 19, advanced one pass, 32276
|
||||
github.tar, level 19 with dict, advanced one pass, 32712
|
||||
github.tar, level 19 with dict dms, advanced one pass, 32555
|
||||
github.tar, level 19 with dict dds, advanced one pass, 32555
|
||||
@ -566,8 +566,8 @@ silesia, level 11 row 2, advanced
|
||||
silesia, level 12 row 1, advanced one pass small out, 4505046
|
||||
silesia, level 12 row 2, advanced one pass small out, 4503116
|
||||
silesia, level 13, advanced one pass small out, 4493990
|
||||
silesia, level 16, advanced one pass small out, 4359864
|
||||
silesia, level 19, advanced one pass small out, 4296438
|
||||
silesia, level 16, advanced one pass small out, 4360041
|
||||
silesia, level 19, advanced one pass small out, 4296055
|
||||
silesia, no source size, advanced one pass small out, 4842075
|
||||
silesia, long distance mode, advanced one pass small out, 4833710
|
||||
silesia, multithreaded, advanced one pass small out, 4842075
|
||||
@ -600,14 +600,14 @@ silesia.tar, level 11 row 2, advanced
|
||||
silesia.tar, level 12 row 1, advanced one pass small out, 4514049
|
||||
silesia.tar, level 12 row 2, advanced one pass small out, 4513797
|
||||
silesia.tar, level 13, advanced one pass small out, 4502956
|
||||
silesia.tar, level 16, advanced one pass small out, 4360527
|
||||
silesia.tar, level 19, advanced one pass small out, 4266970
|
||||
silesia.tar, level 16, advanced one pass small out, 4360546
|
||||
silesia.tar, level 19, advanced one pass small out, 4265911
|
||||
silesia.tar, no source size, advanced one pass small out, 4854086
|
||||
silesia.tar, long distance mode, advanced one pass small out, 4840452
|
||||
silesia.tar, multithreaded, advanced one pass small out, 4854160
|
||||
silesia.tar, multithreaded long distance mode, advanced one pass small out, 4845741
|
||||
silesia.tar, small window log, advanced one pass small out, 7100655
|
||||
silesia.tar, small hash log, advanced one pass small out, 6529231
|
||||
silesia.tar, small hash log, advanced one pass small out, 6529206
|
||||
silesia.tar, small chain log, advanced one pass small out, 4917041
|
||||
silesia.tar, explicit params, advanced one pass small out, 4806855
|
||||
silesia.tar, uncompressed literals, advanced one pass small out, 5122473
|
||||
@ -688,39 +688,39 @@ github, level 9 with dict dms, advanced
|
||||
github, level 9 with dict dds, advanced one pass small out, 39393
|
||||
github, level 9 with dict copy, advanced one pass small out, 39398
|
||||
github, level 9 with dict load, advanced one pass small out, 41710
|
||||
github, level 11 row 1, advanced one pass small out, 135119
|
||||
github, level 11 row 1, advanced one pass small out, 135367
|
||||
github, level 11 row 1 with dict dms, advanced one pass small out, 39671
|
||||
github, level 11 row 1 with dict dds, advanced one pass small out, 39671
|
||||
github, level 11 row 1 with dict copy, advanced one pass small out, 39651
|
||||
github, level 11 row 1 with dict load, advanced one pass small out, 41360
|
||||
github, level 11 row 2, advanced one pass small out, 135119
|
||||
github, level 11 row 2, advanced one pass small out, 135367
|
||||
github, level 11 row 2 with dict dms, advanced one pass small out, 39671
|
||||
github, level 11 row 2 with dict dds, advanced one pass small out, 39671
|
||||
github, level 11 row 2 with dict copy, advanced one pass small out, 39651
|
||||
github, level 11 row 2 with dict load, advanced one pass small out, 41360
|
||||
github, level 12 row 1, advanced one pass small out, 134180
|
||||
github, level 12 row 1, advanced one pass small out, 134402
|
||||
github, level 12 row 1 with dict dms, advanced one pass small out, 39677
|
||||
github, level 12 row 1 with dict dds, advanced one pass small out, 39677
|
||||
github, level 12 row 1 with dict copy, advanced one pass small out, 39677
|
||||
github, level 12 row 1 with dict load, advanced one pass small out, 41166
|
||||
github, level 12 row 2, advanced one pass small out, 134180
|
||||
github, level 12 row 2, advanced one pass small out, 134402
|
||||
github, level 12 row 2 with dict dms, advanced one pass small out, 39677
|
||||
github, level 12 row 2 with dict dds, advanced one pass small out, 39677
|
||||
github, level 12 row 2 with dict copy, advanced one pass small out, 39677
|
||||
github, level 12 row 2 with dict load, advanced one pass small out, 41166
|
||||
github, level 13, advanced one pass small out, 132729
|
||||
github, level 13, advanced one pass small out, 132878
|
||||
github, level 13 with dict, advanced one pass small out, 39900
|
||||
github, level 13 with dict dms, advanced one pass small out, 39900
|
||||
github, level 13 with dict dds, advanced one pass small out, 39900
|
||||
github, level 13 with dict copy, advanced one pass small out, 39948
|
||||
github, level 13 with dict load, advanced one pass small out, 42624
|
||||
github, level 16, advanced one pass small out, 132729
|
||||
github, level 16, advanced one pass small out, 133209
|
||||
github, level 16 with dict, advanced one pass small out, 37577
|
||||
github, level 16 with dict dms, advanced one pass small out, 37577
|
||||
github, level 16 with dict dds, advanced one pass small out, 37577
|
||||
github, level 16 with dict copy, advanced one pass small out, 37568
|
||||
github, level 16 with dict load, advanced one pass small out, 42338
|
||||
github, level 19, advanced one pass small out, 132729
|
||||
github, level 19, advanced one pass small out, 132879
|
||||
github, level 19 with dict, advanced one pass small out, 37576
|
||||
github, level 19 with dict dms, advanced one pass small out, 37576
|
||||
github, level 19 with dict dds, advanced one pass small out, 37576
|
||||
@ -736,7 +736,7 @@ github, small hash log, advanced
|
||||
github, small chain log, advanced one pass small out, 136341
|
||||
github, explicit params, advanced one pass small out, 137727
|
||||
github, uncompressed literals, advanced one pass small out, 165911
|
||||
github, uncompressed literals optimal, advanced one pass small out, 157227
|
||||
github, uncompressed literals optimal, advanced one pass small out, 152667
|
||||
github, huffman literals, advanced one pass small out, 142365
|
||||
github, multithreaded with advanced params, advanced one pass small out, 165911
|
||||
github.tar, level -5, advanced one pass small out, 52115
|
||||
@ -839,13 +839,13 @@ github.tar, level 13 with dict dms, advanced
|
||||
github.tar, level 13 with dict dds, advanced one pass small out, 37220
|
||||
github.tar, level 13 with dict copy, advanced one pass small out, 37130
|
||||
github.tar, level 13 with dict load, advanced one pass small out, 36010
|
||||
github.tar, level 16, advanced one pass small out, 40471
|
||||
github.tar, level 16, advanced one pass small out, 40466
|
||||
github.tar, level 16 with dict, advanced one pass small out, 33374
|
||||
github.tar, level 16 with dict dms, advanced one pass small out, 33206
|
||||
github.tar, level 16 with dict dds, advanced one pass small out, 33206
|
||||
github.tar, level 16 with dict copy, advanced one pass small out, 33374
|
||||
github.tar, level 16 with dict load, advanced one pass small out, 39081
|
||||
github.tar, level 19, advanced one pass small out, 32149
|
||||
github.tar, level 19, advanced one pass small out, 32276
|
||||
github.tar, level 19 with dict, advanced one pass small out, 32712
|
||||
github.tar, level 19 with dict dms, advanced one pass small out, 32555
|
||||
github.tar, level 19 with dict dds, advanced one pass small out, 32555
|
||||
@ -884,8 +884,8 @@ silesia, level 11 row 2, advanced
|
||||
silesia, level 12 row 1, advanced streaming, 4505046
|
||||
silesia, level 12 row 2, advanced streaming, 4503116
|
||||
silesia, level 13, advanced streaming, 4493990
|
||||
silesia, level 16, advanced streaming, 4359864
|
||||
silesia, level 19, advanced streaming, 4296438
|
||||
silesia, level 16, advanced streaming, 4360041
|
||||
silesia, level 19, advanced streaming, 4296055
|
||||
silesia, no source size, advanced streaming, 4842039
|
||||
silesia, long distance mode, advanced streaming, 4833710
|
||||
silesia, multithreaded, advanced streaming, 4842075
|
||||
@ -918,14 +918,14 @@ silesia.tar, level 11 row 2, advanced
|
||||
silesia.tar, level 12 row 1, advanced streaming, 4514049
|
||||
silesia.tar, level 12 row 2, advanced streaming, 4513797
|
||||
silesia.tar, level 13, advanced streaming, 4502956
|
||||
silesia.tar, level 16, advanced streaming, 4360527
|
||||
silesia.tar, level 19, advanced streaming, 4266970
|
||||
silesia.tar, level 16, advanced streaming, 4360546
|
||||
silesia.tar, level 19, advanced streaming, 4265911
|
||||
silesia.tar, no source size, advanced streaming, 4859267
|
||||
silesia.tar, long distance mode, advanced streaming, 4840452
|
||||
silesia.tar, multithreaded, advanced streaming, 4854160
|
||||
silesia.tar, multithreaded long distance mode, advanced streaming, 4845741
|
||||
silesia.tar, small window log, advanced streaming, 7117559
|
||||
silesia.tar, small hash log, advanced streaming, 6529234
|
||||
silesia.tar, small hash log, advanced streaming, 6529209
|
||||
silesia.tar, small chain log, advanced streaming, 4917021
|
||||
silesia.tar, explicit params, advanced streaming, 4806873
|
||||
silesia.tar, uncompressed literals, advanced streaming, 5127423
|
||||
@ -1006,39 +1006,39 @@ github, level 9 with dict dms, advanced
|
||||
github, level 9 with dict dds, advanced streaming, 39393
|
||||
github, level 9 with dict copy, advanced streaming, 39398
|
||||
github, level 9 with dict load, advanced streaming, 41710
|
||||
github, level 11 row 1, advanced streaming, 135119
|
||||
github, level 11 row 1, advanced streaming, 135367
|
||||
github, level 11 row 1 with dict dms, advanced streaming, 39671
|
||||
github, level 11 row 1 with dict dds, advanced streaming, 39671
|
||||
github, level 11 row 1 with dict copy, advanced streaming, 39651
|
||||
github, level 11 row 1 with dict load, advanced streaming, 41360
|
||||
github, level 11 row 2, advanced streaming, 135119
|
||||
github, level 11 row 2, advanced streaming, 135367
|
||||
github, level 11 row 2 with dict dms, advanced streaming, 39671
|
||||
github, level 11 row 2 with dict dds, advanced streaming, 39671
|
||||
github, level 11 row 2 with dict copy, advanced streaming, 39651
|
||||
github, level 11 row 2 with dict load, advanced streaming, 41360
|
||||
github, level 12 row 1, advanced streaming, 134180
|
||||
github, level 12 row 1, advanced streaming, 134402
|
||||
github, level 12 row 1 with dict dms, advanced streaming, 39677
|
||||
github, level 12 row 1 with dict dds, advanced streaming, 39677
|
||||
github, level 12 row 1 with dict copy, advanced streaming, 39677
|
||||
github, level 12 row 1 with dict load, advanced streaming, 41166
|
||||
github, level 12 row 2, advanced streaming, 134180
|
||||
github, level 12 row 2, advanced streaming, 134402
|
||||
github, level 12 row 2 with dict dms, advanced streaming, 39677
|
||||
github, level 12 row 2 with dict dds, advanced streaming, 39677
|
||||
github, level 12 row 2 with dict copy, advanced streaming, 39677
|
||||
github, level 12 row 2 with dict load, advanced streaming, 41166
|
||||
github, level 13, advanced streaming, 132729
|
||||
github, level 13, advanced streaming, 132878
|
||||
github, level 13 with dict, advanced streaming, 39900
|
||||
github, level 13 with dict dms, advanced streaming, 39900
|
||||
github, level 13 with dict dds, advanced streaming, 39900
|
||||
github, level 13 with dict copy, advanced streaming, 39948
|
||||
github, level 13 with dict load, advanced streaming, 42624
|
||||
github, level 16, advanced streaming, 132729
|
||||
github, level 16, advanced streaming, 133209
|
||||
github, level 16 with dict, advanced streaming, 37577
|
||||
github, level 16 with dict dms, advanced streaming, 37577
|
||||
github, level 16 with dict dds, advanced streaming, 37577
|
||||
github, level 16 with dict copy, advanced streaming, 37568
|
||||
github, level 16 with dict load, advanced streaming, 42338
|
||||
github, level 19, advanced streaming, 132729
|
||||
github, level 19, advanced streaming, 132879
|
||||
github, level 19 with dict, advanced streaming, 37576
|
||||
github, level 19 with dict dms, advanced streaming, 37576
|
||||
github, level 19 with dict dds, advanced streaming, 37576
|
||||
@ -1054,7 +1054,7 @@ github, small hash log, advanced
|
||||
github, small chain log, advanced streaming, 136341
|
||||
github, explicit params, advanced streaming, 137727
|
||||
github, uncompressed literals, advanced streaming, 165911
|
||||
github, uncompressed literals optimal, advanced streaming, 157227
|
||||
github, uncompressed literals optimal, advanced streaming, 152667
|
||||
github, huffman literals, advanced streaming, 142365
|
||||
github, multithreaded with advanced params, advanced streaming, 165911
|
||||
github.tar, level -5, advanced streaming, 52152
|
||||
@ -1157,13 +1157,13 @@ github.tar, level 13 with dict dms, advanced
|
||||
github.tar, level 13 with dict dds, advanced streaming, 37220
|
||||
github.tar, level 13 with dict copy, advanced streaming, 37130
|
||||
github.tar, level 13 with dict load, advanced streaming, 36010
|
||||
github.tar, level 16, advanced streaming, 40471
|
||||
github.tar, level 16, advanced streaming, 40466
|
||||
github.tar, level 16 with dict, advanced streaming, 33374
|
||||
github.tar, level 16 with dict dms, advanced streaming, 33206
|
||||
github.tar, level 16 with dict dds, advanced streaming, 33206
|
||||
github.tar, level 16 with dict copy, advanced streaming, 33374
|
||||
github.tar, level 16 with dict load, advanced streaming, 39081
|
||||
github.tar, level 19, advanced streaming, 32149
|
||||
github.tar, level 19, advanced streaming, 32276
|
||||
github.tar, level 19 with dict, advanced streaming, 32712
|
||||
github.tar, level 19 with dict dms, advanced streaming, 32555
|
||||
github.tar, level 19 with dict dds, advanced streaming, 32555
|
||||
@ -1194,11 +1194,11 @@ silesia, level 6, old stre
|
||||
silesia, level 7, old streaming, 4566984
|
||||
silesia, level 9, old streaming, 4543018
|
||||
silesia, level 13, old streaming, 4493990
|
||||
silesia, level 16, old streaming, 4359864
|
||||
silesia, level 19, old streaming, 4296438
|
||||
silesia, level 16, old streaming, 4360041
|
||||
silesia, level 19, old streaming, 4296055
|
||||
silesia, no source size, old streaming, 4842039
|
||||
silesia, uncompressed literals, old streaming, 4842075
|
||||
silesia, uncompressed literals optimal, old streaming, 4296438
|
||||
silesia, uncompressed literals optimal, old streaming, 4296055
|
||||
silesia, huffman literals, old streaming, 6172207
|
||||
silesia.tar, level -5, old streaming, 6856523
|
||||
silesia.tar, level -3, old streaming, 6505954
|
||||
@ -1212,11 +1212,11 @@ silesia.tar, level 6, old stre
|
||||
silesia.tar, level 7, old streaming, 4576664
|
||||
silesia.tar, level 9, old streaming, 4552900
|
||||
silesia.tar, level 13, old streaming, 4502956
|
||||
silesia.tar, level 16, old streaming, 4360527
|
||||
silesia.tar, level 19, old streaming, 4266970
|
||||
silesia.tar, level 16, old streaming, 4360546
|
||||
silesia.tar, level 19, old streaming, 4265911
|
||||
silesia.tar, no source size, old streaming, 4859267
|
||||
silesia.tar, uncompressed literals, old streaming, 4859271
|
||||
silesia.tar, uncompressed literals optimal, old streaming, 4266970
|
||||
silesia.tar, uncompressed literals optimal, old streaming, 4265911
|
||||
silesia.tar, huffman literals, old streaming, 6179056
|
||||
github, level -5, old streaming, 204407
|
||||
github, level -5 with dict, old streaming, 46718
|
||||
@ -1240,16 +1240,16 @@ github, level 7, old stre
|
||||
github, level 7 with dict, old streaming, 38758
|
||||
github, level 9, old streaming, 135122
|
||||
github, level 9 with dict, old streaming, 39437
|
||||
github, level 13, old streaming, 132729
|
||||
github, level 13, old streaming, 132878
|
||||
github, level 13 with dict, old streaming, 39900
|
||||
github, level 16, old streaming, 132729
|
||||
github, level 16, old streaming, 133209
|
||||
github, level 16 with dict, old streaming, 37577
|
||||
github, level 19, old streaming, 132729
|
||||
github, level 19, old streaming, 132879
|
||||
github, level 19 with dict, old streaming, 37576
|
||||
github, no source size, old streaming, 140599
|
||||
github, no source size with dict, old streaming, 40654
|
||||
github, uncompressed literals, old streaming, 136332
|
||||
github, uncompressed literals optimal, old streaming, 132729
|
||||
github, uncompressed literals optimal, old streaming, 132879
|
||||
github, huffman literals, old streaming, 175468
|
||||
github.tar, level -5, old streaming, 52152
|
||||
github.tar, level -5 with dict, old streaming, 51045
|
||||
@ -1275,14 +1275,14 @@ github.tar, level 9, old stre
|
||||
github.tar, level 9 with dict, old streaming, 36484
|
||||
github.tar, level 13, old streaming, 35501
|
||||
github.tar, level 13 with dict, old streaming, 37130
|
||||
github.tar, level 16, old streaming, 40471
|
||||
github.tar, level 16, old streaming, 40466
|
||||
github.tar, level 16 with dict, old streaming, 33374
|
||||
github.tar, level 19, old streaming, 32149
|
||||
github.tar, level 19, old streaming, 32276
|
||||
github.tar, level 19 with dict, old streaming, 32712
|
||||
github.tar, no source size, old streaming, 38828
|
||||
github.tar, no source size with dict, old streaming, 38000
|
||||
github.tar, uncompressed literals, old streaming, 38831
|
||||
github.tar, uncompressed literals optimal, old streaming, 32149
|
||||
github.tar, uncompressed literals optimal, old streaming, 32276
|
||||
github.tar, huffman literals, old streaming, 42560
|
||||
silesia, level -5, old streaming advanced, 6854744
|
||||
silesia, level -3, old streaming advanced, 6503319
|
||||
@ -1296,8 +1296,8 @@ silesia, level 6, old stre
|
||||
silesia, level 7, old streaming advanced, 4566984
|
||||
silesia, level 9, old streaming advanced, 4543018
|
||||
silesia, level 13, old streaming advanced, 4493990
|
||||
silesia, level 16, old streaming advanced, 4359864
|
||||
silesia, level 19, old streaming advanced, 4296438
|
||||
silesia, level 16, old streaming advanced, 4360041
|
||||
silesia, level 19, old streaming advanced, 4296055
|
||||
silesia, no source size, old streaming advanced, 4842039
|
||||
silesia, long distance mode, old streaming advanced, 4842075
|
||||
silesia, multithreaded, old streaming advanced, 4842075
|
||||
@ -1307,7 +1307,7 @@ silesia, small hash log, old stre
|
||||
silesia, small chain log, old streaming advanced, 4912197
|
||||
silesia, explicit params, old streaming advanced, 4795452
|
||||
silesia, uncompressed literals, old streaming advanced, 4842075
|
||||
silesia, uncompressed literals optimal, old streaming advanced, 4296438
|
||||
silesia, uncompressed literals optimal, old streaming advanced, 4296055
|
||||
silesia, huffman literals, old streaming advanced, 6172207
|
||||
silesia, multithreaded with advanced params, old streaming advanced, 4842075
|
||||
silesia.tar, level -5, old streaming advanced, 6856523
|
||||
@ -1322,18 +1322,18 @@ silesia.tar, level 6, old stre
|
||||
silesia.tar, level 7, old streaming advanced, 4576664
|
||||
silesia.tar, level 9, old streaming advanced, 4552900
|
||||
silesia.tar, level 13, old streaming advanced, 4502956
|
||||
silesia.tar, level 16, old streaming advanced, 4360527
|
||||
silesia.tar, level 19, old streaming advanced, 4266970
|
||||
silesia.tar, level 16, old streaming advanced, 4360546
|
||||
silesia.tar, level 19, old streaming advanced, 4265911
|
||||
silesia.tar, no source size, old streaming advanced, 4859267
|
||||
silesia.tar, long distance mode, old streaming advanced, 4859271
|
||||
silesia.tar, multithreaded, old streaming advanced, 4859271
|
||||
silesia.tar, multithreaded long distance mode, old streaming advanced, 4859271
|
||||
silesia.tar, small window log, old streaming advanced, 7117562
|
||||
silesia.tar, small hash log, old streaming advanced, 6529234
|
||||
silesia.tar, small hash log, old streaming advanced, 6529209
|
||||
silesia.tar, small chain log, old streaming advanced, 4917021
|
||||
silesia.tar, explicit params, old streaming advanced, 4806873
|
||||
silesia.tar, uncompressed literals, old streaming advanced, 4859271
|
||||
silesia.tar, uncompressed literals optimal, old streaming advanced, 4266970
|
||||
silesia.tar, uncompressed literals optimal, old streaming advanced, 4265911
|
||||
silesia.tar, huffman literals, old streaming advanced, 6179056
|
||||
silesia.tar, multithreaded with advanced params, old streaming advanced, 4859271
|
||||
github, level -5, old streaming advanced, 213265
|
||||
@ -1360,9 +1360,9 @@ github, level 9, old stre
|
||||
github, level 9 with dict, old streaming advanced, 38981
|
||||
github, level 13, old streaming advanced, 138676
|
||||
github, level 13 with dict, old streaming advanced, 39725
|
||||
github, level 16, old streaming advanced, 138676
|
||||
github, level 16, old streaming advanced, 138575
|
||||
github, level 16 with dict, old streaming advanced, 40789
|
||||
github, level 19, old streaming advanced, 132729
|
||||
github, level 19, old streaming advanced, 132879
|
||||
github, level 19 with dict, old streaming advanced, 37576
|
||||
github, no source size, old streaming advanced, 140599
|
||||
github, no source size with dict, old streaming advanced, 40608
|
||||
@ -1374,7 +1374,7 @@ github, small hash log, old stre
|
||||
github, small chain log, old streaming advanced, 139275
|
||||
github, explicit params, old streaming advanced, 140937
|
||||
github, uncompressed literals, old streaming advanced, 141104
|
||||
github, uncompressed literals optimal, old streaming advanced, 132729
|
||||
github, uncompressed literals optimal, old streaming advanced, 132879
|
||||
github, huffman literals, old streaming advanced, 181107
|
||||
github, multithreaded with advanced params, old streaming advanced, 141104
|
||||
github.tar, level -5, old streaming advanced, 52152
|
||||
@ -1401,9 +1401,9 @@ github.tar, level 9, old stre
|
||||
github.tar, level 9 with dict, old streaming advanced, 36312
|
||||
github.tar, level 13, old streaming advanced, 35501
|
||||
github.tar, level 13 with dict, old streaming advanced, 35807
|
||||
github.tar, level 16, old streaming advanced, 40471
|
||||
github.tar, level 16, old streaming advanced, 40466
|
||||
github.tar, level 16 with dict, old streaming advanced, 38578
|
||||
github.tar, level 19, old streaming advanced, 32149
|
||||
github.tar, level 19, old streaming advanced, 32276
|
||||
github.tar, level 19 with dict, old streaming advanced, 32704
|
||||
github.tar, no source size, old streaming advanced, 38828
|
||||
github.tar, no source size with dict, old streaming advanced, 38015
|
||||
@ -1415,7 +1415,7 @@ github.tar, small hash log, old stre
|
||||
github.tar, small chain log, old streaming advanced, 41669
|
||||
github.tar, explicit params, old streaming advanced, 41385
|
||||
github.tar, uncompressed literals, old streaming advanced, 38831
|
||||
github.tar, uncompressed literals optimal, old streaming advanced, 32149
|
||||
github.tar, uncompressed literals optimal, old streaming advanced, 32276
|
||||
github.tar, huffman literals, old streaming advanced, 42560
|
||||
github.tar, multithreaded with advanced params, old streaming advanced, 38831
|
||||
github, level -5 with dict, old streaming cdict, 46718
|
||||
|
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# ################################################################
|
||||
# Copyright (c) Facebook, Inc.
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
@ -83,8 +83,8 @@ def valid_copyright(lines):
|
||||
continue
|
||||
if "present" in line:
|
||||
return (False, f"Copyright line '{line}' contains 'present'!")
|
||||
if "Facebook, Inc" not in line:
|
||||
return (False, f"Copyright line '{line}' does not contain 'Facebook, Inc'")
|
||||
if "Meta Platforms, Inc" not in line:
|
||||
return (False, f"Copyright line '{line}' does not contain 'Meta Platforms, Inc'")
|
||||
year = YEAR_REGEX.search(line)
|
||||
if year is not None:
|
||||
return (False, f"Copyright line '{line}' contains {year.group(0)}; it should be yearless")
|
||||
|
@ -2,7 +2,7 @@
|
||||
"""Test zstd interoperability between versions"""
|
||||
|
||||
# ################################################################
|
||||
# Copyright (c) Yann Collet, Facebook, Inc.
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
@ -23,7 +23,7 @@ from subprocess import Popen, PIPE
|
||||
repo_url = 'https://github.com/facebook/zstd.git'
|
||||
tmp_dir_name = 'tests/versionsTest'
|
||||
make_cmd = 'make'
|
||||
make_args = ['-j','CFLAGS=-O1']
|
||||
make_args = ['-j','CFLAGS=-O0']
|
||||
git_cmd = 'git'
|
||||
test_dat_src = 'README.md'
|
||||
test_dat = 'test_dat'
|
||||
@ -86,41 +86,46 @@ def create_dict(tag, dict_source_path):
|
||||
if result == 0:
|
||||
print(dict_name + ' created')
|
||||
else:
|
||||
print('ERROR: creating of ' + dict_name + ' failed')
|
||||
raise RuntimeError('ERROR: creating of ' + dict_name + ' failed')
|
||||
else:
|
||||
print(dict_name + ' already exists')
|
||||
|
||||
|
||||
def zstd(tag, args, input_file, output_file):
|
||||
"""
|
||||
Zstd compress input_file to output_file.
|
||||
Need this helper because 0.5.0 is broken when stdout is not a TTY.
|
||||
Throws an exception if the command returns non-zero.
|
||||
"""
|
||||
with open(input_file, "rb") as i:
|
||||
with open(output_file, "wb") as o:
|
||||
cmd = ['./zstd.' + tag] + args
|
||||
print("Running: '{}', input={}, output={}" .format(
|
||||
' '.join(cmd), input_file, output_file
|
||||
))
|
||||
subprocess.check_call(cmd, stdin=i, stdout=o)
|
||||
|
||||
|
||||
def dict_compress_sample(tag, sample):
|
||||
dict_name = 'dict.' + tag
|
||||
DEVNULL = open(os.devnull, 'wb')
|
||||
if subprocess.call(['./zstd.' + tag, '-D', dict_name, '-f', sample], stderr=DEVNULL) == 0:
|
||||
os.rename(sample + '.zst', sample + '_01_64_' + tag + '_dictio.zst')
|
||||
if subprocess.call(['./zstd.' + tag, '-D', dict_name, '-5f', sample], stderr=DEVNULL) == 0:
|
||||
os.rename(sample + '.zst', sample + '_05_64_' + tag + '_dictio.zst')
|
||||
if subprocess.call(['./zstd.' + tag, '-D', dict_name, '-9f', sample], stderr=DEVNULL) == 0:
|
||||
os.rename(sample + '.zst', sample + '_09_64_' + tag + '_dictio.zst')
|
||||
if subprocess.call(['./zstd.' + tag, '-D', dict_name, '-15f', sample], stderr=DEVNULL) == 0:
|
||||
os.rename(sample + '.zst', sample + '_15_64_' + tag + '_dictio.zst')
|
||||
if subprocess.call(['./zstd.' + tag, '-D', dict_name, '-18f', sample], stderr=DEVNULL) == 0:
|
||||
os.rename(sample + '.zst', sample + '_18_64_' + tag + '_dictio.zst')
|
||||
zstd(tag, ['-D', dict_name, '-1'], sample, sample + '_01_64_' + tag + '_dictio.zst')
|
||||
zstd(tag, ['-D', dict_name, '-3'], sample, sample + '_03_64_' + tag + '_dictio.zst')
|
||||
zstd(tag, ['-D', dict_name, '-5'], sample, sample + '_05_64_' + tag + '_dictio.zst')
|
||||
zstd(tag, ['-D', dict_name, '-9'], sample, sample + '_09_64_' + tag + '_dictio.zst')
|
||||
zstd(tag, ['-D', dict_name, '-15'], sample, sample + '_15_64_' + tag + '_dictio.zst')
|
||||
zstd(tag, ['-D', dict_name, '-18'], sample, sample + '_18_64_' + tag + '_dictio.zst')
|
||||
# zstdFiles = glob.glob("*.zst*")
|
||||
# print(zstdFiles)
|
||||
print(tag + " : dict compression completed")
|
||||
|
||||
|
||||
def compress_sample(tag, sample):
|
||||
DEVNULL = open(os.devnull, 'wb')
|
||||
if subprocess.call(['./zstd.' + tag, '-f', sample], stderr=DEVNULL) == 0:
|
||||
os.rename(sample + '.zst', sample + '_01_64_' + tag + '_nodict.zst')
|
||||
if subprocess.call(['./zstd.' + tag, '-5f', sample], stderr=DEVNULL) == 0:
|
||||
os.rename(sample + '.zst', sample + '_05_64_' + tag + '_nodict.zst')
|
||||
if subprocess.call(['./zstd.' + tag, '-9f', sample], stderr=DEVNULL) == 0:
|
||||
os.rename(sample + '.zst', sample + '_09_64_' + tag + '_nodict.zst')
|
||||
if subprocess.call(['./zstd.' + tag, '-15f', sample], stderr=DEVNULL) == 0:
|
||||
os.rename(sample + '.zst', sample + '_15_64_' + tag + '_nodict.zst')
|
||||
if subprocess.call(['./zstd.' + tag, '-18f', sample], stderr=DEVNULL) == 0:
|
||||
os.rename(sample + '.zst', sample + '_18_64_' + tag + '_nodict.zst')
|
||||
zstd(tag, ['-1'], sample, sample + '_01_64_' + tag + '_nodict.zst')
|
||||
zstd(tag, ['-3'], sample, sample + '_03_64_' + tag + '_nodict.zst')
|
||||
zstd(tag, ['-5'], sample, sample + '_05_64_' + tag + '_nodict.zst')
|
||||
zstd(tag, ['-9'], sample, sample + '_09_64_' + tag + '_nodict.zst')
|
||||
zstd(tag, ['-15'], sample, sample + '_15_64_' + tag + '_nodict.zst')
|
||||
zstd(tag, ['-18'], sample, sample + '_18_64_' + tag + '_nodict.zst')
|
||||
# zstdFiles = glob.glob("*.zst*")
|
||||
# print(zstdFiles)
|
||||
print(tag + " : compression completed")
|
||||
@ -150,23 +155,13 @@ def decompress_zst(tag):
|
||||
dec_error = 0
|
||||
list_zst = sorted(glob.glob('*_nodict.zst'))
|
||||
for file_zst in list_zst:
|
||||
print(file_zst, end=' ')
|
||||
print(tag, end=' ')
|
||||
print(file_zst + ' ' + tag)
|
||||
file_dec = file_zst + '_d64_' + tag + '.dec'
|
||||
if tag <= 'v0.5.0':
|
||||
params = ['./zstd.' + tag, '-df', file_zst, file_dec]
|
||||
zstd(tag, ['-d'], file_zst, file_dec)
|
||||
if not filecmp.cmp(file_dec, test_dat):
|
||||
raise RuntimeError('Decompression failed: tag={} file={}'.format(tag, file_zst))
|
||||
else:
|
||||
params = ['./zstd.' + tag, '-df', file_zst, '-o', file_dec]
|
||||
if execute(params) == 0:
|
||||
if not filecmp.cmp(file_dec, test_dat):
|
||||
print('ERR !! ')
|
||||
dec_error = 1
|
||||
else:
|
||||
print('OK ')
|
||||
else:
|
||||
print('command does not work')
|
||||
dec_error = 1
|
||||
return dec_error
|
||||
print('OK ')
|
||||
|
||||
|
||||
def decompress_dict(tag):
|
||||
@ -181,22 +176,13 @@ def decompress_dict(tag):
|
||||
if tag == 'v0.6.0' and dict_tag < 'v0.6.0':
|
||||
continue
|
||||
dict_name = 'dict.' + dict_tag
|
||||
print(file_zst + ' ' + tag + ' dict=' + dict_tag, end=' ')
|
||||
print(file_zst + ' ' + tag + ' dict=' + dict_tag)
|
||||
file_dec = file_zst + '_d64_' + tag + '.dec'
|
||||
if tag <= 'v0.5.0':
|
||||
params = ['./zstd.' + tag, '-D', dict_name, '-df', file_zst, file_dec]
|
||||
zstd(tag, ['-D', dict_name, '-d'], file_zst, file_dec)
|
||||
if not filecmp.cmp(file_dec, test_dat):
|
||||
raise RuntimeError('Decompression failed: tag={} file={}'.format(tag, file_zst))
|
||||
else:
|
||||
params = ['./zstd.' + tag, '-D', dict_name, '-df', file_zst, '-o', file_dec]
|
||||
if execute(params) == 0:
|
||||
if not filecmp.cmp(file_dec, test_dat):
|
||||
print('ERR !! ')
|
||||
dec_error = 1
|
||||
else:
|
||||
print('OK ')
|
||||
else:
|
||||
print('command does not work')
|
||||
dec_error = 1
|
||||
return dec_error
|
||||
print('OK ')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
@ -267,25 +253,19 @@ if __name__ == '__main__':
|
||||
print('Compress test.dat by all released zstd')
|
||||
print('-----------------------------------------------')
|
||||
|
||||
error_code = 0
|
||||
for tag in tags:
|
||||
print(tag)
|
||||
if tag >= 'v0.5.0':
|
||||
create_dict(tag, dict_source_path)
|
||||
dict_compress_sample(tag, test_dat)
|
||||
remove_duplicates()
|
||||
error_code += decompress_dict(tag)
|
||||
decompress_dict(tag)
|
||||
compress_sample(tag, test_dat)
|
||||
remove_duplicates()
|
||||
error_code += decompress_zst(tag)
|
||||
decompress_zst(tag)
|
||||
|
||||
print('')
|
||||
print('Enumerate different compressed files')
|
||||
zstds = sorted(glob.glob('*.zst'))
|
||||
for zstd in zstds:
|
||||
print(zstd + ' : ' + repr(os.path.getsize(zstd)) + ', ' + sha1_of_file(zstd))
|
||||
|
||||
if error_code != 0:
|
||||
print('====== ERROR !!! =======')
|
||||
|
||||
sys.exit(error_code)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
@ -39,7 +39,7 @@
|
||||
#include "seqgen.h"
|
||||
#include "util.h"
|
||||
#include "timefn.h" /* UTIL_time_t, UTIL_clockSpanMicro, UTIL_getTime */
|
||||
|
||||
#include "external_matchfinder.h" /* zstreamExternalMatchFinder, EMF_testCase */
|
||||
|
||||
/*-************************************
|
||||
* Constants
|
||||
@ -1834,6 +1834,97 @@ static int basicUnitTests(U32 seed, double compressibility, int bigTests)
|
||||
}
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
|
||||
DISPLAYLEVEL(3, "test%3i : External matchfinder API: ", testNb++);
|
||||
{
|
||||
size_t const dstBufSize = ZSTD_compressBound(CNBufferSize);
|
||||
BYTE* const dstBuf = (BYTE*)malloc(ZSTD_compressBound(dstBufSize));
|
||||
size_t const checkBufSize = CNBufferSize;
|
||||
BYTE* const checkBuf = (BYTE*)malloc(checkBufSize);
|
||||
int enableFallback;
|
||||
EMF_testCase externalMatchState;
|
||||
|
||||
CHECK(dstBuf == NULL || checkBuf == NULL, "allocation failed");
|
||||
|
||||
ZSTD_CCtx_reset(zc, ZSTD_reset_session_and_parameters);
|
||||
|
||||
/* Reference external matchfinder outside the test loop to
|
||||
* check that the reference is preserved across compressions */
|
||||
ZSTD_registerExternalMatchFinder(
|
||||
zc,
|
||||
&externalMatchState,
|
||||
zstreamExternalMatchFinder
|
||||
);
|
||||
|
||||
for (enableFallback = 0; enableFallback < 1; enableFallback++) {
|
||||
size_t testCaseId;
|
||||
|
||||
EMF_testCase const EMF_successCases[] = {
|
||||
EMF_ONE_BIG_SEQ,
|
||||
EMF_LOTS_OF_SEQS,
|
||||
};
|
||||
size_t const EMF_numSuccessCases = 2;
|
||||
|
||||
EMF_testCase const EMF_failureCases[] = {
|
||||
EMF_ZERO_SEQS,
|
||||
EMF_BIG_ERROR,
|
||||
EMF_SMALL_ERROR,
|
||||
};
|
||||
size_t const EMF_numFailureCases = 3;
|
||||
|
||||
/* Test external matchfinder success scenarios */
|
||||
for (testCaseId = 0; testCaseId < EMF_numSuccessCases; testCaseId++) {
|
||||
size_t res;
|
||||
externalMatchState = EMF_successCases[testCaseId];
|
||||
ZSTD_CCtx_reset(zc, ZSTD_reset_session_only);
|
||||
CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_enableMatchFinderFallback, enableFallback));
|
||||
res = ZSTD_compress2(zc, dstBuf, dstBufSize, CNBuffer, CNBufferSize);
|
||||
CHECK(ZSTD_isError(res), "EMF: Compression error: %s", ZSTD_getErrorName(res));
|
||||
CHECK_Z(ZSTD_decompress(checkBuf, checkBufSize, dstBuf, res));
|
||||
CHECK(memcmp(CNBuffer, checkBuf, CNBufferSize) != 0, "EMF: Corruption!");
|
||||
}
|
||||
|
||||
/* Test external matchfinder failure scenarios */
|
||||
for (testCaseId = 0; testCaseId < EMF_numFailureCases; testCaseId++) {
|
||||
size_t res;
|
||||
externalMatchState = EMF_failureCases[testCaseId];
|
||||
ZSTD_CCtx_reset(zc, ZSTD_reset_session_only);
|
||||
CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_enableMatchFinderFallback, enableFallback));
|
||||
res = ZSTD_compress2(zc, dstBuf, dstBufSize, CNBuffer, CNBufferSize);
|
||||
if (enableFallback) {
|
||||
CHECK_Z(ZSTD_decompress(checkBuf, checkBufSize, dstBuf, res));
|
||||
CHECK(memcmp(CNBuffer, checkBuf, CNBufferSize) != 0, "EMF: Corruption!");
|
||||
} else {
|
||||
CHECK(!ZSTD_isError(res), "EMF: Should have raised an error!");
|
||||
CHECK(
|
||||
ZSTD_getErrorCode(res) != ZSTD_error_externalMatchFinder_failed,
|
||||
"EMF: Wrong error code: %s", ZSTD_getErrorName(res)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/* Test compression with external matchfinder + empty src buffer */
|
||||
{
|
||||
size_t res;
|
||||
externalMatchState = EMF_ZERO_SEQS;
|
||||
ZSTD_CCtx_reset(zc, ZSTD_reset_session_only);
|
||||
CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_enableMatchFinderFallback, enableFallback));
|
||||
res = ZSTD_compress2(zc, dstBuf, dstBufSize, CNBuffer, 0);
|
||||
CHECK(ZSTD_isError(res), "EMF: Compression error: %s", ZSTD_getErrorName(res));
|
||||
CHECK(ZSTD_decompress(checkBuf, checkBufSize, dstBuf, res) != 0, "EMF: Empty src round trip failed!");
|
||||
}
|
||||
}
|
||||
|
||||
/* Test that reset clears the external matchfinder */
|
||||
ZSTD_CCtx_reset(zc, ZSTD_reset_session_and_parameters);
|
||||
externalMatchState = EMF_BIG_ERROR; /* ensure zstd will fail if the matchfinder wasn't cleared */
|
||||
CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_enableMatchFinderFallback, 0));
|
||||
CHECK_Z(ZSTD_compress2(zc, dstBuf, dstBufSize, CNBuffer, CNBufferSize));
|
||||
|
||||
free(dstBuf);
|
||||
free(checkBuf);
|
||||
}
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
|
||||
_end:
|
||||
FUZ_freeDictionary(dictionary);
|
||||
ZSTD_freeCStream(zc);
|
||||
|
Reference in New Issue
Block a user