648db22b |
1 | |
2 | # ################################################################ |
3 | # Copyright (c) Meta Platforms, Inc. and affiliates. |
4 | # All rights reserved. |
5 | # |
6 | # This source code is licensed under both the BSD-style license (found in the |
7 | # LICENSE file in the root directory of this source tree) and the GPLv2 (found |
8 | # in the COPYING file in the root directory of this source tree). |
9 | # You may select, at your option, one of the above-listed licenses. |
10 | # ################################################################ |
11 | # datagen : Synthetic and parametrable data generator, for tests |
12 | # fullbench : Precisely measure speed for each zstd inner functions |
13 | # fullbench32: Same as fullbench, but forced to compile in 32-bits mode |
14 | # fuzzer : Test tool, to check zstd integrity on target platform |
15 | # fuzzer32: Same as fuzzer, but forced to compile in 32-bits mode |
16 | # paramgrill : parameter tester for zstd |
17 | # test-zstd-speed.py : script for testing zstd speed difference between commits |
18 | # versionsTest : compatibility test between zstd versions stored on Github (v0.1+) |
19 | # zstreamtest : Fuzzer test tool for zstd streaming API |
20 | # zstreamtest32: Same as zstreamtest, but forced to compile in 32-bits mode |
21 | # ########################################################################## |
22 | |
f535537f |
23 | ZSTD_LEGACY_SUPPORT ?= 5 |
24 | export ZSTD_LEGACY_SUPPORT |
648db22b |
25 | |
26 | DEBUGLEVEL ?= 2 |
27 | export DEBUGLEVEL # transmit value to sub-makefiles |
28 | |
f535537f |
29 | LIBZSTD_MK_DIR := ../lib |
30 | include $(LIBZSTD_MK_DIR)/libzstd.mk |
648db22b |
31 | |
648db22b |
32 | PRGDIR = ../programs |
33 | PYTHON ?= python3 |
34 | TESTARTEFACT := versionsTest |
35 | |
36 | DEBUGFLAGS += -g -Wno-c++-compat |
f535537f |
37 | CPPFLAGS += -I$(LIB_SRCDIR) -I$(LIB_SRCDIR)/common -I$(LIB_SRCDIR)/compress -I$(LIB_SRCDIR)/legacy \ |
38 | -I$(LIB_SRCDIR)/dictBuilder -I$(LIB_SRCDIR)/deprecated -I$(PRGDIR) \ |
648db22b |
39 | -DZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY=1 |
40 | |
41 | ZSTDCOMMON_FILES := $(sort $(ZSTD_COMMON_FILES)) |
42 | ZSTDCOMP_FILES := $(sort $(ZSTD_COMPRESS_FILES)) |
43 | ZSTDDECOMP_FILES := $(sort $(ZSTD_DECOMPRESS_FILES)) |
f535537f |
44 | ZSTDLEGACY_FILES := $(sort $(wildcard $(LIB_SRCDIR)/legacy/*.c)) |
45 | ZSTD_FILES := $(ZSTDDECOMP_FILES) $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES) $(ZSTDLEGACY_FILES) |
648db22b |
46 | ZDICT_FILES := $(sort $(ZSTD_DICTBUILDER_FILES)) |
47 | |
48 | ZSTD_F1 := $(sort $(wildcard $(ZSTD_FILES))) |
f535537f |
49 | ZSTD_OBJ1 := $(subst $(LIB_SRCDIR)/common/,zstdm_,$(ZSTD_F1)) |
50 | ZSTD_OBJ2 := $(subst $(LIB_SRCDIR)/compress/,zstdc_,$(ZSTD_OBJ1)) |
51 | ZSTD_OBJ3 := $(subst $(LIB_SRCDIR)/decompress/,zstdd_,$(ZSTD_OBJ2)) |
52 | ZSTD_OBJ4 := $(subst $(LIB_SRCDIR)/legacy/,zstdl_,$(ZSTD_OBJ3)) |
53 | ZSTD_OBJ5 := $(ZSTD_OBJ4:.c=.o) |
54 | ZSTD_OBJECTS := $(ZSTD_OBJ5:.S=.o) |
55 | |
56 | ZSTDMT_OBJ1 := $(subst $(LIB_SRCDIR)/common/,zstdmt_m_,$(ZSTD_F1)) |
57 | ZSTDMT_OBJ2 := $(subst $(LIB_SRCDIR)/compress/,zstdmt_c_,$(ZSTDMT_OBJ1)) |
58 | ZSTDMT_OBJ3 := $(subst $(LIB_SRCDIR)/decompress/,zstdmt_d_,$(ZSTDMT_OBJ2)) |
59 | ZSTDMT_OBJ4 := $(subst $(LIB_SRCDIR)/legacy/,zstdmt_l_,$(ZSTDMT_OBJ3)) |
60 | ZSTDMT_OBJ5 := $(ZSTDMT_OBJ4:.c=.o) |
61 | ZSTDMT_OBJECTS := $(ZSTDMT_OBJ5:.S=.o) |
648db22b |
62 | |
63 | # Define *.exe as extension for Windows systems |
64 | ifneq (,$(filter Windows%,$(OS))) |
65 | EXT =.exe |
66 | MULTITHREAD_CPP = -DZSTD_MULTITHREAD |
67 | MULTITHREAD_LD = |
68 | else |
69 | EXT = |
70 | MULTITHREAD_CPP = -DZSTD_MULTITHREAD |
71 | MULTITHREAD_LD = -pthread |
72 | endif |
73 | MULTITHREAD = $(MULTITHREAD_CPP) $(MULTITHREAD_LD) |
74 | |
75 | VOID = /dev/null |
76 | ZSTREAM_TESTTIME ?= -T90s |
77 | FUZZERTEST ?= -T200s |
78 | ZSTDRTTEST = --test-large-data |
79 | DECODECORPUS_TESTTIME ?= -T30 |
80 | |
81 | .PHONY: default |
82 | default: fullbench |
83 | |
84 | .PHONY: all |
85 | all: fullbench fuzzer zstreamtest paramgrill datagen decodecorpus roundTripCrash poolTests |
86 | |
87 | .PHONY: all32 |
88 | all32: fullbench32 fuzzer32 zstreamtest32 |
89 | |
90 | .PHONY: allnothread |
91 | allnothread: MULTITHREAD_CPP= |
92 | allnothread: MULTITHREAD_LD= |
93 | allnothread: fullbench fuzzer paramgrill datagen decodecorpus |
94 | |
95 | # note : broken : requires symbols unavailable from dynamic library |
96 | .PHONY: dll |
97 | dll: fuzzer-dll zstreamtest-dll |
98 | |
99 | .PHONY: zstd zstd32 zstd-nolegacy # only external makefile knows how to build or update them |
100 | zstd zstd32 zstd-nolegacy zstd-dll: |
101 | $(MAKE) -C $(PRGDIR) $@ MOREFLAGS+="$(DEBUGFLAGS)" |
102 | |
103 | .PHONY: libzstd |
104 | libzstd : |
f535537f |
105 | $(MAKE) -C $(LIB_SRCDIR) libzstd MOREFLAGS+="$(DEBUGFLAGS)" |
648db22b |
106 | |
107 | %-dll : libzstd |
f535537f |
108 | %-dll : LDFLAGS += -L$(LIB_BINDIR) -lzstd |
648db22b |
109 | |
f535537f |
110 | $(LIB_BINDIR)/libzstd.a : |
111 | $(MAKE) -C $(LIB_SRCDIR) libzstd.a |
648db22b |
112 | |
f535537f |
113 | zstdm_%.o : $(LIB_SRCDIR)/common/%.c |
648db22b |
114 | $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ |
115 | |
f535537f |
116 | zstdc_%.o : $(LIB_SRCDIR)/compress/%.c |
648db22b |
117 | $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ |
118 | |
f535537f |
119 | zstdd_%.o : $(LIB_SRCDIR)/decompress/%.c |
648db22b |
120 | $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ |
121 | |
f535537f |
122 | zstdd_%.o : $(LIB_SRCDIR)/decompress/%.S |
648db22b |
123 | $(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@ |
124 | |
f535537f |
125 | zstdl_%.o : $(LIB_SRCDIR)/legacy/%.c |
126 | $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ |
127 | |
648db22b |
128 | zstdmt%.o : CPPFLAGS += $(MULTITHREAD_CPP) |
129 | |
f535537f |
130 | zstdmt_m_%.o : $(LIB_SRCDIR)/common/%.c |
648db22b |
131 | $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ |
132 | |
f535537f |
133 | zstdmt_c_%.o : $(LIB_SRCDIR)/compress/%.c |
648db22b |
134 | $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ |
135 | |
f535537f |
136 | zstdmt_d_%.o : $(LIB_SRCDIR)/decompress/%.c |
648db22b |
137 | $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ |
138 | |
f535537f |
139 | zstdmt_d_%.o : $(LIB_SRCDIR)/decompress/%.S |
648db22b |
140 | $(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@ |
141 | |
f535537f |
142 | zstdmt_l_%.o : $(LIB_SRCDIR)/legacy/%.c |
143 | $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ |
144 | |
648db22b |
145 | FULLBENCHS := fullbench fullbench32 |
146 | CLEAN += $(FULLBENCHS) |
147 | fullbench32: CPPFLAGS += -m32 |
148 | $(FULLBENCHS) : CPPFLAGS += $(MULTITHREAD_CPP) -Wno-deprecated-declarations |
149 | $(FULLBENCHS) : LDFLAGS += $(MULTITHREAD_LD) |
150 | $(FULLBENCHS) : DEBUGFLAGS = -DNDEBUG # turn off assert() for speed measurements |
151 | $(FULLBENCHS) : $(ZSTD_FILES) |
152 | $(FULLBENCHS) : $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/benchfn.c fullbench.c |
153 | $(LINK.c) $^ -o $@$(EXT) |
154 | |
155 | CLEAN += fullbench-lib |
156 | fullbench-lib : CPPFLAGS += -DXXH_NAMESPACE=ZSTD_ |
f535537f |
157 | fullbench-lib : $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/benchfn.c $(LIB_SRCDIR)/libzstd.a fullbench.c |
648db22b |
158 | $(LINK.c) $^ -o $@$(EXT) |
159 | |
160 | # note : broken : requires symbols unavailable from dynamic library |
161 | fullbench-dll: $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/benchfn.c $(PRGDIR)/timefn.c fullbench.c |
f535537f |
162 | # $(CC) $(FLAGS) $(filter %.c,$^) -o $@$(EXT) -DZSTD_DLL_IMPORT=1 $(LIB_SRCDIR)/dll/libzstd.dll |
648db22b |
163 | $(LINK.c) $^ $(LDLIBS) -o $@$(EXT) |
164 | |
165 | CLEAN += fuzzer fuzzer32 |
166 | fuzzer : CPPFLAGS += $(MULTITHREAD_CPP) -Wno-deprecated-declarations |
167 | fuzzer : LDFLAGS += $(MULTITHREAD_LD) |
168 | fuzzer : $(ZSTDMT_OBJECTS) |
169 | fuzzer fuzzer32 : $(ZDICT_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/datagen.c fuzzer.c |
170 | |
171 | fuzzer32 : CFLAGS += -m32 $(MULTITHREAD) |
172 | fuzzer32 : $(ZSTD_FILES) |
173 | $(LINK.c) $^ -o $@$(EXT) |
174 | |
175 | # note : broken : requires symbols unavailable from dynamic library |
f535537f |
176 | fuzzer-dll : $(LIB_SRCDIR)/common/xxhash.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/datagen.c fuzzer.c |
648db22b |
177 | $(CC) $(CPPFLAGS) $(CFLAGS) $(filter %.c,$^) $(LDFLAGS) -o $@$(EXT) |
178 | |
179 | CLEAN += zstreamtest zstreamtest32 |
180 | ZSTREAM_LOCAL_FILES := $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c seqgen.c zstreamtest.c external_matchfinder.c |
181 | ZSTREAM_PROPER_FILES := $(ZDICT_FILES) $(ZSTREAM_LOCAL_FILES) |
182 | ZSTREAMFILES := $(ZSTD_FILES) $(ZSTREAM_PROPER_FILES) |
183 | zstreamtest32 : CFLAGS += -m32 |
184 | zstreamtest zstreamtest32 : CPPFLAGS += $(MULTITHREAD_CPP) |
185 | zstreamtest zstreamtest32 : LDFLAGS += $(MULTITHREAD_LD) |
186 | zstreamtest : $(ZSTDMT_OBJECTS) $(ZSTREAM_PROPER_FILES) |
187 | zstreamtest32 : $(ZSTREAMFILES) |
188 | zstreamtest zstreamtest32 : |
189 | $(LINK.c) $^ -o $@$(EXT) |
190 | |
191 | CLEAN += zstreamtest_asan |
192 | zstreamtest_asan : CFLAGS += -fsanitize=address |
193 | zstreamtest_asan : $(ZSTREAMFILES) |
194 | $(LINK.c) $(MULTITHREAD) $^ -o $@$(EXT) |
195 | |
196 | CLEAN += zstreamtest_tsan |
197 | zstreamtest_tsan : CFLAGS += -fsanitize=thread |
198 | zstreamtest_tsan : $(ZSTREAMFILES) |
199 | $(LINK.c) $(MULTITHREAD) $^ -o $@$(EXT) |
200 | |
201 | CLEAN += zstreamtest_ubsan |
202 | zstreamtest_ubsan : CFLAGS += -fsanitize=undefined |
203 | zstreamtest_ubsan : $(ZSTREAMFILES) |
204 | $(LINK.c) $(MULTITHREAD) $^ -o $@$(EXT) |
205 | |
206 | # note : broken : requires symbols unavailable from dynamic library |
f535537f |
207 | zstreamtest-dll : $(LIB_SRCDIR)/common/xxhash.c # xxh symbols not exposed from dll |
648db22b |
208 | zstreamtest-dll : $(ZSTREAM_LOCAL_FILES) |
209 | $(CC) $(CPPFLAGS) $(CFLAGS) $(filter %.c,$^) $(LDFLAGS) -o $@$(EXT) |
210 | |
211 | CLEAN += paramgrill |
212 | paramgrill : DEBUGFLAGS = # turn off debug for speed measurements |
213 | paramgrill : LDLIBS += -lm |
f535537f |
214 | paramgrill : $(ZSTD_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/benchfn.c $(PRGDIR)/benchzstd.c $(PRGDIR)/datagen.c $(PRGDIR)/lorem.c paramgrill.c |
648db22b |
215 | |
216 | CLEAN += datagen |
f535537f |
217 | datagen : $(PRGDIR)/datagen.c $(PRGDIR)/lorem.c loremOut.c datagencli.c |
648db22b |
218 | $(LINK.c) $^ -o $@$(EXT) |
219 | |
220 | CLEAN += roundTripCrash |
221 | roundTripCrash: CFLAGS += $(MULTITHREAD) |
222 | roundTripCrash : $(ZSTD_OBJECTS) roundTripCrash.c |
223 | |
224 | CLEAN += longmatch |
225 | longmatch : $(ZSTD_OBJECTS) longmatch.c |
226 | |
227 | CLEAN += bigdict |
228 | bigdict: CFLAGS += $(MULTITHREAD) |
229 | bigdict: $(ZSTDMT_OBJECTS) $(PRGDIR)/datagen.c bigdict.c |
230 | |
231 | CLEAN += invalidDictionaries |
232 | invalidDictionaries : $(ZSTD_OBJECTS) invalidDictionaries.c |
233 | |
234 | CLEAN += legacy |
f535537f |
235 | legacy : CPPFLAGS += -UZSTD_LEGACY_SUPPORT -DZSTD_LEGACY_SUPPORT=4 |
236 | legacy : $(ZSTD_FILES) legacy.c |
648db22b |
237 | |
238 | CLEAN += decodecorpus |
239 | decodecorpus : LDLIBS += -lm |
240 | decodecorpus : $(filter-out zstdc_zstd_compress.o, $(ZSTD_OBJECTS)) $(ZDICT_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c decodecorpus.c |
241 | |
242 | CLEAN += poolTests |
f535537f |
243 | poolTests : $(PRGDIR)/util.c $(PRGDIR)/timefn.c poolTests.c $(LIB_SRCDIR)/common/pool.c $(LIB_SRCDIR)/common/threading.c $(LIB_SRCDIR)/common/zstd_common.c $(LIB_SRCDIR)/common/error_private.c |
648db22b |
244 | $(LINK.c) $(MULTITHREAD) $^ -o $@$(EXT) |
245 | |
246 | .PHONY: versionsTest |
247 | versionsTest: clean |
248 | $(PYTHON) test-zstd-versions.py |
249 | |
250 | .PHONY: automated_benchmarking |
251 | automated_benchmarking: clean |
252 | $(PYTHON) automated_benchmarking.py |
253 | |
254 | # make checkTag : check that release tag corresponds to release version |
255 | CLEAN += checkTag |
f535537f |
256 | checkTag.o : $(LIB_SRCDIR)/zstd.h |
648db22b |
257 | |
258 | .PHONY: clean |
259 | clean: |
f535537f |
260 | $(MAKE) -C $(LIB_SRCDIR) clean |
648db22b |
261 | $(MAKE) -C $(PRGDIR) clean |
f535537f |
262 | $(MAKE) -C fuzz clean |
263 | $(RM) -R $(TESTARTEFACT) |
264 | $(RM) -r tmp* # some test directories are named tmp* |
648db22b |
265 | $(RM) $(CLEAN) core *.o *.tmp result* *.gcda dictionary *.zst \ |
266 | $(PRGDIR)/zstd$(EXT) $(PRGDIR)/zstd32$(EXT) \ |
267 | fullbench-dll$(EXT) fuzzer-dll$(EXT) zstreamtest-dll$(EXT) |
268 | @echo Cleaning completed |
269 | |
270 | |
271 | #---------------------------------------------------------------------------------- |
272 | # valgrind tests validated only for some posix platforms |
273 | #---------------------------------------------------------------------------------- |
274 | UNAME := $(shell uname) |
f535537f |
275 | ifneq (,$(filter $(UNAME),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS AIX CYGWIN_NT)) |
648db22b |
276 | HOST_OS = POSIX |
277 | |
278 | .PHONY: test-valgrind |
279 | test-valgrind: VALGRIND = valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 |
280 | test-valgrind: zstd datagen fuzzer fullbench |
281 | @echo "\n ---- valgrind tests : memory analyzer ----" |
282 | $(VALGRIND) ./datagen -g50M > $(VOID) |
283 | $(VALGRIND) $(PRGDIR)/zstd ; if [ $$? -eq 0 ] ; then echo "zstd without argument should have failed"; false; fi |
284 | ./datagen -g80 | $(VALGRIND) $(PRGDIR)/zstd - -c > $(VOID) |
285 | ./datagen -g16KB | $(VALGRIND) $(PRGDIR)/zstd -vf - -c > $(VOID) |
286 | ./datagen -g2930KB | $(VALGRIND) $(PRGDIR)/zstd -5 -vf - -o tmp |
287 | $(VALGRIND) $(PRGDIR)/zstd -vdf tmp -c > $(VOID) |
288 | ./datagen -g64MB | $(VALGRIND) $(PRGDIR)/zstd -vf - -c > $(VOID) |
289 | $(RM) tmp |
290 | $(VALGRIND) ./fuzzer -T1mn -t1 |
291 | $(VALGRIND) ./fullbench -i1 |
292 | |
293 | endif |
294 | |
295 | ifneq (,$(filter MINGW% MSYS%,$(UNAME))) |
296 | HOST_OS = MSYS |
297 | endif |
298 | |
299 | |
300 | #----------------------------------------------------------------------------- |
301 | # make tests validated only for below targets |
302 | #----------------------------------------------------------------------------- |
303 | ifneq (,$(filter $(HOST_OS),MSYS POSIX)) |
304 | |
305 | DIFF:=diff |
306 | ifneq (,$(filter $(UNAME),SunOS)) |
307 | DIFF:=gdiff |
308 | endif |
309 | |
310 | .PHONY: list |
311 | list: |
312 | @$(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 |
313 | |
314 | .PHONY: shortest |
315 | shortest: ZSTDRTTEST= # remove long tests |
316 | shortest: test-zstd |
317 | |
318 | .PHONY: check |
319 | check: shortest |
320 | |
321 | .PHONY: fuzztest |
322 | fuzztest: test-fuzzer test-zstream test-decodecorpus |
323 | |
324 | .PHONY: test |
f535537f |
325 | test: test-zstd test-cli-tests test-fullbench test-fuzzer test-zstream test-invalidDictionaries test-legacy test-decodecorpus |
648db22b |
326 | ifeq ($(QEMU_SYS),) |
327 | test: test-pool |
328 | endif |
329 | |
330 | .PHONY: test32 |
331 | test32: test-zstd32 test-fullbench32 test-fuzzer32 test-zstream32 |
332 | |
333 | .PHONY: test-all |
334 | test-all: test test32 test-decodecorpus-cli |
335 | |
336 | .PHONY: test-zstd test-zstd32 test-zstd-nolegacy |
337 | test-zstd: ZSTD = $(PRGDIR)/zstd |
338 | test-zstd: zstd |
339 | |
340 | .PHONY: test-zstd-dll |
341 | test-zstd-dll: ZSTD = $(PRGDIR)/zstd |
342 | test-zstd-dll: zstd-dll |
343 | |
344 | test-zstd32: ZSTD = $(PRGDIR)/zstd32 |
345 | test-zstd32: zstd32 |
346 | |
347 | test-zstd-nolegacy: ZSTD = $(PRGDIR)/zstd-nolegacy |
348 | test-zstd-nolegacy: zstd-nolegacy |
349 | |
350 | test-zstd test-zstd32 test-zstd-nolegacy test-zstd-dll: datagen |
351 | file $(ZSTD) |
352 | EXE_PREFIX="$(QEMU_SYS)" ZSTD_BIN="$(ZSTD)" DATAGEN_BIN=./datagen ./playTests.sh $(ZSTDRTTEST) |
353 | |
354 | .PHONY: test-cli-tests |
355 | test-cli-tests: ZSTD = $(PRGDIR)/zstd |
356 | test-cli-tests: zstd datagen |
357 | file $(ZSTD) |
358 | ./cli-tests/run.py --exec-prefix="$(QEMU_SYS)" --zstd="$(ZSTD)" --datagen=./datagen |
359 | |
360 | .PHONY: test-fullbench |
361 | test-fullbench: fullbench datagen |
362 | $(QEMU_SYS) ./fullbench -i1 |
363 | $(QEMU_SYS) ./fullbench -i1 -P0 |
364 | |
365 | .PHONY: test-fullbench32 |
366 | test-fullbench32: fullbench32 datagen |
367 | $(QEMU_SYS) ./fullbench32 -i1 |
368 | $(QEMU_SYS) ./fullbench32 -i1 -P0 |
369 | |
370 | .PHONY: test-fuzzer |
371 | test-fuzzer: fuzzer |
372 | $(QEMU_SYS) ./fuzzer -v $(FUZZERTEST) $(FUZZER_FLAGS) |
373 | |
374 | # Note : this test presumes `fuzzer` will be built |
375 | .PHONY: test-fuzzer-stackmode |
376 | test-fuzzer-stackmode: MOREFLAGS += -DZSTD_HEAPMODE=0 |
377 | test-fuzzer-stackmode: test-fuzzer |
378 | |
379 | .PHONY: test-fuzzer32 |
380 | test-fuzzer32: fuzzer32 |
381 | $(QEMU_SYS) ./fuzzer32 -v $(FUZZERTEST) $(FUZZER_FLAGS) |
382 | |
383 | .PHONY: test-zstream |
384 | test-zstream: zstreamtest |
385 | $(QEMU_SYS) ./zstreamtest -v $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS) |
386 | $(QEMU_SYS) ./zstreamtest --newapi -t1 $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS) |
387 | |
388 | test-zstream32: zstreamtest32 |
389 | $(QEMU_SYS) ./zstreamtest32 -v $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS) |
390 | |
391 | test-longmatch: longmatch |
392 | $(QEMU_SYS) ./longmatch |
393 | |
394 | test-bigdict: bigdict |
395 | $(QEMU_SYS) ./bigdict |
396 | |
397 | test-invalidDictionaries: invalidDictionaries |
398 | $(QEMU_SYS) ./invalidDictionaries |
399 | |
400 | test-legacy: legacy |
401 | $(QEMU_SYS) ./legacy |
402 | |
403 | test-decodecorpus: decodecorpus |
404 | $(QEMU_SYS) ./decodecorpus -t $(DECODECORPUS_TESTTIME) |
405 | |
406 | test-decodecorpus-cli: decodecorpus |
407 | @echo "\n ---- decodecorpus basic cli tests ----" |
408 | @mkdir testdir |
409 | ./decodecorpus -n5 -otestdir -ptestdir |
410 | @cd testdir && \ |
411 | $(ZSTD) -d z000000.zst -o tmp0 && \ |
412 | $(ZSTD) -d z000001.zst -o tmp1 && \ |
413 | $(ZSTD) -d z000002.zst -o tmp2 && \ |
414 | $(ZSTD) -d z000003.zst -o tmp3 && \ |
415 | $(ZSTD) -d z000004.zst -o tmp4 && \ |
416 | diff z000000 tmp0 && \ |
417 | diff z000001 tmp1 && \ |
418 | diff z000002 tmp2 && \ |
419 | diff z000003 tmp3 && \ |
420 | diff z000004 tmp4 && \ |
421 | rm ./* && \ |
422 | cd .. |
423 | @echo "\n ---- decodecorpus dictionary cli tests ----" |
424 | ./decodecorpus -n5 -otestdir -ptestdir --use-dict=1MB |
425 | @cd testdir && \ |
426 | $(ZSTD) -d z000000.zst -D dictionary -o tmp0 && \ |
427 | $(ZSTD) -d z000001.zst -D dictionary -o tmp1 && \ |
428 | $(ZSTD) -d z000002.zst -D dictionary -o tmp2 && \ |
429 | $(ZSTD) -d z000003.zst -D dictionary -o tmp3 && \ |
430 | $(ZSTD) -d z000004.zst -D dictionary -o tmp4 && \ |
431 | diff z000000 tmp0 && \ |
432 | diff z000001 tmp1 && \ |
433 | diff z000002 tmp2 && \ |
434 | diff z000003 tmp3 && \ |
435 | diff z000004 tmp4 && \ |
436 | cd .. |
437 | @rm -rf testdir |
438 | |
439 | test-pool: poolTests |
440 | $(QEMU_SYS) ./poolTests |
441 | |
442 | test-lz4: ZSTD = LD_LIBRARY_PATH=/usr/local/lib $(PRGDIR)/zstd |
443 | test-lz4: ZSTD_LZ4 = LD_LIBRARY_PATH=/usr/local/lib ./lz4 |
444 | test-lz4: ZSTD_UNLZ4 = LD_LIBRARY_PATH=/usr/local/lib ./unlz4 |
445 | test-lz4: zstd decodecorpus datagen |
446 | [ -f lz4 ] || ln -s $(PRGDIR)/zstd lz4 |
447 | [ -f unlz4 ] || ln -s $(PRGDIR)/zstd unlz4 |
448 | |
449 | ./decodecorpus -ptmp |
450 | # lz4 -> zstd |
451 | lz4 < tmp | \ |
452 | $(ZSTD) -d | \ |
453 | cmp - tmp |
454 | lz4 < tmp | \ |
455 | $(ZSTD_UNLZ4) | \ |
456 | cmp - tmp |
457 | # zstd -> lz4 |
458 | $(ZSTD) --format=lz4 < tmp | \ |
459 | lz4 -d | \ |
460 | cmp - tmp |
461 | $(ZSTD_LZ4) < tmp | \ |
462 | lz4 -d | \ |
463 | cmp - tmp |
464 | # zstd -> zstd |
465 | $(ZSTD) --format=lz4 < tmp | \ |
466 | $(ZSTD) -d | \ |
467 | cmp - tmp |
468 | # zstd -> zstd |
469 | $(ZSTD) < tmp | \ |
470 | $(ZSTD) -d | \ |
471 | cmp - tmp |
472 | |
473 | ./datagen -g384KB | $(ZSTD) --format=lz4 | $(ZSTD) -d > /dev/null |
474 | |
475 | rm tmp lz4 unlz4 |
476 | |
477 | endif |