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