Skip to content

Commit 4fa456d

Browse files
authored
Merge pull request #1354 from facebook/dev
Zstandard v1.3.6
2 parents 90ae502 + 33d6431 commit 4fa456d

File tree

139 files changed

+12190
-2862
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+12190
-2862
lines changed

.circleci/config.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
version: 2
2+
3+
references:
4+
# Install the dependencies required for tests.
5+
# Add the step "- *install-dependencies" to the beginning of your job to run
6+
# this command.
7+
install-dependencies: &install-dependencies
8+
run:
9+
name: Install dependencies
10+
# TODO: We can split these dependencies up by job to reduce installation
11+
# time.
12+
command: |
13+
sudo dpkg --add-architecture i386
14+
sudo apt-get -y -qq update
15+
sudo apt-get -y install \
16+
gcc-multilib-powerpc-linux-gnu gcc-arm-linux-gnueabi \
17+
libc6-dev-armel-cross gcc-aarch64-linux-gnu libc6-dev-arm64-cross \
18+
libc6-dev-ppc64-powerpc-cross
19+
20+
jobs:
21+
# the first half of the jobs are in this test
22+
short-tests-0:
23+
# TODO: Create a small custom docker image with all the dependencies we need
24+
# preinstalled to reduce installation time.
25+
docker:
26+
- image: circleci/buildpack-deps:bionic
27+
steps:
28+
- checkout
29+
- *install-dependencies
30+
- run:
31+
name: Test
32+
command: |
33+
cc -v; CFLAGS="-O0 -Werror" make all && make clean
34+
make c99build ; make clean
35+
make c11build ; make clean
36+
make aarch64build ; make clean
37+
make -j regressiontest; make clean
38+
make shortest ; make clean
39+
make cxxtest ; make clean
40+
# the second half of the jobs are in this test
41+
short-tests-1:
42+
docker:
43+
- image: circleci/buildpack-deps:bionic
44+
steps:
45+
- checkout
46+
- *install-dependencies
47+
- run:
48+
name: Test
49+
command: |
50+
make gnu90build; make clean
51+
make gnu99build; make clean
52+
make ppc64build; make clean
53+
make ppcbuild ; make clean
54+
make armbuild ; make clean
55+
make -C tests test-legacy test-longmatch test-symbols; make clean
56+
make -C lib libzstd-nomt; make clean
57+
# This step is only run on release tags.
58+
# It publishes the source tarball as artifacts and if the GITHUB_TOKEN
59+
# environment variable is set it will publish the source tarball to the
60+
# tagged release.
61+
publish-github-release:
62+
docker:
63+
- image: cibuilds/github:0.12.0
64+
environment:
65+
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
66+
steps:
67+
- checkout
68+
- run:
69+
name: Install dependencies
70+
command: |
71+
apk add -q gzip coreutils
72+
- run:
73+
name: Publish
74+
command: |
75+
export VERSION=$(echo $CIRCLE_TAG | tail -c +2)
76+
export ZSTD_VERSION=zstd-$VERSION
77+
git archive $CIRCLE_TAG --prefix $ZSTD_VERSION/ --format tar \
78+
-o $ZSTD_VERSION.tar
79+
gzip -9 $ZSTD_VERSION.tar
80+
sha256sum $ZSTD_VERSION.tar.gz > $ZSTD_VERSION.tar.gz.sha256sum
81+
mkdir -p $CIRCLE_ARTIFACTS
82+
cp $ZSTD_VERSION.tar.gz{,.sha256sum} $CIRCLE_ARTIFACTS
83+
- store_artifacts:
84+
path: /tmp/circleci-artifacts
85+
86+
workflows:
87+
version: 2
88+
commit:
89+
jobs:
90+
# Run the tests in parallel
91+
- short-tests-0:
92+
filters:
93+
tags:
94+
only: /.*/
95+
- short-tests-1:
96+
filters:
97+
tags:
98+
only: /.*/
99+
# Only run on release tags.
100+
- publish-github-release:
101+
requires:
102+
- short-tests-0
103+
- short-tests-1
104+
filters:
105+
branches:
106+
ignore: /.*/
107+
tags:
108+
only: /^v\d+\.\d+\.\d+$/
109+
110+
# Longer tests
111+
#- make -C tests test-zstd-nolegacy && make clean
112+
#- pyenv global 3.4.4; make -C tests versionsTest && make clean
113+
#- make zlibwrapper && make clean
114+
#- gcc -v; make -C tests test32 MOREFLAGS="-I/usr/include/x86_64-linux-gnu" && make clean
115+
#- make uasan && make clean
116+
#- make asan32 && make clean
117+
#- make -C tests test32 CC=clang MOREFLAGS="-g -fsanitize=address -I/usr/include/x86_64-linux-gnu"
118+
# Valgrind tests
119+
#- CFLAGS="-O1 -g" make -C zlibWrapper valgrindTest && make clean
120+
#- make -C tests valgrindTest && make clean
121+
# ARM, AArch64, PowerPC, PowerPC64 tests
122+
#- make ppctest && make clean
123+
#- make ppc64test && make clean
124+
#- make armtest && make clean
125+
#- make aarch64test && make clean

