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