]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | # ################################################################ |
2 | # Copyright (c) 2015-present, Yann Collet, Facebook, Inc. | |
7c673cae FG |
3 | # All rights reserved. |
4 | # | |
11fdf7f2 TL |
5 | # This source code is licensed under both the BSD-style license (found in the |
6 | # LICENSE file in the root directory of this source tree) and the GPLv2 (found | |
7 | # in the COPYING file in the root directory of this source tree). | |
8 | # ################################################################ | |
7c673cae FG |
9 | # datagen : Synthetic and parametrable data generator, for tests |
10 | # fullbench : Precisely measure speed for each zstd inner functions | |
11 | # fullbench32: Same as fullbench, but forced to compile in 32-bits mode | |
12 | # fuzzer : Test tool, to check zstd integrity on target platform | |
13 | # fuzzer32: Same as fuzzer, but forced to compile in 32-bits mode | |
14 | # paramgrill : parameter tester for zstd | |
15 | # test-zstd-speed.py : script for testing zstd speed difference between commits | |
16 | # versionsTest : compatibility test between zstd versions stored on Github (v0.1+) | |
17 | # zstreamtest : Fuzzer test tool for zstd streaming API | |
18 | # zstreamtest32: Same as zstreamtest, but forced to compile in 32-bits mode | |
19 | # ########################################################################## | |
20 | ||
7c673cae FG |
21 | ZSTDDIR = ../lib |
22 | PRGDIR = ../programs | |
23 | PYTHON ?= python3 | |
24 | TESTARTEFACT := versionsTest namespaceTest | |
25 | ||
11fdf7f2 TL |
26 | DEBUGLEVEL ?= 1 |
27 | DEBUGFLAGS = -g -DZSTD_DEBUG=$(DEBUGLEVEL) | |
28 | CPPFLAGS += -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \ | |
29 | -I$(ZSTDDIR)/dictBuilder -I$(ZSTDDIR)/deprecated -I$(PRGDIR) | |
30 | CFLAGS ?= -O3 | |
31 | CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ | |
32 | -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ | |
33 | -Wstrict-prototypes -Wundef -Wformat-security \ | |
34 | -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ | |
35 | -Wredundant-decls | |
36 | CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) | |
37 | FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) | |
7c673cae FG |
38 | |
39 | ||
40 | ZSTDCOMMON_FILES := $(ZSTDDIR)/common/*.c | |
11fdf7f2 | 41 | ZSTDCOMP_FILES := $(ZSTDDIR)/compress/*.c |
7c673cae | 42 | ZSTDDECOMP_FILES := $(ZSTDDIR)/decompress/*.c |
11fdf7f2 | 43 | ZSTD_FILES := $(ZSTDDECOMP_FILES) $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES) |
7c673cae FG |
44 | ZBUFF_FILES := $(ZSTDDIR)/deprecated/*.c |
45 | ZDICT_FILES := $(ZSTDDIR)/dictBuilder/*.c | |
46 | ||
47 | ||
7c673cae FG |
48 | # Define *.exe as extension for Windows systems |
49 | ifneq (,$(filter Windows%,$(OS))) | |
50 | EXT =.exe | |
11fdf7f2 TL |
51 | MULTITHREAD_CPP = -DZSTD_MULTITHREAD |
52 | MULTITHREAD_LD = | |
7c673cae FG |
53 | else |
54 | EXT = | |
11fdf7f2 TL |
55 | MULTITHREAD_CPP = -DZSTD_MULTITHREAD |
56 | MULTITHREAD_LD = -pthread | |
7c673cae | 57 | endif |
11fdf7f2 | 58 | MULTITHREAD = $(MULTITHREAD_CPP) $(MULTITHREAD_LD) |
7c673cae FG |
59 | |
60 | VOID = /dev/null | |
11fdf7f2 TL |
61 | ZSTREAM_TESTTIME ?= -T90s |
62 | FUZZERTEST ?= -T200s | |
63 | ZSTDRTTEST = --test-large-data | |
64 | DECODECORPUS_TESTTIME ?= -T30 | |
7c673cae | 65 | |
11fdf7f2 | 66 | .PHONY: default all all32 allnothread dll clean test test32 test-all namespaceTest versionsTest |
7c673cae FG |
67 | |
68 | default: fullbench | |
69 | ||
11fdf7f2 | 70 | all: fullbench fuzzer zstreamtest paramgrill datagen decodecorpus |
7c673cae | 71 | |
11fdf7f2 | 72 | all32: fullbench32 fuzzer32 zstreamtest32 |
7c673cae | 73 | |
11fdf7f2 | 74 | allnothread: fullbench fuzzer paramgrill datagen decodecorpus |
7c673cae | 75 | |
11fdf7f2 | 76 | dll: fuzzer-dll zstreamtest-dll |
7c673cae FG |
77 | |
78 | zstd: | |
79 | $(MAKE) -C $(PRGDIR) $@ | |
80 | ||
81 | zstd32: | |
82 | $(MAKE) -C $(PRGDIR) $@ | |
83 | ||
84 | zstd-nolegacy: | |
85 | $(MAKE) -C $(PRGDIR) $@ | |
86 | ||
87 | gzstd: | |
11fdf7f2 | 88 | $(MAKE) -C $(PRGDIR) zstd HAVE_ZLIB=1 |
7c673cae | 89 | |
11fdf7f2 TL |
90 | fullbench32: CPPFLAGS += -m32 |
91 | fullbench fullbench32 : CPPFLAGS += $(MULTITHREAD_CPP) | |
92 | fullbench fullbench32 : LDFLAGS += $(MULTITHREAD_LD) | |
93 | fullbench fullbench32 : DEBUGFLAGS = # turn off assert() for speed measurements | |
94 | fullbench fullbench32 : $(ZSTD_FILES) $(PRGDIR)/datagen.c fullbench.c | |
95 | $(CC) $(FLAGS) $^ -o $@$(EXT) | |
7c673cae FG |
96 | |
97 | fullbench-lib: $(PRGDIR)/datagen.c fullbench.c | |
98 | $(MAKE) -C $(ZSTDDIR) libzstd.a | |
99 | $(CC) $(FLAGS) $^ -o $@$(EXT) $(ZSTDDIR)/libzstd.a | |
100 | ||
101 | fullbench-dll: $(PRGDIR)/datagen.c fullbench.c | |
102 | $(MAKE) -C $(ZSTDDIR) libzstd | |
103 | $(CC) $(FLAGS) $^ -o $@$(EXT) -DZSTD_DLL_IMPORT=1 $(ZSTDDIR)/dll/libzstd.dll | |
104 | ||
11fdf7f2 TL |
105 | fuzzer : CPPFLAGS += $(MULTITHREAD_CPP) |
106 | fuzzer : LDFLAGS += $(MULTITHREAD_LD) | |
107 | fuzzer32: CFLAGS += -m32 | |
108 | fuzzer fuzzer32 : $(ZSTD_FILES) $(ZDICT_FILES) $(PRGDIR)/datagen.c fuzzer.c | |
109 | $(CC) $(FLAGS) $^ -o $@$(EXT) | |
7c673cae | 110 | |
11fdf7f2 TL |
111 | fuzzer-dll : LDFLAGS+= -L$(ZSTDDIR) -lzstd |
112 | fuzzer-dll : $(ZSTDDIR)/common/xxhash.c $(PRGDIR)/datagen.c fuzzer.c | |
113 | $(MAKE) -C $(ZSTDDIR) libzstd | |
114 | $(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@$(EXT) | |
7c673cae FG |
115 | |
116 | zbufftest : CPPFLAGS += -I$(ZSTDDIR)/deprecated | |
117 | zbufftest : CFLAGS += -Wno-deprecated-declarations # required to silence deprecation warnings | |
118 | zbufftest : $(ZSTD_FILES) $(ZBUFF_FILES) $(PRGDIR)/datagen.c zbufftest.c | |
119 | $(CC) $(FLAGS) $^ -o $@$(EXT) | |
120 | ||
121 | zbufftest32 : CPPFLAGS += -I$(ZSTDDIR)/deprecated | |
122 | zbufftest32 : CFLAGS += -Wno-deprecated-declarations -m32 | |
123 | zbufftest32 : $(ZSTD_FILES) $(ZBUFF_FILES) $(PRGDIR)/datagen.c zbufftest.c | |
124 | $(CC) $(FLAGS) $^ -o $@$(EXT) | |
125 | ||
11fdf7f2 TL |
126 | zbufftest-dll : CPPFLAGS += -I$(ZSTDDIR)/deprecated |
127 | zbufftest-dll : CFLAGS += -Wno-deprecated-declarations # required to silence deprecation warnings | |
128 | zbufftest-dll : LDFLAGS+= -L$(ZSTDDIR) -lzstd | |
129 | zbufftest-dll : $(ZSTDDIR)/common/xxhash.c $(PRGDIR)/datagen.c zbufftest.c | |
130 | $(MAKE) -C $(ZSTDDIR) libzstd | |
131 | $(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@$(EXT) | |
132 | ||
133 | ZSTREAMFILES := $(ZSTD_FILES) $(ZDICT_FILES) $(PRGDIR)/datagen.c zstreamtest.c | |
134 | zstreamtest : CPPFLAGS += $(MULTITHREAD_CPP) | |
135 | zstreamtest : LDFLAGS += $(MULTITHREAD_LD) | |
136 | zstreamtest : $(ZSTREAMFILES) | |
137 | $(CC) $(FLAGS) $^ -o $@$(EXT) | |
7c673cae | 138 | |
11fdf7f2 TL |
139 | zstreamtest32 : CFLAGS += -m32 |
140 | zstreamtest32 : $(ZSTREAMFILES) | |
141 | $(CC) $(FLAGS) $(MULTITHREAD) $^ -o $@$(EXT) | |
142 | ||
143 | zstreamtest_asan : CFLAGS += -fsanitize=address | |
144 | zstreamtest_asan : $(ZSTREAMFILES) | |
145 | $(CC) $(FLAGS) $(MULTITHREAD) $^ -o $@$(EXT) | |
146 | ||
147 | zstreamtest_tsan : CFLAGS += -fsanitize=thread | |
148 | zstreamtest_tsan : $(ZSTREAMFILES) | |
149 | $(CC) $(FLAGS) $(MULTITHREAD) $^ -o $@$(EXT) | |
150 | ||
151 | zstreamtest-dll : LDFLAGS+= -L$(ZSTDDIR) -lzstd | |
152 | zstreamtest-dll : $(ZSTDDIR)/common/xxhash.c $(PRGDIR)/datagen.c zstreamtest.c | |
153 | $(MAKE) -C $(ZSTDDIR) libzstd | |
154 | $(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@$(EXT) | |
7c673cae | 155 | |
11fdf7f2 | 156 | paramgrill : DEBUGFLAGS = |
7c673cae FG |
157 | paramgrill : $(ZSTD_FILES) $(PRGDIR)/datagen.c paramgrill.c |
158 | $(CC) $(FLAGS) $^ -lm -o $@$(EXT) | |
159 | ||
160 | datagen : $(PRGDIR)/datagen.c datagencli.c | |
161 | $(CC) $(FLAGS) $^ -o $@$(EXT) | |
162 | ||
163 | roundTripCrash : $(ZSTD_FILES) roundTripCrash.c | |
11fdf7f2 | 164 | $(CC) $(FLAGS) $(MULTITHREAD) $^ -o $@$(EXT) |
7c673cae FG |
165 | |
166 | longmatch : $(ZSTD_FILES) longmatch.c | |
167 | $(CC) $(FLAGS) $^ -o $@$(EXT) | |
168 | ||
11fdf7f2 TL |
169 | invalidDictionaries : $(ZSTD_FILES) invalidDictionaries.c |
170 | $(CC) $(FLAGS) $^ -o $@$(EXT) | |
171 | ||
172 | legacy : CFLAGS+= -DZSTD_LEGACY_SUPPORT=4 | |
173 | legacy : CPPFLAGS+= -I$(ZSTDDIR)/legacy | |
174 | legacy : $(ZSTD_FILES) $(wildcard $(ZSTDDIR)/legacy/*.c) legacy.c | |
175 | $(CC) $(FLAGS) $^ -o $@$(EXT) | |
176 | ||
177 | decodecorpus : $(filter-out $(ZSTDDIR)/compress/zstd_compress.c, $(wildcard $(ZSTD_FILES))) $(ZDICT_FILES) decodecorpus.c | |
178 | $(CC) $(FLAGS) $^ -o $@$(EXT) -lm | |
179 | ||
180 | symbols : symbols.c | |
181 | $(MAKE) -C $(ZSTDDIR) libzstd | |
182 | ifneq (,$(filter Windows%,$(OS))) | |
183 | cp $(ZSTDDIR)/dll/libzstd.dll . | |
184 | $(CC) $(FLAGS) $^ -o $@$(EXT) -DZSTD_DLL_IMPORT=1 libzstd.dll | |
185 | else | |
186 | $(CC) $(FLAGS) $^ -o $@$(EXT) -Wl,-rpath=$(ZSTDDIR) $(ZSTDDIR)/libzstd.so | |
187 | endif | |
188 | ||
189 | poolTests : poolTests.c $(ZSTDDIR)/common/pool.c $(ZSTDDIR)/common/threading.c $(ZSTDDIR)/common/zstd_common.c $(ZSTDDIR)/common/error_private.c | |
190 | $(CC) $(FLAGS) $(MULTITHREAD) $^ -o $@$(EXT) | |
191 | ||
7c673cae FG |
192 | namespaceTest: |
193 | if $(CC) namespaceTest.c ../lib/common/xxhash.c -o $@ ; then echo compilation should fail; exit 1 ; fi | |
194 | $(RM) $@ | |
195 | ||
11fdf7f2 | 196 | versionsTest: clean |
7c673cae FG |
197 | $(PYTHON) test-zstd-versions.py |
198 | ||
199 | clean: | |
11fdf7f2 | 200 | $(MAKE) -C $(ZSTDDIR) clean |
7c673cae FG |
201 | @$(RM) -fR $(TESTARTEFACT) |
202 | @$(RM) -f core *.o tmp* result* *.gcda dictionary *.zst \ | |
203 | $(PRGDIR)/zstd$(EXT) $(PRGDIR)/zstd32$(EXT) \ | |
204 | fullbench$(EXT) fullbench32$(EXT) \ | |
205 | fullbench-lib$(EXT) fullbench-dll$(EXT) \ | |
206 | fuzzer$(EXT) fuzzer32$(EXT) zbufftest$(EXT) zbufftest32$(EXT) \ | |
11fdf7f2 TL |
207 | fuzzer-dll$(EXT) zstreamtest-dll$(EXT) zbufftest-dll$(EXT)\ |
208 | zstreamtest$(EXT) zstreamtest32$(EXT) \ | |
209 | datagen$(EXT) paramgrill$(EXT) roundTripCrash$(EXT) longmatch$(EXT) \ | |
210 | symbols$(EXT) invalidDictionaries$(EXT) legacy$(EXT) poolTests$(EXT) \ | |
211 | decodecorpus$(EXT) | |
7c673cae FG |
212 | @echo Cleaning completed |
213 | ||
214 | ||
215 | #---------------------------------------------------------------------------------- | |
11fdf7f2 | 216 | #make valgrindTest is validated only for Linux, OSX, BSD, Hurd and Solaris targets |
7c673cae | 217 | #---------------------------------------------------------------------------------- |
11fdf7f2 | 218 | ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS)) |
7c673cae FG |
219 | HOST_OS = POSIX |
220 | ||
11fdf7f2 | 221 | valgrindTest: VALGRIND = valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 |
7c673cae FG |
222 | valgrindTest: zstd datagen fuzzer fullbench |
223 | @echo "\n ---- valgrind tests : memory analyzer ----" | |
224 | $(VALGRIND) ./datagen -g50M > $(VOID) | |
225 | $(VALGRIND) $(PRGDIR)/zstd ; if [ $$? -eq 0 ] ; then echo "zstd without argument should have failed"; false; fi | |
226 | ./datagen -g80 | $(VALGRIND) $(PRGDIR)/zstd - -c > $(VOID) | |
227 | ./datagen -g16KB | $(VALGRIND) $(PRGDIR)/zstd -vf - -c > $(VOID) | |
228 | ./datagen -g2930KB | $(VALGRIND) $(PRGDIR)/zstd -5 -vf - -o tmp | |
229 | $(VALGRIND) $(PRGDIR)/zstd -vdf tmp -c > $(VOID) | |
230 | ./datagen -g64MB | $(VALGRIND) $(PRGDIR)/zstd -vf - -c > $(VOID) | |
231 | @rm tmp | |
232 | $(VALGRIND) ./fuzzer -T1mn -t1 | |
233 | $(VALGRIND) ./fullbench -i1 | |
234 | ||
235 | endif | |
236 | ||
237 | ||
238 | ifneq (,$(filter MSYS%,$(shell uname))) | |
239 | HOST_OS = MSYS | |
240 | endif | |
241 | ||
242 | ||
11fdf7f2 TL |
243 | #----------------------------------------------------------------------------- |
244 | # make tests validated only for below targets | |
245 | #----------------------------------------------------------------------------- | |
7c673cae | 246 | ifneq (,$(filter $(HOST_OS),MSYS POSIX)) |
11fdf7f2 TL |
247 | |
248 | DIFF:=diff | |
249 | ifneq (,$(filter $(shell uname),SunOS)) | |
250 | DIFF:=gdiff | |
251 | endif | |
252 | ||
7c673cae FG |
253 | zstd-playTests: datagen |
254 | file $(ZSTD) | |
255 | ZSTD="$(QEMU_SYS) $(ZSTD)" ./playTests.sh $(ZSTDRTTEST) | |
256 | ||
11fdf7f2 TL |
257 | shortest: ZSTDRTTEST= |
258 | shortest: test-zstd | |
259 | ||
260 | fuzztest: test-fuzzer test-zstream test-decodecorpus | |
261 | ||
262 | test: test-zstd test-fullbench test-fuzzer test-zstream test-invalidDictionaries test-legacy test-decodecorpus | |
263 | ifeq ($(QEMU_SYS),) | |
264 | test: test-pool | |
265 | endif | |
7c673cae FG |
266 | |
267 | test32: test-zstd32 test-fullbench32 test-fuzzer32 test-zstream32 | |
268 | ||
11fdf7f2 | 269 | test-all: test test32 valgrindTest test-decodecorpus-cli |
7c673cae FG |
270 | |
271 | test-zstd: ZSTD = $(PRGDIR)/zstd | |
272 | test-zstd: zstd zstd-playTests | |
273 | ||
274 | test-zstd32: ZSTD = $(PRGDIR)/zstd32 | |
275 | test-zstd32: zstd32 zstd-playTests | |
276 | ||
11fdf7f2 | 277 | test-zstd-nolegacy: ZSTD = $(PRGDIR)/zstd-nolegacy |
7c673cae FG |
278 | test-zstd-nolegacy: zstd-nolegacy zstd-playTests |
279 | ||
280 | test-gzstd: gzstd | |
11fdf7f2 TL |
281 | $(PRGDIR)/zstd -f README.md test-zstd-speed.py |
282 | gzip -f README.md test-zstd-speed.py | |
7c673cae FG |
283 | cat README.md.zst test-zstd-speed.py.gz >zstd_gz.zst |
284 | cat README.md.gz test-zstd-speed.py.zst >gz_zstd.gz | |
11fdf7f2 TL |
285 | $(PRGDIR)/zstd -df README.md.gz -o README2.md |
286 | $(PRGDIR)/zstd -df README.md.gz test-zstd-speed.py.gz | |
287 | $(PRGDIR)/zstd -df zstd_gz.zst gz_zstd.gz | |
288 | $(DIFF) -q zstd_gz gz_zstd | |
7c673cae FG |
289 | echo Hello World ZSTD | $(PRGDIR)/zstd -c - >hello.zst |
290 | echo Hello World GZIP | gzip -c - >hello.gz | |
291 | echo Hello World TEXT >hello.txt | |
292 | cat hello.zst hello.gz hello.txt >hello_zst_gz_txt.gz | |
293 | $(PRGDIR)/zstd -dcf hello.* | |
294 | $(PRGDIR)/zstd -dcf - <hello_zst_gz_txt.gz | |
11fdf7f2 | 295 | $(RM) *.gz *.zst README2.md gz_zstd zstd_gz hello.txt |
7c673cae FG |
296 | |
297 | test-fullbench: fullbench datagen | |
298 | $(QEMU_SYS) ./fullbench -i1 | |
299 | $(QEMU_SYS) ./fullbench -i1 -P0 | |
300 | ||
301 | test-fullbench32: fullbench32 datagen | |
302 | $(QEMU_SYS) ./fullbench32 -i1 | |
303 | $(QEMU_SYS) ./fullbench32 -i1 -P0 | |
304 | ||
305 | test-fuzzer: fuzzer | |
11fdf7f2 | 306 | $(QEMU_SYS) ./fuzzer $(FUZZERTEST) $(FUZZER_FLAGS) |
7c673cae FG |
307 | |
308 | test-fuzzer32: fuzzer32 | |
11fdf7f2 | 309 | $(QEMU_SYS) ./fuzzer32 $(FUZZERTEST) $(FUZZER_FLAGS) |
7c673cae FG |
310 | |
311 | test-zbuff: zbufftest | |
312 | $(QEMU_SYS) ./zbufftest $(ZSTREAM_TESTTIME) | |
313 | ||
314 | test-zbuff32: zbufftest32 | |
315 | $(QEMU_SYS) ./zbufftest32 $(ZSTREAM_TESTTIME) | |
316 | ||
317 | test-zstream: zstreamtest | |
11fdf7f2 TL |
318 | $(QEMU_SYS) ./zstreamtest $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS) |
319 | $(QEMU_SYS) ./zstreamtest --mt -t1 $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS) | |
320 | $(QEMU_SYS) ./zstreamtest --newapi -t1 $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS) | |
321 | $(QEMU_SYS) ./zstreamtest --opaqueapi -t1 $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS) | |
7c673cae FG |
322 | |
323 | test-zstream32: zstreamtest32 | |
11fdf7f2 | 324 | $(QEMU_SYS) ./zstreamtest32 $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS) |
7c673cae FG |
325 | |
326 | test-longmatch: longmatch | |
327 | $(QEMU_SYS) ./longmatch | |
328 | ||
11fdf7f2 TL |
329 | test-invalidDictionaries: invalidDictionaries |
330 | $(QEMU_SYS) ./invalidDictionaries | |
331 | ||
332 | test-symbols: symbols | |
333 | $(QEMU_SYS) ./symbols | |
334 | ||
335 | test-legacy: legacy | |
336 | $(QEMU_SYS) ./legacy | |
337 | ||
338 | test-decodecorpus: decodecorpus | |
339 | $(QEMU_SYS) ./decodecorpus -t $(DECODECORPUS_TESTTIME) | |
340 | ||
341 | test-decodecorpus-cli: decodecorpus | |
342 | @echo "\n ---- decodecorpus basic cli tests ----" | |
343 | @mkdir testdir | |
344 | ./decodecorpus -n5 -otestdir -ptestdir | |
345 | @cd testdir && \ | |
346 | $(ZSTD) -d z000000.zst -o tmp0 && \ | |
347 | $(ZSTD) -d z000001.zst -o tmp1 && \ | |
348 | $(ZSTD) -d z000002.zst -o tmp2 && \ | |
349 | $(ZSTD) -d z000003.zst -o tmp3 && \ | |
350 | $(ZSTD) -d z000004.zst -o tmp4 && \ | |
351 | diff z000000 tmp0 && \ | |
352 | diff z000001 tmp1 && \ | |
353 | diff z000002 tmp2 && \ | |
354 | diff z000003 tmp3 && \ | |
355 | diff z000004 tmp4 && \ | |
356 | rm ./* && \ | |
357 | cd .. | |
358 | @echo "\n ---- decodecorpus dictionary cli tests ----" | |
359 | ./decodecorpus -n5 -otestdir -ptestdir --use-dict=1MB | |
360 | @cd testdir && \ | |
361 | $(ZSTD) -d z000000.zst -D dictionary -o tmp0 && \ | |
362 | $(ZSTD) -d z000001.zst -D dictionary -o tmp1 && \ | |
363 | $(ZSTD) -d z000002.zst -D dictionary -o tmp2 && \ | |
364 | $(ZSTD) -d z000003.zst -D dictionary -o tmp3 && \ | |
365 | $(ZSTD) -d z000004.zst -D dictionary -o tmp4 && \ | |
366 | diff z000000 tmp0 && \ | |
367 | diff z000001 tmp1 && \ | |
368 | diff z000002 tmp2 && \ | |
369 | diff z000003 tmp3 && \ | |
370 | diff z000004 tmp4 && \ | |
371 | cd .. | |
372 | @rm -rf testdir | |
373 | ||
374 | test-pool: poolTests | |
375 | $(QEMU_SYS) ./poolTests | |
376 | ||
377 | test-lz4: ZSTD = LD_LIBRARY_PATH=/usr/local/lib $(PRGDIR)/zstd | |
378 | test-lz4: ZSTD_LZ4 = LD_LIBRARY_PATH=/usr/local/lib ./lz4 | |
379 | test-lz4: ZSTD_UNLZ4 = LD_LIBRARY_PATH=/usr/local/lib ./unlz4 | |
380 | test-lz4: zstd decodecorpus | |
381 | ln -s $(PRGDIR)/zstd lz4 | |
382 | ln -s $(PRGDIR)/zstd unlz4 | |
383 | ||
384 | ./decodecorpus -ptmp | |
385 | # lz4 -> zstd | |
386 | lz4 < tmp | \ | |
387 | $(ZSTD) -d | \ | |
388 | cmp - tmp | |
389 | lz4 < tmp | \ | |
390 | $(ZSTD_UNLZ4) | \ | |
391 | cmp - tmp | |
392 | # zstd -> lz4 | |
393 | $(ZSTD) --format=lz4 < tmp | \ | |
394 | lz4 -d | \ | |
395 | cmp - tmp | |
396 | $(ZSTD_LZ4) < tmp | \ | |
397 | lz4 -d | \ | |
398 | cmp - tmp | |
399 | # zstd -> zstd | |
400 | $(ZSTD) --format=lz4 < tmp | \ | |
401 | $(ZSTD) -d | \ | |
402 | cmp - tmp | |
403 | # zstd -> zstd | |
404 | $(ZSTD) < tmp | \ | |
405 | $(ZSTD) -d | \ | |
406 | cmp - tmp | |
407 | ||
408 | rm tmp lz4 unlz4 | |
409 | ||
7c673cae | 410 | endif |