.travis.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,38 @@ addons:
1010
matrix:
1111
include:
1212
# Ubuntu 14.04
13-
- env: Cmd='make gcc6install && CC=gcc-6 make -j all && make clean && CC=gcc-6 make clean uasan-test-zstd'
14-
- env: Cmd='make gcc6install libc6install && CC=gcc-6 make clean uasan-test-zstd32'
15-
- env: Cmd='make gcc7install && CC=gcc-7 make clean uasan-test-zstd'
13+
- env: Cmd='make test'
14+
15+
- env: Cmd='make gcc6install && CC=gcc-6 CFLAGS=-Werror make -j all
16+
&& make clean && CC=gcc-6 make -j uasan-test-zstd </dev/null' # test when stdin is not a tty
17+
- env: Cmd='make gcc6install libc6install
18+
&& make clean && CC=gcc-6 make -j uasan-test-zstd32'
19+
- env: Cmd='make gcc7install && make clean && CC=gcc-7 make -j uasan-test-zstd'
20+
- env: Cmd='make gcc8install && CC=gcc-8 CFLAGS="-Werror -O3" make -j all'
1621
- env: Cmd='make clang38install && CC=clang-3.8 make clean msan-test-zstd'
1722

23+
- env: Cmd='make staticAnalyze'
24+
1825
- env: Cmd='make gcc6install && CC=gcc-6 make clean uasan-fuzztest'
19-
- env: Cmd='make gcc6install libc6install && CC=gcc-6 CFLAGS=-m32 make clean uasan-fuzztest'
26+
- env: Cmd='make gcc6install libc6install
27+
&& make clean && CC=gcc-6 CFLAGS=-m32 make uasan-fuzztest'
2028
- env: Cmd='make clang38install && CC=clang-3.8 make clean msan-fuzztest'
2129
- env: Cmd='make clang38install && CC=clang-3.8 make clean tsan-test-zstream'
2230

23-
- env: Cmd='make -C tests test-fuzzer-stackmode'
31+
- env: Cmd='make -j uasanregressiontest
32+
&& make clean && make -j msanregressiontest'
2433

25-
- env: Cmd='make valgrindinstall && make -C tests clean valgrindTest'
34+
- env: Cmd='make valgrindinstall && make -C tests clean valgrindTest
35+
&& make clean && make -C tests test-fuzzer-stackmode'
2636

2737
- env: Cmd='make arminstall && make armfuzz'
2838
- env: Cmd='make arminstall && make aarch64fuzz'
29-
3039
- env: Cmd='make ppcinstall && make ppcfuzz'
3140
- env: Cmd='make ppcinstall && make ppc64fuzz'
32-
- env: Cmd='make -j uasanregressiontest && make clean && make -j msanregressiontest'
3341

34-
- env: Cmd='make lz4install && make -C tests test-lz4 test-pool && make clean && bash tests/libzstd_partial_builds.sh'
42+
- env: Cmd='make lz4install && make -C tests test-lz4
43+
&& make clean && make -C tests test-pool
44+
&& make clean && bash tests/libzstd_partial_builds.sh'
3545

3646
# tag-specific test
3747
- if: tag =~ ^v[0-9]\.[0-9]
@@ -52,6 +62,7 @@ branches:
5262
only:
5363
- dev
5464
- master
65+
- travisTest
5566

5667
script:
5768
- JOB_NUMBER=$(echo $TRAVIS_JOB_NUMBER | sed -e 's:[0-9][0-9]*\.\(.*\):\1:')

