git subrepo pull (merge) --force deps/libchdr
[pcsx_rearmed.git] / deps / libchdr / deps / zstd-1.5.6 / tests / Makefile
CommitLineData
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 23ZSTD_LEGACY_SUPPORT ?= 5
24export ZSTD_LEGACY_SUPPORT
648db22b 25
26DEBUGLEVEL ?= 2
27export DEBUGLEVEL # transmit value to sub-makefiles
28
f535537f 29LIBZSTD_MK_DIR := ../lib
30include $(LIBZSTD_MK_DIR)/libzstd.mk
648db22b 31
648db22b 32PRGDIR = ../programs
33PYTHON ?= python3
34TESTARTEFACT := versionsTest
35
36DEBUGFLAGS += -g -Wno-c++-compat
f535537f 37CPPFLAGS += -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
41ZSTDCOMMON_FILES := $(sort $(ZSTD_COMMON_FILES))
42ZSTDCOMP_FILES := $(sort $(ZSTD_COMPRESS_FILES))
43ZSTDDECOMP_FILES := $(sort $(ZSTD_DECOMPRESS_FILES))
f535537f 44ZSTDLEGACY_FILES := $(sort $(wildcard $(LIB_SRCDIR)/legacy/*.c))
45ZSTD_FILES := $(ZSTDDECOMP_FILES) $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES) $(ZSTDLEGACY_FILES)
648db22b 46ZDICT_FILES := $(sort $(ZSTD_DICTBUILDER_FILES))
47
48ZSTD_F1 := $(sort $(wildcard $(ZSTD_FILES)))
f535537f 49ZSTD_OBJ1 := $(subst $(LIB_SRCDIR)/common/,zstdm_,$(ZSTD_F1))
50ZSTD_OBJ2 := $(subst $(LIB_SRCDIR)/compress/,zstdc_,$(ZSTD_OBJ1))
51ZSTD_OBJ3 := $(subst $(LIB_SRCDIR)/decompress/,zstdd_,$(ZSTD_OBJ2))
52ZSTD_OBJ4 := $(subst $(LIB_SRCDIR)/legacy/,zstdl_,$(ZSTD_OBJ3))
53ZSTD_OBJ5 := $(ZSTD_OBJ4:.c=.o)
54ZSTD_OBJECTS := $(ZSTD_OBJ5:.S=.o)
55
56ZSTDMT_OBJ1 := $(subst $(LIB_SRCDIR)/common/,zstdmt_m_,$(ZSTD_F1))
57ZSTDMT_OBJ2 := $(subst $(LIB_SRCDIR)/compress/,zstdmt_c_,$(ZSTDMT_OBJ1))
58ZSTDMT_OBJ3 := $(subst $(LIB_SRCDIR)/decompress/,zstdmt_d_,$(ZSTDMT_OBJ2))
59ZSTDMT_OBJ4 := $(subst $(LIB_SRCDIR)/legacy/,zstdmt_l_,$(ZSTDMT_OBJ3))
60ZSTDMT_OBJ5 := $(ZSTDMT_OBJ4:.c=.o)
61ZSTDMT_OBJECTS := $(ZSTDMT_OBJ5:.S=.o)
648db22b 62
63# Define *.exe as extension for Windows systems
64ifneq (,$(filter Windows%,$(OS)))
65EXT =.exe
66MULTITHREAD_CPP = -DZSTD_MULTITHREAD
67MULTITHREAD_LD =
68else
69EXT =
70MULTITHREAD_CPP = -DZSTD_MULTITHREAD
71MULTITHREAD_LD = -pthread
72endif
73MULTITHREAD = $(MULTITHREAD_CPP) $(MULTITHREAD_LD)
74
75VOID = /dev/null
76ZSTREAM_TESTTIME ?= -T90s
77FUZZERTEST ?= -T200s
78ZSTDRTTEST = --test-large-data
79DECODECORPUS_TESTTIME ?= -T30
80
81.PHONY: default
82default: fullbench
83
84.PHONY: all
85all: fullbench fuzzer zstreamtest paramgrill datagen decodecorpus roundTripCrash poolTests
86
87.PHONY: all32
88all32: fullbench32 fuzzer32 zstreamtest32
89
90.PHONY: allnothread
91allnothread: MULTITHREAD_CPP=
92allnothread: MULTITHREAD_LD=
93allnothread: fullbench fuzzer paramgrill datagen decodecorpus
94
95# note : broken : requires symbols unavailable from dynamic library
96.PHONY: dll
97dll: fuzzer-dll zstreamtest-dll
98
99.PHONY: zstd zstd32 zstd-nolegacy # only external makefile knows how to build or update them
100zstd zstd32 zstd-nolegacy zstd-dll:
101 $(MAKE) -C $(PRGDIR) $@ MOREFLAGS+="$(DEBUGFLAGS)"
102
103.PHONY: libzstd
104libzstd :
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 113zstdm_%.o : $(LIB_SRCDIR)/common/%.c
648db22b 114 $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
115
f535537f 116zstdc_%.o : $(LIB_SRCDIR)/compress/%.c
648db22b 117 $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
118
f535537f 119zstdd_%.o : $(LIB_SRCDIR)/decompress/%.c
648db22b 120 $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
121
f535537f 122zstdd_%.o : $(LIB_SRCDIR)/decompress/%.S
648db22b 123 $(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
124
f535537f 125zstdl_%.o : $(LIB_SRCDIR)/legacy/%.c
126 $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
127
648db22b 128zstdmt%.o : CPPFLAGS += $(MULTITHREAD_CPP)
129
f535537f 130zstdmt_m_%.o : $(LIB_SRCDIR)/common/%.c
648db22b 131 $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
132
f535537f 133zstdmt_c_%.o : $(LIB_SRCDIR)/compress/%.c
648db22b 134 $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
135
f535537f 136zstdmt_d_%.o : $(LIB_SRCDIR)/decompress/%.c
648db22b 137 $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
138
f535537f 139zstdmt_d_%.o : $(LIB_SRCDIR)/decompress/%.S
648db22b 140 $(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
141
f535537f 142zstdmt_l_%.o : $(LIB_SRCDIR)/legacy/%.c
143 $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
144
648db22b 145FULLBENCHS := fullbench fullbench32
146CLEAN += $(FULLBENCHS)
147fullbench32: 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
155CLEAN += fullbench-lib
156fullbench-lib : CPPFLAGS += -DXXH_NAMESPACE=ZSTD_
f535537f 157fullbench-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
161fullbench-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
165CLEAN += fuzzer fuzzer32
166fuzzer : CPPFLAGS += $(MULTITHREAD_CPP) -Wno-deprecated-declarations
167fuzzer : LDFLAGS += $(MULTITHREAD_LD)
168fuzzer : $(ZSTDMT_OBJECTS)
169fuzzer fuzzer32 : $(ZDICT_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/datagen.c fuzzer.c
170
171fuzzer32 : CFLAGS += -m32 $(MULTITHREAD)
172fuzzer32 : $(ZSTD_FILES)
173 $(LINK.c) $^ -o $@$(EXT)
174
175# note : broken : requires symbols unavailable from dynamic library
f535537f 176fuzzer-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
179CLEAN += zstreamtest zstreamtest32
180ZSTREAM_LOCAL_FILES := $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c seqgen.c zstreamtest.c external_matchfinder.c
181ZSTREAM_PROPER_FILES := $(ZDICT_FILES) $(ZSTREAM_LOCAL_FILES)
182ZSTREAMFILES := $(ZSTD_FILES) $(ZSTREAM_PROPER_FILES)
183zstreamtest32 : CFLAGS += -m32
184zstreamtest zstreamtest32 : CPPFLAGS += $(MULTITHREAD_CPP)
185zstreamtest zstreamtest32 : LDFLAGS += $(MULTITHREAD_LD)
186zstreamtest : $(ZSTDMT_OBJECTS) $(ZSTREAM_PROPER_FILES)
187zstreamtest32 : $(ZSTREAMFILES)
188zstreamtest zstreamtest32 :
189 $(LINK.c) $^ -o $@$(EXT)
190
191CLEAN += zstreamtest_asan
192zstreamtest_asan : CFLAGS += -fsanitize=address
193zstreamtest_asan : $(ZSTREAMFILES)
194 $(LINK.c) $(MULTITHREAD) $^ -o $@$(EXT)
195
196CLEAN += zstreamtest_tsan
197zstreamtest_tsan : CFLAGS += -fsanitize=thread
198zstreamtest_tsan : $(ZSTREAMFILES)
199 $(LINK.c) $(MULTITHREAD) $^ -o $@$(EXT)
200
201CLEAN += zstreamtest_ubsan
202zstreamtest_ubsan : CFLAGS += -fsanitize=undefined
203zstreamtest_ubsan : $(ZSTREAMFILES)
204 $(LINK.c) $(MULTITHREAD) $^ -o $@$(EXT)
205
206# note : broken : requires symbols unavailable from dynamic library
f535537f 207zstreamtest-dll : $(LIB_SRCDIR)/common/xxhash.c # xxh symbols not exposed from dll
648db22b 208zstreamtest-dll : $(ZSTREAM_LOCAL_FILES)
209 $(CC) $(CPPFLAGS) $(CFLAGS) $(filter %.c,$^) $(LDFLAGS) -o $@$(EXT)
210
211CLEAN += paramgrill
212paramgrill : DEBUGFLAGS = # turn off debug for speed measurements
213paramgrill : LDLIBS += -lm
f535537f 214paramgrill : $(ZSTD_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/benchfn.c $(PRGDIR)/benchzstd.c $(PRGDIR)/datagen.c $(PRGDIR)/lorem.c paramgrill.c
648db22b 215
216CLEAN += datagen
f535537f 217datagen : $(PRGDIR)/datagen.c $(PRGDIR)/lorem.c loremOut.c datagencli.c
648db22b 218 $(LINK.c) $^ -o $@$(EXT)
219
220CLEAN += roundTripCrash
221roundTripCrash: CFLAGS += $(MULTITHREAD)
222roundTripCrash : $(ZSTD_OBJECTS) roundTripCrash.c
223
224CLEAN += longmatch
225longmatch : $(ZSTD_OBJECTS) longmatch.c
226
227CLEAN += bigdict
228bigdict: CFLAGS += $(MULTITHREAD)
229bigdict: $(ZSTDMT_OBJECTS) $(PRGDIR)/datagen.c bigdict.c
230
231CLEAN += invalidDictionaries
232invalidDictionaries : $(ZSTD_OBJECTS) invalidDictionaries.c
233
234CLEAN += legacy
f535537f 235legacy : CPPFLAGS += -UZSTD_LEGACY_SUPPORT -DZSTD_LEGACY_SUPPORT=4
236legacy : $(ZSTD_FILES) legacy.c
648db22b 237
238CLEAN += decodecorpus
239decodecorpus : LDLIBS += -lm
240decodecorpus : $(filter-out zstdc_zstd_compress.o, $(ZSTD_OBJECTS)) $(ZDICT_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c decodecorpus.c
241
242CLEAN += poolTests
f535537f 243poolTests : $(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
247versionsTest: clean
248 $(PYTHON) test-zstd-versions.py
249
250.PHONY: automated_benchmarking
251automated_benchmarking: clean
252 $(PYTHON) automated_benchmarking.py
253
254# make checkTag : check that release tag corresponds to release version
255CLEAN += checkTag
f535537f 256checkTag.o : $(LIB_SRCDIR)/zstd.h
648db22b 257
258.PHONY: clean
259clean:
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#----------------------------------------------------------------------------------
274UNAME := $(shell uname)
f535537f 275ifneq (,$(filter $(UNAME),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS AIX CYGWIN_NT))
648db22b 276HOST_OS = POSIX
277
278.PHONY: test-valgrind
279test-valgrind: VALGRIND = valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1
280test-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
293endif
294
295ifneq (,$(filter MINGW% MSYS%,$(UNAME)))
296 HOST_OS = MSYS
297endif
298
299
300#-----------------------------------------------------------------------------
301# make tests validated only for below targets
302#-----------------------------------------------------------------------------
303ifneq (,$(filter $(HOST_OS),MSYS POSIX))
304
305DIFF:=diff
306ifneq (,$(filter $(UNAME),SunOS))
307 DIFF:=gdiff
308endif
309
310.PHONY: list
311list:
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
315shortest: ZSTDRTTEST= # remove long tests
316shortest: test-zstd
317
318.PHONY: check
319check: shortest
320
321.PHONY: fuzztest
322fuzztest: test-fuzzer test-zstream test-decodecorpus
323
324.PHONY: test
f535537f 325test: test-zstd test-cli-tests test-fullbench test-fuzzer test-zstream test-invalidDictionaries test-legacy test-decodecorpus
648db22b 326ifeq ($(QEMU_SYS),)
327test: test-pool
328endif
329
330.PHONY: test32
331test32: test-zstd32 test-fullbench32 test-fuzzer32 test-zstream32
332
333.PHONY: test-all
334test-all: test test32 test-decodecorpus-cli
335
336.PHONY: test-zstd test-zstd32 test-zstd-nolegacy
337test-zstd: ZSTD = $(PRGDIR)/zstd
338test-zstd: zstd
339
340.PHONY: test-zstd-dll
341test-zstd-dll: ZSTD = $(PRGDIR)/zstd
342test-zstd-dll: zstd-dll
343
344test-zstd32: ZSTD = $(PRGDIR)/zstd32
345test-zstd32: zstd32
346
347test-zstd-nolegacy: ZSTD = $(PRGDIR)/zstd-nolegacy
348test-zstd-nolegacy: zstd-nolegacy
349
350test-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
355test-cli-tests: ZSTD = $(PRGDIR)/zstd
356test-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
361test-fullbench: fullbench datagen
362 $(QEMU_SYS) ./fullbench -i1
363 $(QEMU_SYS) ./fullbench -i1 -P0
364
365.PHONY: test-fullbench32
366test-fullbench32: fullbench32 datagen
367 $(QEMU_SYS) ./fullbench32 -i1
368 $(QEMU_SYS) ./fullbench32 -i1 -P0
369
370.PHONY: test-fuzzer
371test-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
376test-fuzzer-stackmode: MOREFLAGS += -DZSTD_HEAPMODE=0
377test-fuzzer-stackmode: test-fuzzer
378
379.PHONY: test-fuzzer32
380test-fuzzer32: fuzzer32
381 $(QEMU_SYS) ./fuzzer32 -v $(FUZZERTEST) $(FUZZER_FLAGS)
382
383.PHONY: test-zstream
384test-zstream: zstreamtest
385 $(QEMU_SYS) ./zstreamtest -v $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS)
386 $(QEMU_SYS) ./zstreamtest --newapi -t1 $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS)
387
388test-zstream32: zstreamtest32
389 $(QEMU_SYS) ./zstreamtest32 -v $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS)
390
391test-longmatch: longmatch
392 $(QEMU_SYS) ./longmatch
393
394test-bigdict: bigdict
395 $(QEMU_SYS) ./bigdict
396
397test-invalidDictionaries: invalidDictionaries
398 $(QEMU_SYS) ./invalidDictionaries
399
400test-legacy: legacy
401 $(QEMU_SYS) ./legacy
402
403test-decodecorpus: decodecorpus
404 $(QEMU_SYS) ./decodecorpus -t $(DECODECORPUS_TESTTIME)
405
406test-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
439test-pool: poolTests
440 $(QEMU_SYS) ./poolTests
441
442test-lz4: ZSTD = LD_LIBRARY_PATH=/usr/local/lib $(PRGDIR)/zstd
443test-lz4: ZSTD_LZ4 = LD_LIBRARY_PATH=/usr/local/lib ./lz4
444test-lz4: ZSTD_UNLZ4 = LD_LIBRARY_PATH=/usr/local/lib ./unlz4
445test-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
477endif