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