]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/contrib/zstd/tests/Makefile
Update to Zstandard 1.4.4
[FreeBSD/FreeBSD.git] / sys / contrib / zstd / tests / Makefile
1 # ################################################################
2 # Copyright (c) 2015-present, Yann Collet, Facebook, Inc.
3 # All rights reserved.
4 #
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 # ################################################################
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
21 ZSTDDIR = ../lib
22 PRGDIR  = ../programs
23 PYTHON ?= python3
24 TESTARTEFACT := versionsTest
25
26 DEBUGLEVEL ?= 1
27 DEBUGFLAGS  = -g -DDEBUGLEVEL=$(DEBUGLEVEL)
28 CPPFLAGS   += -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \
29               -I$(ZSTDDIR)/dictBuilder -I$(ZSTDDIR)/deprecated -I$(PRGDIR)
30 ifeq ($(OS),Windows_NT)   # MinGW assumed
31 CPPFLAGS   += -D__USE_MINGW_ANSI_STDIO   # compatibility with %zu formatting
32 endif
33 CFLAGS     ?= -O3
34 CFLAGS     += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow                 \
35               -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
36               -Wstrict-prototypes -Wundef                                     \
37               -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings      \
38               -Wredundant-decls -Wmissing-prototypes
39 CFLAGS     += $(DEBUGFLAGS) $(MOREFLAGS)
40 FLAGS       = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
41
42
43 ZSTDCOMMON_FILES := $(ZSTDDIR)/common/*.c
44 ZSTDCOMP_FILES   := $(ZSTDDIR)/compress/*.c
45 ZSTDDECOMP_FILES := $(ZSTDDIR)/decompress/*.c
46 ZSTD_FILES  := $(ZSTDDECOMP_FILES) $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES)
47 ZBUFF_FILES := $(ZSTDDIR)/deprecated/*.c
48 ZDICT_FILES := $(ZSTDDIR)/dictBuilder/*.c
49
50 ZSTD_F1 := $(wildcard $(ZSTD_FILES))
51 ZSTD_OBJ1 := $(subst $(ZSTDDIR)/common/,zstdm_,$(ZSTD_F1))
52 ZSTD_OBJ2 := $(subst $(ZSTDDIR)/compress/,zstdc_,$(ZSTD_OBJ1))
53 ZSTD_OBJ3 := $(subst $(ZSTDDIR)/decompress/,zstdd_,$(ZSTD_OBJ2))
54 ZSTD_OBJECTS := $(ZSTD_OBJ3:.c=.o)
55
56 ZSTDMT_OBJ1 := $(subst $(ZSTDDIR)/common/,zstdmt_m_,$(ZSTD_F1))
57 ZSTDMT_OBJ2 := $(subst $(ZSTDDIR)/compress/,zstdmt_c_,$(ZSTDMT_OBJ1))
58 ZSTDMT_OBJ3 := $(subst $(ZSTDDIR)/decompress/,zstdmt_d_,$(ZSTDMT_OBJ2))
59 ZSTDMT_OBJECTS := $(ZSTDMT_OBJ3:.c=.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 all all32 allnothread dll clean test test32 test-all versionsTest
80
81 default: fullbench
82         @echo $(ZSTDMT_OBJECTS)
83
84 all: fullbench fuzzer zstreamtest paramgrill datagen decodecorpus roundTripCrash \
85      fullbench-lib poolTests
86
87 all32: fullbench32 fuzzer32 zstreamtest32
88
89 allnothread: MULTITHREAD_CPP=
90 allnothread: MULTITHREAD_LD=
91 allnothread: fullbench fuzzer paramgrill datagen decodecorpus
92
93 dll: fuzzer-dll zstreamtest-dll
94
95 PHONY: zstd zstd32 zstd-nolegacy  # must be phony, only external makefile knows how to build them, or if they need an update
96 zstd zstd32 zstd-nolegacy:
97         $(MAKE) -C $(PRGDIR) $@ MOREFLAGS+="$(DEBUGFLAGS)"
98
99 gzstd:
100         $(MAKE) -C $(PRGDIR) zstd HAVE_ZLIB=1 MOREFLAGS+="$(DEBUGFLAGS)"
101
102 .PHONY: zstd-dll
103 zstd-dll :
104         $(MAKE) -C $(ZSTDDIR) libzstd
105
106 .PHONY: zstd-staticLib
107 zstd-staticLib :
108         $(MAKE) -C $(ZSTDDIR) libzstd.a
109
110 zstdm_%.o : $(ZSTDDIR)/common/%.c
111         $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
112
113 zstdc_%.o : $(ZSTDDIR)/compress/%.c
114         $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
115
116 zstdd_%.o : $(ZSTDDIR)/decompress/%.c
117         $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
118
119 zstdmt%.o : CPPFLAGS += $(MULTITHREAD_CPP)
120
121 zstdmt_m_%.o : $(ZSTDDIR)/common/%.c
122         $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
123
124 zstdmt_c_%.o : $(ZSTDDIR)/compress/%.c
125         $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
126
127 zstdmt_d_%.o : $(ZSTDDIR)/decompress/%.c
128         $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
129
130 fullbench32: CPPFLAGS += -m32
131 fullbench fullbench32 : CPPFLAGS += $(MULTITHREAD_CPP)
132 fullbench fullbench32 : LDFLAGS += $(MULTITHREAD_LD)
133 fullbench fullbench32 : DEBUGFLAGS = -DNDEBUG  # turn off assert() for speed measurements
134 fullbench fullbench32 : $(ZSTD_FILES)
135 fullbench fullbench32 : $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/benchfn.c fullbench.c
136         $(CC) $(FLAGS) $^ -o $@$(EXT)
137
138 fullbench-lib : CPPFLAGS += -DXXH_NAMESPACE=ZSTD_
139 fullbench-lib : zstd-staticLib
140 fullbench-lib : $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/benchfn.c fullbench.c
141         $(CC) $(FLAGS) $(filter %.c,$^) -o $@$(EXT) $(ZSTDDIR)/libzstd.a
142
143 # note : broken : requires unavailable symbols
144 fullbench-dll : zstd-dll
145 fullbench-dll : LDFLAGS+= -L$(ZSTDDIR) -lzstd
146 fullbench-dll: $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/benchfn.c $(PRGDIR)/timefn.c fullbench.c
147 #       $(CC) $(FLAGS) $(filter %.c,$^) -o $@$(EXT) -DZSTD_DLL_IMPORT=1 $(ZSTDDIR)/dll/libzstd.dll
148         $(CC) $(FLAGS) $(filter %.c,$^) -o $@$(EXT)
149
150 fuzzer  : CPPFLAGS += $(MULTITHREAD_CPP)
151 fuzzer  : LDFLAGS += $(MULTITHREAD_LD)
152 fuzzer32: CFLAGS += -m32
153 fuzzer  : $(ZSTDMT_OBJECTS)
154 fuzzer32: $(ZSTD_FILES)
155 fuzzer fuzzer32 : $(ZDICT_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/datagen.c fuzzer.c
156         $(CC) $(FLAGS) $^ -o $@$(EXT)
157
158 fuzzer-dll : zstd-dll
159 fuzzer-dll : LDFLAGS+= -L$(ZSTDDIR) -lzstd
160 fuzzer-dll : $(ZSTDDIR)/common/xxhash.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/datagen.c fuzzer.c
161         $(CC) $(CPPFLAGS) $(CFLAGS) $(filter %.c,$^) $(LDFLAGS) -o $@$(EXT)
162
163 zbufftest zbufftest32 zbufftest-dll : CPPFLAGS += -I$(ZSTDDIR)/deprecated
164 zbufftest zbufftest32 zbufftest-dll : CFLAGS += -Wno-deprecated-declarations   # required to silence deprecation warnings
165 zbufftest32 : CFLAGS +=  -m32
166 zbufftest zbufftest32 : $(ZSTD_OBJECTS) $(ZBUFF_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/datagen.c zbufftest.c
167         $(CC) $(FLAGS) $^ -o $@$(EXT)
168
169 zbufftest-dll : zstd-dll
170 zbufftest-dll : LDFLAGS+= -L$(ZSTDDIR) -lzstd
171 zbufftest-dll : $(ZSTDDIR)/common/xxhash.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/datagen.c zbufftest.c
172         $(CC) $(CPPFLAGS) $(CFLAGS) $(filter %.c,$^) $(LDFLAGS) -o $@$(EXT)
173
174 ZSTREAM_LOCAL_FILES := $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c seqgen.c zstreamtest.c
175 ZSTREAM_PROPER_FILES := $(ZDICT_FILES) $(ZSTREAM_LOCAL_FILES)
176 ZSTREAMFILES := $(ZSTD_FILES) $(ZSTREAM_PROPER_FILES)
177 zstreamtest32 : CFLAGS += -m32
178 zstreamtest zstreamtest32 : CPPFLAGS += $(MULTITHREAD_CPP)
179 zstreamtest zstreamtest32 : LDFLAGS += $(MULTITHREAD_LD)
180 zstreamtest : $(ZSTDMT_OBJECTS) $(ZSTREAM_PROPER_FILES)
181 zstreamtest32 : $(ZSTREAMFILES)
182 zstreamtest zstreamtest32 :
183         $(CC) $(FLAGS) $^ -o $@$(EXT)
184
185 zstreamtest_asan : CFLAGS += -fsanitize=address
186 zstreamtest_asan : $(ZSTREAMFILES)
187         $(CC) $(FLAGS) $(MULTITHREAD) $^ -o $@$(EXT)
188
189 zstreamtest_tsan : CFLAGS += -fsanitize=thread
190 zstreamtest_tsan : $(ZSTREAMFILES)
191         $(CC) $(FLAGS) $(MULTITHREAD) $^ -o $@$(EXT)
192
193 zstreamtest-dll : zstd-dll
194 zstreamtest-dll : LDFLAGS+= -L$(ZSTDDIR) -lzstd
195 zstreamtest-dll : $(ZSTDDIR)/common/xxhash.c  # xxh symbols not exposed from dll
196 zstreamtest-dll : $(ZSTREAM_LOCAL_FILES)
197         $(CC) $(CPPFLAGS) $(CFLAGS) $(filter %.c,$^) $(LDFLAGS) -o $@$(EXT)
198
199 paramgrill : DEBUGFLAGS =  # turn off assert() by default for speed measurements
200 paramgrill : $(ZSTD_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/benchfn.c $(PRGDIR)/benchzstd.c $(PRGDIR)/datagen.c paramgrill.c
201         $(CC) $(FLAGS) $^ -lm -o $@$(EXT)
202
203 datagen : $(PRGDIR)/datagen.c datagencli.c
204         $(CC) $(FLAGS) $^ -o $@$(EXT)
205
206 roundTripCrash : $(ZSTD_OBJECTS) roundTripCrash.c
207         $(CC) $(FLAGS) $(MULTITHREAD) $^ -o $@$(EXT)
208
209 longmatch  : $(ZSTD_OBJECTS) longmatch.c
210         $(CC) $(FLAGS) $^ -o $@$(EXT)
211
212 bigdict: $(ZSTDMT_OBJECTS) $(PRGDIR)/datagen.c bigdict.c
213         $(CC) $(FLAGS) $(MULTITHREAD) $^ -o $@$(EXT)
214
215 invalidDictionaries : $(ZSTD_OBJECTS) invalidDictionaries.c
216         $(CC) $(FLAGS) $^ -o $@$(EXT)
217
218 legacy : CPPFLAGS += -I$(ZSTDDIR)/legacy -DZSTD_LEGACY_SUPPORT=4
219 legacy : $(ZSTD_FILES) $(wildcard $(ZSTDDIR)/legacy/*.c) legacy.c
220         $(CC) $(FLAGS) $^ -o $@$(EXT)
221
222 decodecorpus : $(filter-out zstdc_zstd_compress.o, $(ZSTD_OBJECTS)) $(ZDICT_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c decodecorpus.c
223         $(CC) $(FLAGS) $^ -o $@$(EXT) -lm
224
225 symbols  : symbols.c zstd-dll
226 ifneq (,$(filter Windows%,$(OS)))
227         cp $(ZSTDDIR)/dll/libzstd.dll .
228         $(CC) $(FLAGS) $< -o $@$(EXT) -DZSTD_DLL_IMPORT=1 libzstd.dll
229 else
230         $(CC) $(FLAGS) $< -o $@$(EXT) -Wl,-rpath=$(ZSTDDIR) $(ZSTDDIR)/libzstd.so   # broken on Mac
231 endif
232
233 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
234         $(CC) $(FLAGS) $(MULTITHREAD) $^ -o $@$(EXT)
235
236 .PHONY: versionsTest
237 versionsTest: clean
238         $(PYTHON) test-zstd-versions.py
239
240 checkTag: checkTag.c $(ZSTDDIR)/zstd.h
241         $(CC) $(FLAGS) $< -o $@$(EXT)
242
243 clean:
244         $(MAKE) -C $(ZSTDDIR) clean
245         $(MAKE) -C $(PRGDIR) clean
246         @$(RM) -fR $(TESTARTEFACT)
247         @$(RM) -rf tmp*  # some test directories are named tmp*
248         @$(RM) core *.o *.tmp result* *.gcda dictionary *.zst \
249         $(PRGDIR)/zstd$(EXT) $(PRGDIR)/zstd32$(EXT) \
250         fullbench$(EXT) fullbench32$(EXT) \
251         fullbench-lib$(EXT) fullbench-dll$(EXT) \
252         fuzzer$(EXT) fuzzer32$(EXT) zbufftest$(EXT) zbufftest32$(EXT) \
253         fuzzer-dll$(EXT) zstreamtest-dll$(EXT) zbufftest-dll$(EXT) \
254         zstreamtest$(EXT) zstreamtest32$(EXT) \
255         datagen$(EXT) paramgrill$(EXT) roundTripCrash$(EXT) longmatch$(EXT) \
256         symbols$(EXT) invalidDictionaries$(EXT) legacy$(EXT) poolTests$(EXT) \
257         decodecorpus$(EXT) checkTag$(EXT) bigdict$(EXT)
258         @echo Cleaning completed
259
260
261 #----------------------------------------------------------------------------------
262 # valgrind tests are validated only for some posix platforms
263 #----------------------------------------------------------------------------------
264 ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS))
265 HOST_OS = POSIX
266
267 valgrindTest: VALGRIND = valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1
268 valgrindTest: zstd datagen fuzzer fullbench
269         @echo "\n ---- valgrind tests : memory analyzer ----"
270         $(VALGRIND) ./datagen -g50M > $(VOID)
271         $(VALGRIND) $(PRGDIR)/zstd ; if [ $$? -eq 0 ] ; then echo "zstd without argument should have failed"; false; fi
272         ./datagen -g80 | $(VALGRIND) $(PRGDIR)/zstd - -c > $(VOID)
273         ./datagen -g16KB | $(VALGRIND) $(PRGDIR)/zstd -vf - -c > $(VOID)
274         ./datagen -g2930KB | $(VALGRIND) $(PRGDIR)/zstd -5 -vf - -o tmp
275         $(VALGRIND) $(PRGDIR)/zstd -vdf tmp -c > $(VOID)
276         ./datagen -g64MB | $(VALGRIND) $(PRGDIR)/zstd -vf - -c > $(VOID)
277         @rm tmp
278         $(VALGRIND) ./fuzzer -T1mn -t1
279         $(VALGRIND) ./fullbench -i1
280
281 endif
282
283
284 ifneq (,$(filter MINGW% MSYS%,$(shell uname)))
285 HOST_OS = MSYS
286 endif
287
288
289 #-----------------------------------------------------------------------------
290 # make tests validated only for below targets
291 #-----------------------------------------------------------------------------
292 ifneq (,$(filter $(HOST_OS),MSYS POSIX))
293
294 DIFF:=diff
295 ifneq (,$(filter $(shell uname),SunOS))
296 DIFF:=gdiff
297 endif
298
299 .PHONY: list
300 list:
301         @$(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
302
303 .PHONY: shortest
304 shortest: ZSTDRTTEST=
305 shortest: test-zstd
306
307 .PHONY: fuzztest
308 fuzztest: test-fuzzer test-zstream test-decodecorpus
309
310 .PHONY: test
311 test: test-zstd test-fullbench test-fuzzer test-zstream test-invalidDictionaries test-legacy test-decodecorpus
312 ifeq ($(QEMU_SYS),)
313 test: test-pool
314 endif
315
316 test32: test-zstd32 test-fullbench32 test-fuzzer32 test-zstream32
317
318 test-all: test test32 valgrindTest test-decodecorpus-cli
319
320
321 .PHONY: test-zstd test-zstd32 test-zstd-nolegacy test-zstdgrep
322 test-zstd: ZSTD = $(PRGDIR)/zstd
323 test-zstd: zstd
324
325 test-zstd32: ZSTD = $(PRGDIR)/zstd32
326 test-zstd32: zstd32
327
328 test-zstd-nolegacy: ZSTD = $(PRGDIR)/zstd-nolegacy
329 test-zstd-nolegacy: zstd-nolegacy
330
331 test-zstd test-zstd32 test-zstd-nolegacy: datagen
332         file $(ZSTD)
333         ZSTD="$(QEMU_SYS) $(ZSTD)" ./playTests.sh $(ZSTDRTTEST)
334
335
336 test-gzstd: gzstd
337         $(PRGDIR)/zstd -f README.md test-zstd-speed.py
338         gzip -f README.md test-zstd-speed.py
339         cat README.md.zst test-zstd-speed.py.gz >zstd_gz.zst
340         cat README.md.gz test-zstd-speed.py.zst >gz_zstd.gz
341         $(PRGDIR)/zstd -df README.md.gz -o README2.md
342         $(PRGDIR)/zstd -df README.md.gz test-zstd-speed.py.gz
343         $(PRGDIR)/zstd -df zstd_gz.zst gz_zstd.gz
344         $(DIFF) -q zstd_gz gz_zstd
345         echo Hello World ZSTD | $(PRGDIR)/zstd -c - >hello.zst
346         echo Hello World GZIP | gzip -c - >hello.gz
347         echo Hello World TEXT >hello.txt
348         cat hello.zst hello.gz hello.txt >hello_zst_gz_txt.gz
349         $(PRGDIR)/zstd -dcf hello.*
350         $(PRGDIR)/zstd -dcf - <hello_zst_gz_txt.gz
351         $(RM) *.gz *.zst README2.md gz_zstd zstd_gz hello.txt
352
353 test-zstdgrep: gzstd
354         -[ -f /tmp/zstdcat ] || ln -s $(PWD)/$(PRGDIR)/zstd /tmp/zstdcat
355         echo a | $(PRGDIR)/zstd | env ZCAT=/tmp/zstdcat $(PRGDIR)/zstdgrep a
356         echo a | $(PRGDIR)/zstd | env ZCAT=/tmp/zstdcat $(PRGDIR)/zstdgrep b && return 1 || return 0
357         -echo 'hello world' > test.txt && $(PRGDIR)/zstd test.txt
358         env ZCAT=/tmp/zstdcat $(PRGDIR)/zstdgrep hello test.txt.zst
359         env ZCAT=/tmp/zstdcat $(PRGDIR)/zstdgrep weird test.txt.zst && return 1 || return 0
360         -echo 'hello' > pattern.txt
361         env ZCAT=/tmp/zstdcat $(PRGDIR)/zstdgrep -f pattern.txt test.txt.zst
362         $(RM) test.txt test.txt.zst pattern.txt
363
364 test-fullbench: fullbench datagen
365         $(QEMU_SYS) ./fullbench -i1
366         $(QEMU_SYS) ./fullbench -i1 -P0
367
368 test-fullbench32: fullbench32 datagen
369         $(QEMU_SYS) ./fullbench32 -i1
370         $(QEMU_SYS) ./fullbench32 -i1 -P0
371
372 test-fuzzer: fuzzer
373         $(QEMU_SYS) ./fuzzer -v $(FUZZERTEST) $(FUZZER_FLAGS)
374
375 test-fuzzer-stackmode: MOREFLAGS += -DZSTD_HEAPMODE=0
376 test-fuzzer-stackmode: test-fuzzer
377
378 test-fuzzer32: fuzzer32
379         $(QEMU_SYS) ./fuzzer32 -v $(FUZZERTEST) $(FUZZER_FLAGS)
380
381 test-zbuff: zbufftest
382         $(QEMU_SYS) ./zbufftest $(ZSTREAM_TESTTIME)
383
384 test-zbuff32: zbufftest32
385         $(QEMU_SYS) ./zbufftest32 $(ZSTREAM_TESTTIME)
386
387 test-zstream: zstreamtest
388         $(QEMU_SYS) ./zstreamtest -v $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS)
389         $(QEMU_SYS) ./zstreamtest --mt -t1 $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS)
390         $(QEMU_SYS) ./zstreamtest --newapi -t1 $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS)
391
392 test-zstream32: zstreamtest32
393         $(QEMU_SYS) ./zstreamtest32 $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS)
394
395 test-longmatch: longmatch
396         $(QEMU_SYS) ./longmatch
397
398 test-bigdict: bigdict
399         $(QEMU_SYS) ./bigdict
400
401 test-invalidDictionaries: invalidDictionaries
402         $(QEMU_SYS) ./invalidDictionaries
403
404 test-symbols: symbols
405         $(QEMU_SYS) ./symbols
406
407 test-legacy: legacy
408         $(QEMU_SYS) ./legacy
409
410 test-decodecorpus: decodecorpus
411         $(QEMU_SYS) ./decodecorpus -t $(DECODECORPUS_TESTTIME)
412
413 test-decodecorpus-cli: decodecorpus
414         @echo "\n ---- decodecorpus basic cli tests ----"
415         @mkdir testdir
416         ./decodecorpus -n5 -otestdir -ptestdir
417         @cd testdir && \
418         $(ZSTD) -d z000000.zst -o tmp0 && \
419         $(ZSTD) -d z000001.zst -o tmp1 && \
420         $(ZSTD) -d z000002.zst -o tmp2 && \
421         $(ZSTD) -d z000003.zst -o tmp3 && \
422         $(ZSTD) -d z000004.zst -o tmp4 && \
423         diff z000000 tmp0 && \
424         diff z000001 tmp1 && \
425         diff z000002 tmp2 && \
426         diff z000003 tmp3 && \
427         diff z000004 tmp4 && \
428         rm ./* && \
429         cd ..
430         @echo "\n ---- decodecorpus dictionary cli tests ----"
431         ./decodecorpus -n5 -otestdir -ptestdir --use-dict=1MB
432         @cd testdir && \
433         $(ZSTD) -d z000000.zst -D dictionary -o tmp0 && \
434         $(ZSTD) -d z000001.zst -D dictionary -o tmp1 && \
435         $(ZSTD) -d z000002.zst -D dictionary -o tmp2 && \
436         $(ZSTD) -d z000003.zst -D dictionary -o tmp3 && \
437         $(ZSTD) -d z000004.zst -D dictionary -o tmp4 && \
438         diff z000000 tmp0 && \
439         diff z000001 tmp1 && \
440         diff z000002 tmp2 && \
441         diff z000003 tmp3 && \
442         diff z000004 tmp4 && \
443         cd ..
444         @rm -rf testdir
445
446 test-pool: poolTests
447         $(QEMU_SYS) ./poolTests
448
449 test-lz4: ZSTD = LD_LIBRARY_PATH=/usr/local/lib $(PRGDIR)/zstd
450 test-lz4: ZSTD_LZ4 = LD_LIBRARY_PATH=/usr/local/lib ./lz4
451 test-lz4: ZSTD_UNLZ4 = LD_LIBRARY_PATH=/usr/local/lib ./unlz4
452 test-lz4: zstd decodecorpus datagen
453         [ -f lz4 ] || ln -s $(PRGDIR)/zstd lz4
454         [ -f unlz4 ] || ln -s $(PRGDIR)/zstd unlz4
455
456         ./decodecorpus -ptmp
457         # lz4 -> zstd
458         lz4 < tmp | \
459         $(ZSTD) -d | \
460         cmp - tmp
461         lz4 < tmp | \
462         $(ZSTD_UNLZ4) | \
463         cmp - tmp
464         # zstd -> lz4
465         $(ZSTD) --format=lz4 < tmp | \
466         lz4 -d | \
467         cmp - tmp
468         $(ZSTD_LZ4) < tmp | \
469         lz4 -d | \
470         cmp - tmp
471         # zstd -> zstd
472         $(ZSTD) --format=lz4 < tmp | \
473         $(ZSTD) -d | \
474         cmp - tmp
475         # zstd -> zstd
476         $(ZSTD) < tmp | \
477         $(ZSTD) -d | \
478         cmp - tmp
479
480         ./datagen -g384KB | $(ZSTD) --format=lz4 | $(ZSTD) -d > /dev/null
481
482         rm tmp lz4 unlz4
483
484 endif