CODE_OF_CONDUCT.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Code of Conduct
2+
3+
Facebook has adopted a Code of Conduct that we expect project participants to adhere to.
4+
Please read the [full text](https://code.fb.com/codeofconduct/)
5+
so that you can understand what actions will and will not be tolerated.

Makefile

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ else
2323
EXT =
2424
endif
2525

26+
## default: Build lib-release and zstd-release
2627
.PHONY: default
2728
default: lib-release zstd-release
2829

2930
.PHONY: all
3031
all: allmost examples manual contrib
3132

3233
.PHONY: allmost
33-
allmost: allzstd
34-
$(MAKE) -C $(ZWRAPDIR) all
34+
allmost: allzstd zlibwrapper
3535

36-
#skip zwrapper, can't build that on alternate architectures without the proper zlib installed
36+
# skip zwrapper, can't build that on alternate architectures without the proper zlib installed
3737
.PHONY: allzstd
3838
allzstd: lib
3939
$(MAKE) -C $(PRGDIR) all
@@ -44,8 +44,8 @@ all32:
4444
$(MAKE) -C $(PRGDIR) zstd32
4545
$(MAKE) -C $(TESTDIR) all32
4646

47-
.PHONY: lib lib-release
48-
lib lib-release:
47+
.PHONY: lib lib-release libzstd.a
48+
lib lib-release :
4949
@$(MAKE) -C $(ZSTDDIR) $@
5050

5151
.PHONY: zstd zstd-release
@@ -59,12 +59,13 @@ zstdmt:
5959
cp $(PRGDIR)/zstd$(EXT) ./zstdmt$(EXT)
6060

6161
.PHONY: zlibwrapper
62-
zlibwrapper:
63-
$(MAKE) -C $(ZWRAPDIR) test
62+
zlibwrapper: lib
63+
$(MAKE) -C $(ZWRAPDIR) all
6464

6565
.PHONY: test
66+
test: MOREFLAGS += -g -DDEBUGLEVEL=1 -Werror
6667
test:
67-
$(MAKE) -C $(PRGDIR) allVariants MOREFLAGS+="-g -DDEBUGLEVEL=1"
68+
MOREFLAGS="$(MOREFLAGS)" $(MAKE) -j -C $(PRGDIR) allVariants
6869
$(MAKE) -C $(TESTDIR) $@
6970

7071
.PHONY: shortest
@@ -87,6 +88,7 @@ contrib: lib
8788
$(MAKE) -C contrib/pzstd all
8889
$(MAKE) -C contrib/seekable_format/examples all
8990
$(MAKE) -C contrib/adaptive-compression all
91+
$(MAKE) -C contrib/largeNbDicts all
9092

9193
.PHONY: cleanTabs
9294
cleanTabs:
@@ -103,21 +105,39 @@ clean:
103105
@$(MAKE) -C contrib/pzstd $@ > $(VOID)
104106
@$(MAKE) -C contrib/seekable_format/examples $@ > $(VOID)
105107
@$(MAKE) -C contrib/adaptive-compression $@ > $(VOID)
108+
@$(MAKE) -C contrib/largeNbDicts $@ > $(VOID)
106109
@$(RM) zstd$(EXT) zstdmt$(EXT) tmp*
107110
@$(RM) -r lz4
108111
@echo Cleaning completed
109112

110113
#------------------------------------------------------------------------------
111114
# make install is validated only for Linux, macOS, Hurd and some BSD targets
112115
#------------------------------------------------------------------------------
113-
ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD DragonFly NetBSD MSYS_NT))
116+
ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD DragonFly NetBSD MSYS_NT Haiku))
114117

115118
HOST_OS = POSIX
116-
CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON
119+
CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON -DCMAKE_BUILD_TYPE=Release
120+
121+
EGREP = egrep --color=never
117122

123+
# Print a two column output of targets and their description. To add a target description, put a
124+
# comment in the Makefile with the format "## <TARGET>: <DESCRIPTION>". For example:
125+
#
126+
## list: Print all targets and their descriptions (if provided)
118127
.PHONY: list
119128
list:
120-
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs
129+
@TARGETS=$$($(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null \
130+
| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
131+
| $(EGREP) -v -e '^[^[:alnum:]]' | sort); \
132+
{ \
133+
printf "Target Name\tDescription\n"; \
134+
printf "%0.s-" {1..16}; printf "\t"; printf "%0.s-" {1..40}; printf "\n"; \
135+
for target in $$TARGETS; do \
136+
line=$$($(EGREP) "^##[[:space:]]+$$target:" $(lastword $(MAKEFILE_LIST))); \
137+
description=$$(echo $$line | awk '{i=index($$0,":"); print substr($$0,i+1)}' | xargs); \
138+
printf "$$target\t$$description\n"; \
139+
done \
140+
} | column -t -s $$'\t'
121141

122142
.PHONY: install clangtest armtest usan asan uasan
123143
install:
@@ -197,7 +217,7 @@ gcc6test: clean
197217

198218
clangtest: clean
199219
clang -v
200-
$(MAKE) all CXX=clang-++ CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation"
220+
$(MAKE) all CXX=clang++ CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation"
201221

202222
armtest: clean
203223
$(MAKE) -C $(TESTDIR) datagen # use native, faster
@@ -286,6 +306,9 @@ gcc6install: apt-add-repo
286306
gcc7install: apt-add-repo
287307
APT_PACKAGES="libc6-dev-i386 gcc-multilib gcc-7 gcc-7-multilib" $(MAKE) apt-install
288308

309+
gcc8install: apt-add-repo
310+
APT_PACKAGES="libc6-dev-i386 gcc-multilib gcc-8 gcc-8-multilib" $(MAKE) apt-install
311+
289312
gpp6install: apt-add-repo
290313
APT_PACKAGES="libc6-dev-i386 g++-multilib gcc-6 g++-6 g++-6-multilib" $(MAKE) apt-install
291314

@@ -317,23 +340,23 @@ cmakebuild:
317340

318341
c90build: clean
319342
$(CC) -v
320-
CFLAGS="-std=c90" $(MAKE) allmost # will fail, due to missing support for `long long`
343+
CFLAGS="-std=c90 -Werror" $(MAKE) allmost # will fail, due to missing support for `long long`
321344

322345
gnu90build: clean
323346
$(CC) -v
324-
CFLAGS="-std=gnu90" $(MAKE) allmost
347+
CFLAGS="-std=gnu90 -Werror" $(MAKE) allmost
325348

326349
c99build: clean
327350
$(CC) -v
328-
CFLAGS="-std=c99" $(MAKE) allmost
351+
CFLAGS="-std=c99 -Werror" $(MAKE) allmost
329352

330353
gnu99build: clean
331354
$(CC) -v
332-
CFLAGS="-std=gnu99" $(MAKE) allmost
355+
CFLAGS="-std=gnu99 -Werror" $(MAKE) allmost
333356

334357
c11build: clean
335358
$(CC) -v
336-
CFLAGS="-std=c11" $(MAKE) allmost
359+
CFLAGS="-std=c11 -Werror" $(MAKE) allmost
337360

338361
bmix64build: clean
339362
$(CC) -v
@@ -347,7 +370,10 @@ bmi32build: clean
347370
$(CC) -v
348371
CFLAGS="-O3 -mbmi -m32 -Werror" $(MAKE) -C $(TESTDIR) test
349372

350-
staticAnalyze: clean
373+
# static analyzer test uses clang's scan-build
374+
# does not analyze zlibWrapper, due to detected issues in zlib source code
375+
staticAnalyze: SCANBUILD ?= scan-build
376+
staticAnalyze:
351377
$(CC) -v
352-
CPPFLAGS=-g scan-build --status-bugs -v $(MAKE) all
378+
CC=$(CC) CPPFLAGS=-g $(SCANBUILD) --status-bugs -v $(MAKE) allzstd examples contrib
353379
endif

NEWS

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
v1.3.6
2+
perf: much faster dictionary builder, by @jenniferliu
3+
perf: faster dictionary compression on small data when using multiple contexts, by @felixhandte
4+
perf: faster dictionary decompression when using a very large number of dictionaries simultaneously
5+
cli : fix : does no longer overwrite destination when source does not exist (#1082)
6+
cli : new command --adapt, for automatic compression level adaptation
7+
api : fix : block api can be streamed with > 4 GB, reported by @catid
8+
api : reduced ZSTD_DDict size by 2 KB
9+
api : minimum negative compression level is defined, and can be queried using ZSTD_minCLevel().
10+
build: support Haiku target, by @korli
11+
build: Read Legacy format is limited to v0.5+ by default. Can be changed at compile time with macro ZSTD_LEGACY_SUPPORT.
12+
doc : zstd_compression_format.md updated to match wording in IETF RFC 8478
13+
misc: tests/paramgrill, a parameter optimizer, by @GeorgeLu97
14+
115
v1.3.5
216
perf: much faster dictionary compression, by @felixhandte
317
perf: small quality improvement for dictionary generation, by @terrelln

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ A `cmake` project generator is provided within `build/cmake`.
121121
It can generate Makefiles or other build scripts
122122
to create `zstd` binary, and `libzstd` dynamic and static libraries.
123123

124+
By default, `CMAKE_BUILD_TYPE` is set to `Release`.
125+
124126
#### Meson
125127

126128
A Meson project is provided within `contrib/meson`.

appveyor.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,15 @@
181181
- COMPILER: "gcc"
182182
HOST: "mingw"
183183
PLATFORM: "x64"
184-
SCRIPT: "make allzstd"
184+
SCRIPT: "CPPFLAGS=-DDEBUGLEVEL=2 CFLAGS=-Werror make -j allzstd DEBUGLEVEL=2"
185185
- COMPILER: "gcc"
186186
HOST: "mingw"
187187
PLATFORM: "x86"
188-
SCRIPT: "make allzstd"
188+
SCRIPT: "CFLAGS=-Werror make -j allzstd"
189189
- COMPILER: "clang"
190190
HOST: "mingw"
191191
PLATFORM: "x64"
192-
SCRIPT: "MOREFLAGS='--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion' make allzstd"
192+
SCRIPT: "CFLAGS='--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion' make -j allzstd"
193193

194194
- COMPILER: "visual"
195195
HOST: "visual"

0 commit comments

Comments
 (0)