build fix
This commit is contained in:
0
externals/zstd/tests/DEPRECATED-test-zstd-speed.py
vendored
Normal file → Executable file
0
externals/zstd/tests/DEPRECATED-test-zstd-speed.py
vendored
Normal file → Executable file
468
externals/zstd/tests/Makefile
vendored
Normal file
468
externals/zstd/tests/Makefile
vendored
Normal file
@@ -0,0 +1,468 @@
|
||||
|
||||
# ################################################################
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
||||
# in the COPYING file in the root directory of this source tree).
|
||||
# You may select, at your option, one of the above-listed licenses.
|
||||
# ################################################################
|
||||
# datagen : Synthetic and parametrable data generator, for tests
|
||||
# fullbench : Precisely measure speed for each zstd inner functions
|
||||
# fullbench32: Same as fullbench, but forced to compile in 32-bits mode
|
||||
# fuzzer : Test tool, to check zstd integrity on target platform
|
||||
# fuzzer32: Same as fuzzer, but forced to compile in 32-bits mode
|
||||
# paramgrill : parameter tester for zstd
|
||||
# test-zstd-speed.py : script for testing zstd speed difference between commits
|
||||
# versionsTest : compatibility test between zstd versions stored on Github (v0.1+)
|
||||
# zstreamtest : Fuzzer test tool for zstd streaming API
|
||||
# zstreamtest32: Same as zstreamtest, but forced to compile in 32-bits mode
|
||||
# ##########################################################################
|
||||
|
||||
LIBZSTD = ../lib
|
||||
|
||||
ZSTD_LEGACY_SUPPORT ?= 0
|
||||
|
||||
DEBUGLEVEL ?= 2
|
||||
export DEBUGLEVEL # transmit value to sub-makefiles
|
||||
|
||||
include $(LIBZSTD)/libzstd.mk
|
||||
|
||||
ZSTDDIR = $(LIBZSTD)
|
||||
PRGDIR = ../programs
|
||||
PYTHON ?= python3
|
||||
TESTARTEFACT := versionsTest
|
||||
|
||||
DEBUGFLAGS += -g -Wno-c++-compat
|
||||
CPPFLAGS += -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \
|
||||
-I$(ZSTDDIR)/dictBuilder -I$(ZSTDDIR)/deprecated -I$(PRGDIR) \
|
||||
-DZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY=1
|
||||
|
||||
ZSTDCOMMON_FILES := $(sort $(ZSTD_COMMON_FILES))
|
||||
ZSTDCOMP_FILES := $(sort $(ZSTD_COMPRESS_FILES))
|
||||
ZSTDDECOMP_FILES := $(sort $(ZSTD_DECOMPRESS_FILES))
|
||||
ZSTD_FILES := $(ZSTDDECOMP_FILES) $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES)
|
||||
ZDICT_FILES := $(sort $(ZSTD_DICTBUILDER_FILES))
|
||||
|
||||
ZSTD_F1 := $(sort $(wildcard $(ZSTD_FILES)))
|
||||
ZSTD_OBJ1 := $(subst $(ZSTDDIR)/common/,zstdm_,$(ZSTD_F1))
|
||||
ZSTD_OBJ2 := $(subst $(ZSTDDIR)/compress/,zstdc_,$(ZSTD_OBJ1))
|
||||
ZSTD_OBJ3 := $(subst $(ZSTDDIR)/decompress/,zstdd_,$(ZSTD_OBJ2))
|
||||
ZSTD_OBJ4 := $(ZSTD_OBJ3:.c=.o)
|
||||
ZSTD_OBJECTS := $(ZSTD_OBJ4:.S=.o)
|
||||
|
||||
ZSTDMT_OBJ1 := $(subst $(ZSTDDIR)/common/,zstdmt_m_,$(ZSTD_F1))
|
||||
ZSTDMT_OBJ2 := $(subst $(ZSTDDIR)/compress/,zstdmt_c_,$(ZSTDMT_OBJ1))
|
||||
ZSTDMT_OBJ3 := $(subst $(ZSTDDIR)/decompress/,zstdmt_d_,$(ZSTDMT_OBJ2))
|
||||
ZSTDMT_OBJ4 := $(ZSTDMT_OBJ3:.c=.o)
|
||||
ZSTDMT_OBJECTS := $(ZSTDMT_OBJ4:.S=.o)
|
||||
|
||||
# Define *.exe as extension for Windows systems
|
||||
ifneq (,$(filter Windows%,$(OS)))
|
||||
EXT =.exe
|
||||
MULTITHREAD_CPP = -DZSTD_MULTITHREAD
|
||||
MULTITHREAD_LD =
|
||||
else
|
||||
EXT =
|
||||
MULTITHREAD_CPP = -DZSTD_MULTITHREAD
|
||||
MULTITHREAD_LD = -pthread
|
||||
endif
|
||||
MULTITHREAD = $(MULTITHREAD_CPP) $(MULTITHREAD_LD)
|
||||
|
||||
VOID = /dev/null
|
||||
ZSTREAM_TESTTIME ?= -T90s
|
||||
FUZZERTEST ?= -T200s
|
||||
ZSTDRTTEST = --test-large-data
|
||||
DECODECORPUS_TESTTIME ?= -T30
|
||||
|
||||
.PHONY: default
|
||||
default: fullbench
|
||||
|
||||
.PHONY: all
|
||||
all: fullbench fuzzer zstreamtest paramgrill datagen decodecorpus roundTripCrash poolTests
|
||||
|
||||
.PHONY: all32
|
||||
all32: fullbench32 fuzzer32 zstreamtest32
|
||||
|
||||
.PHONY: allnothread
|
||||
allnothread: MULTITHREAD_CPP=
|
||||
allnothread: MULTITHREAD_LD=
|
||||
allnothread: fullbench fuzzer paramgrill datagen decodecorpus
|
||||
|
||||
# note : broken : requires symbols unavailable from dynamic library
|
||||
.PHONY: dll
|
||||
dll: fuzzer-dll zstreamtest-dll
|
||||
|
||||
.PHONY: zstd zstd32 zstd-nolegacy # only external makefile knows how to build or update them
|
||||
zstd zstd32 zstd-nolegacy zstd-dll:
|
||||
$(MAKE) -C $(PRGDIR) $@ MOREFLAGS+="$(DEBUGFLAGS)"
|
||||
|
||||
.PHONY: libzstd
|
||||
libzstd :
|
||||
$(MAKE) -C $(ZSTDDIR) libzstd MOREFLAGS+="$(DEBUGFLAGS)"
|
||||
|
||||
%-dll : libzstd
|
||||
%-dll : LDFLAGS += -L$(ZSTDDIR) -lzstd
|
||||
|
||||
$(ZSTDDIR)/libzstd.a :
|
||||
$(MAKE) -C $(ZSTDDIR) libzstd.a
|
||||
|
||||
zstdm_%.o : $(ZSTDDIR)/common/%.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||
|
||||
zstdc_%.o : $(ZSTDDIR)/compress/%.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||
|
||||
zstdd_%.o : $(ZSTDDIR)/decompress/%.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||
|
||||
zstdd_%.o : $(ZSTDDIR)/decompress/%.S
|
||||
$(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
|
||||
|
||||
zstdmt%.o : CPPFLAGS += $(MULTITHREAD_CPP)
|
||||
|
||||
zstdmt_m_%.o : $(ZSTDDIR)/common/%.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||
|
||||
zstdmt_c_%.o : $(ZSTDDIR)/compress/%.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||
|
||||
zstdmt_d_%.o : $(ZSTDDIR)/decompress/%.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||
|
||||
zstdmt_d_%.o : $(ZSTDDIR)/decompress/%.S
|
||||
$(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
|
||||
|
||||
FULLBENCHS := fullbench fullbench32
|
||||
CLEAN += $(FULLBENCHS)
|
||||
fullbench32: CPPFLAGS += -m32
|
||||
$(FULLBENCHS) : CPPFLAGS += $(MULTITHREAD_CPP) -Wno-deprecated-declarations
|
||||
$(FULLBENCHS) : LDFLAGS += $(MULTITHREAD_LD)
|
||||
$(FULLBENCHS) : DEBUGFLAGS = -DNDEBUG # turn off assert() for speed measurements
|
||||
$(FULLBENCHS) : $(ZSTD_FILES)
|
||||
$(FULLBENCHS) : $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/benchfn.c fullbench.c
|
||||
$(LINK.c) $^ -o $@$(EXT)
|
||||
|
||||
CLEAN += fullbench-lib
|
||||
fullbench-lib : CPPFLAGS += -DXXH_NAMESPACE=ZSTD_
|
||||
fullbench-lib : $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/benchfn.c $(ZSTDDIR)/libzstd.a fullbench.c
|
||||
$(LINK.c) $^ -o $@$(EXT)
|
||||
|
||||
# note : broken : requires symbols unavailable from dynamic library
|
||||
fullbench-dll: $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/benchfn.c $(PRGDIR)/timefn.c fullbench.c
|
||||
# $(CC) $(FLAGS) $(filter %.c,$^) -o $@$(EXT) -DZSTD_DLL_IMPORT=1 $(ZSTDDIR)/dll/libzstd.dll
|
||||
$(LINK.c) $^ $(LDLIBS) -o $@$(EXT)
|
||||
|
||||
CLEAN += fuzzer fuzzer32
|
||||
fuzzer : CPPFLAGS += $(MULTITHREAD_CPP) -Wno-deprecated-declarations
|
||||
fuzzer : LDFLAGS += $(MULTITHREAD_LD)
|
||||
fuzzer : $(ZSTDMT_OBJECTS)
|
||||
fuzzer fuzzer32 : $(ZDICT_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/datagen.c fuzzer.c
|
||||
|
||||
fuzzer32 : CFLAGS += -m32 $(MULTITHREAD)
|
||||
fuzzer32 : $(ZSTD_FILES)
|
||||
$(LINK.c) $^ -o $@$(EXT)
|
||||
|
||||
# note : broken : requires symbols unavailable from dynamic library
|
||||
fuzzer-dll : $(ZSTDDIR)/common/xxhash.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/datagen.c fuzzer.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(filter %.c,$^) $(LDFLAGS) -o $@$(EXT)
|
||||
|
||||
CLEAN += zstreamtest zstreamtest32
|
||||
ZSTREAM_LOCAL_FILES := $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c seqgen.c zstreamtest.c external_matchfinder.c
|
||||
ZSTREAM_PROPER_FILES := $(ZDICT_FILES) $(ZSTREAM_LOCAL_FILES)
|
||||
ZSTREAMFILES := $(ZSTD_FILES) $(ZSTREAM_PROPER_FILES)
|
||||
zstreamtest32 : CFLAGS += -m32
|
||||
zstreamtest zstreamtest32 : CPPFLAGS += $(MULTITHREAD_CPP)
|
||||
zstreamtest zstreamtest32 : LDFLAGS += $(MULTITHREAD_LD)
|
||||
zstreamtest : $(ZSTDMT_OBJECTS) $(ZSTREAM_PROPER_FILES)
|
||||
zstreamtest32 : $(ZSTREAMFILES)
|
||||
zstreamtest zstreamtest32 :
|
||||
$(LINK.c) $^ -o $@$(EXT)
|
||||
|
||||
CLEAN += zstreamtest_asan
|
||||
zstreamtest_asan : CFLAGS += -fsanitize=address
|
||||
zstreamtest_asan : $(ZSTREAMFILES)
|
||||
$(LINK.c) $(MULTITHREAD) $^ -o $@$(EXT)
|
||||
|
||||
CLEAN += zstreamtest_tsan
|
||||
zstreamtest_tsan : CFLAGS += -fsanitize=thread
|
||||
zstreamtest_tsan : $(ZSTREAMFILES)
|
||||
$(LINK.c) $(MULTITHREAD) $^ -o $@$(EXT)
|
||||
|
||||
CLEAN += zstreamtest_ubsan
|
||||
zstreamtest_ubsan : CFLAGS += -fsanitize=undefined
|
||||
zstreamtest_ubsan : $(ZSTREAMFILES)
|
||||
$(LINK.c) $(MULTITHREAD) $^ -o $@$(EXT)
|
||||
|
||||
# note : broken : requires symbols unavailable from dynamic library
|
||||
zstreamtest-dll : $(ZSTDDIR)/common/xxhash.c # xxh symbols not exposed from dll
|
||||
zstreamtest-dll : $(ZSTREAM_LOCAL_FILES)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(filter %.c,$^) $(LDFLAGS) -o $@$(EXT)
|
||||
|
||||
CLEAN += paramgrill
|
||||
paramgrill : DEBUGFLAGS = # turn off debug for speed measurements
|
||||
paramgrill : LDLIBS += -lm
|
||||
paramgrill : $(ZSTD_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/benchfn.c $(PRGDIR)/benchzstd.c $(PRGDIR)/datagen.c paramgrill.c
|
||||
|
||||
CLEAN += datagen
|
||||
datagen : $(PRGDIR)/datagen.c datagencli.c
|
||||
$(LINK.c) $^ -o $@$(EXT)
|
||||
|
||||
CLEAN += roundTripCrash
|
||||
roundTripCrash: CFLAGS += $(MULTITHREAD)
|
||||
roundTripCrash : $(ZSTD_OBJECTS) roundTripCrash.c
|
||||
|
||||
CLEAN += longmatch
|
||||
longmatch : $(ZSTD_OBJECTS) longmatch.c
|
||||
|
||||
CLEAN += bigdict
|
||||
bigdict: CFLAGS += $(MULTITHREAD)
|
||||
bigdict: $(ZSTDMT_OBJECTS) $(PRGDIR)/datagen.c bigdict.c
|
||||
|
||||
CLEAN += invalidDictionaries
|
||||
invalidDictionaries : $(ZSTD_OBJECTS) invalidDictionaries.c
|
||||
|
||||
CLEAN += legacy
|
||||
legacy : CPPFLAGS += -I$(ZSTDDIR)/legacy -UZSTD_LEGACY_SUPPORT -DZSTD_LEGACY_SUPPORT=4
|
||||
legacy : $(ZSTD_FILES) $(sort $(wildcard $(ZSTDDIR)/legacy/*.c)) legacy.c
|
||||
|
||||
CLEAN += decodecorpus
|
||||
decodecorpus : LDLIBS += -lm
|
||||
decodecorpus : $(filter-out zstdc_zstd_compress.o, $(ZSTD_OBJECTS)) $(ZDICT_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c decodecorpus.c
|
||||
|
||||
CLEAN += poolTests
|
||||
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
|
||||
$(LINK.c) $(MULTITHREAD) $^ -o $@$(EXT)
|
||||
|
||||
.PHONY: versionsTest
|
||||
versionsTest: clean
|
||||
$(PYTHON) test-zstd-versions.py
|
||||
|
||||
.PHONY: automated_benchmarking
|
||||
automated_benchmarking: clean
|
||||
$(PYTHON) automated_benchmarking.py
|
||||
|
||||
# make checkTag : check that release tag corresponds to release version
|
||||
CLEAN += checkTag
|
||||
checkTag.o : $(ZSTDDIR)/zstd.h
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
$(MAKE) -C $(ZSTDDIR) clean
|
||||
$(MAKE) -C $(PRGDIR) clean
|
||||
$(RM) -fR $(TESTARTEFACT)
|
||||
$(RM) -rf tmp* # some test directories are named tmp*
|
||||
$(RM) $(CLEAN) core *.o *.tmp result* *.gcda dictionary *.zst \
|
||||
$(PRGDIR)/zstd$(EXT) $(PRGDIR)/zstd32$(EXT) \
|
||||
fullbench-dll$(EXT) fuzzer-dll$(EXT) zstreamtest-dll$(EXT)
|
||||
@echo Cleaning completed
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------------
|
||||
# valgrind tests validated only for some posix platforms
|
||||
#----------------------------------------------------------------------------------
|
||||
UNAME := $(shell uname)
|
||||
ifneq (,$(filter $(UNAME),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS AIX))
|
||||
HOST_OS = POSIX
|
||||
|
||||
.PHONY: test-valgrind
|
||||
test-valgrind: VALGRIND = valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1
|
||||
test-valgrind: zstd datagen fuzzer fullbench
|
||||
@echo "\n ---- valgrind tests : memory analyzer ----"
|
||||
$(VALGRIND) ./datagen -g50M > $(VOID)
|
||||
$(VALGRIND) $(PRGDIR)/zstd ; if [ $$? -eq 0 ] ; then echo "zstd without argument should have failed"; false; fi
|
||||
./datagen -g80 | $(VALGRIND) $(PRGDIR)/zstd - -c > $(VOID)
|
||||
./datagen -g16KB | $(VALGRIND) $(PRGDIR)/zstd -vf - -c > $(VOID)
|
||||
./datagen -g2930KB | $(VALGRIND) $(PRGDIR)/zstd -5 -vf - -o tmp
|
||||
$(VALGRIND) $(PRGDIR)/zstd -vdf tmp -c > $(VOID)
|
||||
./datagen -g64MB | $(VALGRIND) $(PRGDIR)/zstd -vf - -c > $(VOID)
|
||||
$(RM) tmp
|
||||
$(VALGRIND) ./fuzzer -T1mn -t1
|
||||
$(VALGRIND) ./fullbench -i1
|
||||
|
||||
endif
|
||||
|
||||
ifneq (,$(filter MINGW% MSYS%,$(UNAME)))
|
||||
HOST_OS = MSYS
|
||||
endif
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# make tests validated only for below targets
|
||||
#-----------------------------------------------------------------------------
|
||||
ifneq (,$(filter $(HOST_OS),MSYS POSIX))
|
||||
|
||||
DIFF:=diff
|
||||
ifneq (,$(filter $(UNAME),SunOS))
|
||||
DIFF:=gdiff
|
||||
endif
|
||||
|
||||
.PHONY: list
|
||||
list:
|
||||
@$(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
|
||||
|
||||
.PHONY: shortest
|
||||
shortest: ZSTDRTTEST= # remove long tests
|
||||
shortest: test-zstd
|
||||
|
||||
.PHONY: check
|
||||
check: shortest
|
||||
|
||||
.PHONY: fuzztest
|
||||
fuzztest: test-fuzzer test-zstream test-decodecorpus
|
||||
|
||||
.PHONY: test
|
||||
test: test-zstd test-fullbench test-fuzzer test-zstream test-invalidDictionaries test-legacy test-decodecorpus test-cli-tests
|
||||
ifeq ($(QEMU_SYS),)
|
||||
test: test-pool
|
||||
endif
|
||||
|
||||
.PHONY: test32
|
||||
test32: test-zstd32 test-fullbench32 test-fuzzer32 test-zstream32
|
||||
|
||||
.PHONY: test-all
|
||||
test-all: test test32 test-decodecorpus-cli
|
||||
|
||||
.PHONY: test-zstd test-zstd32 test-zstd-nolegacy
|
||||
test-zstd: ZSTD = $(PRGDIR)/zstd
|
||||
test-zstd: zstd
|
||||
|
||||
.PHONY: test-zstd-dll
|
||||
test-zstd-dll: ZSTD = $(PRGDIR)/zstd
|
||||
test-zstd-dll: zstd-dll
|
||||
|
||||
test-zstd32: ZSTD = $(PRGDIR)/zstd32
|
||||
test-zstd32: zstd32
|
||||
|
||||
test-zstd-nolegacy: ZSTD = $(PRGDIR)/zstd-nolegacy
|
||||
test-zstd-nolegacy: zstd-nolegacy
|
||||
|
||||
test-zstd test-zstd32 test-zstd-nolegacy test-zstd-dll: datagen
|
||||
file $(ZSTD)
|
||||
EXE_PREFIX="$(QEMU_SYS)" ZSTD_BIN="$(ZSTD)" DATAGEN_BIN=./datagen ./playTests.sh $(ZSTDRTTEST)
|
||||
|
||||
.PHONY: test-cli-tests
|
||||
test-cli-tests: ZSTD = $(PRGDIR)/zstd
|
||||
test-cli-tests: zstd datagen
|
||||
file $(ZSTD)
|
||||
./cli-tests/run.py --exec-prefix="$(QEMU_SYS)" --zstd="$(ZSTD)" --datagen=./datagen
|
||||
|
||||
.PHONY: test-fullbench
|
||||
test-fullbench: fullbench datagen
|
||||
$(QEMU_SYS) ./fullbench -i1
|
||||
$(QEMU_SYS) ./fullbench -i1 -P0
|
||||
|
||||
.PHONY: test-fullbench32
|
||||
test-fullbench32: fullbench32 datagen
|
||||
$(QEMU_SYS) ./fullbench32 -i1
|
||||
$(QEMU_SYS) ./fullbench32 -i1 -P0
|
||||
|
||||
.PHONY: test-fuzzer
|
||||
test-fuzzer: fuzzer
|
||||
$(QEMU_SYS) ./fuzzer -v $(FUZZERTEST) $(FUZZER_FLAGS)
|
||||
|
||||
# Note : this test presumes `fuzzer` will be built
|
||||
.PHONY: test-fuzzer-stackmode
|
||||
test-fuzzer-stackmode: MOREFLAGS += -DZSTD_HEAPMODE=0
|
||||
test-fuzzer-stackmode: test-fuzzer
|
||||
|
||||
.PHONY: test-fuzzer32
|
||||
test-fuzzer32: fuzzer32
|
||||
$(QEMU_SYS) ./fuzzer32 -v $(FUZZERTEST) $(FUZZER_FLAGS)
|
||||
|
||||
.PHONY: test-zstream
|
||||
test-zstream: zstreamtest
|
||||
$(QEMU_SYS) ./zstreamtest -v $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS)
|
||||
$(QEMU_SYS) ./zstreamtest --newapi -t1 $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS)
|
||||
|
||||
test-zstream32: zstreamtest32
|
||||
$(QEMU_SYS) ./zstreamtest32 -v $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS)
|
||||
|
||||
test-longmatch: longmatch
|
||||
$(QEMU_SYS) ./longmatch
|
||||
|
||||
test-bigdict: bigdict
|
||||
$(QEMU_SYS) ./bigdict
|
||||
|
||||
test-invalidDictionaries: invalidDictionaries
|
||||
$(QEMU_SYS) ./invalidDictionaries
|
||||
|
||||
test-legacy: legacy
|
||||
$(QEMU_SYS) ./legacy
|
||||
|
||||
test-decodecorpus: decodecorpus
|
||||
$(QEMU_SYS) ./decodecorpus -t $(DECODECORPUS_TESTTIME)
|
||||
|
||||
test-decodecorpus-cli: decodecorpus
|
||||
@echo "\n ---- decodecorpus basic cli tests ----"
|
||||
@mkdir testdir
|
||||
./decodecorpus -n5 -otestdir -ptestdir
|
||||
@cd testdir && \
|
||||
$(ZSTD) -d z000000.zst -o tmp0 && \
|
||||
$(ZSTD) -d z000001.zst -o tmp1 && \
|
||||
$(ZSTD) -d z000002.zst -o tmp2 && \
|
||||
$(ZSTD) -d z000003.zst -o tmp3 && \
|
||||
$(ZSTD) -d z000004.zst -o tmp4 && \
|
||||
diff z000000 tmp0 && \
|
||||
diff z000001 tmp1 && \
|
||||
diff z000002 tmp2 && \
|
||||
diff z000003 tmp3 && \
|
||||
diff z000004 tmp4 && \
|
||||
rm ./* && \
|
||||
cd ..
|
||||
@echo "\n ---- decodecorpus dictionary cli tests ----"
|
||||
./decodecorpus -n5 -otestdir -ptestdir --use-dict=1MB
|
||||
@cd testdir && \
|
||||
$(ZSTD) -d z000000.zst -D dictionary -o tmp0 && \
|
||||
$(ZSTD) -d z000001.zst -D dictionary -o tmp1 && \
|
||||
$(ZSTD) -d z000002.zst -D dictionary -o tmp2 && \
|
||||
$(ZSTD) -d z000003.zst -D dictionary -o tmp3 && \
|
||||
$(ZSTD) -d z000004.zst -D dictionary -o tmp4 && \
|
||||
diff z000000 tmp0 && \
|
||||
diff z000001 tmp1 && \
|
||||
diff z000002 tmp2 && \
|
||||
diff z000003 tmp3 && \
|
||||
diff z000004 tmp4 && \
|
||||
cd ..
|
||||
@rm -rf testdir
|
||||
|
||||
test-pool: poolTests
|
||||
$(QEMU_SYS) ./poolTests
|
||||
|
||||
test-lz4: ZSTD = LD_LIBRARY_PATH=/usr/local/lib $(PRGDIR)/zstd
|
||||
test-lz4: ZSTD_LZ4 = LD_LIBRARY_PATH=/usr/local/lib ./lz4
|
||||
test-lz4: ZSTD_UNLZ4 = LD_LIBRARY_PATH=/usr/local/lib ./unlz4
|
||||
test-lz4: zstd decodecorpus datagen
|
||||
[ -f lz4 ] || ln -s $(PRGDIR)/zstd lz4
|
||||
[ -f unlz4 ] || ln -s $(PRGDIR)/zstd unlz4
|
||||
|
||||
./decodecorpus -ptmp
|
||||
# lz4 -> zstd
|
||||
lz4 < tmp | \
|
||||
$(ZSTD) -d | \
|
||||
cmp - tmp
|
||||
lz4 < tmp | \
|
||||
$(ZSTD_UNLZ4) | \
|
||||
cmp - tmp
|
||||
# zstd -> lz4
|
||||
$(ZSTD) --format=lz4 < tmp | \
|
||||
lz4 -d | \
|
||||
cmp - tmp
|
||||
$(ZSTD_LZ4) < tmp | \
|
||||
lz4 -d | \
|
||||
cmp - tmp
|
||||
# zstd -> zstd
|
||||
$(ZSTD) --format=lz4 < tmp | \
|
||||
$(ZSTD) -d | \
|
||||
cmp - tmp
|
||||
# zstd -> zstd
|
||||
$(ZSTD) < tmp | \
|
||||
$(ZSTD) -d | \
|
||||
cmp - tmp
|
||||
|
||||
./datagen -g384KB | $(ZSTD) --format=lz4 | $(ZSTD) -d > /dev/null
|
||||
|
||||
rm tmp lz4 unlz4
|
||||
|
||||
endif
|
||||
0
externals/zstd/tests/check_size.py
vendored
Normal file → Executable file
0
externals/zstd/tests/check_size.py
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/basic/help.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/basic/help.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/basic/memlimit.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/basic/memlimit.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/basic/output_dir.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/basic/output_dir.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/basic/version.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/basic/version.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/bin/cmp_size
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/bin/cmp_size
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/bin/datagen
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/bin/datagen
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/bin/die
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/bin/die
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/bin/println
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/bin/println
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/bin/zstd
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/bin/zstd
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/bin/zstdgrep
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/bin/zstdgrep
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/bin/zstdless
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/bin/zstdless
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/cltools/setup
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/cltools/setup
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/cltools/zstdgrep.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/cltools/zstdgrep.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/cltools/zstdless.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/cltools/zstdless.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/adapt.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/adapt.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/basic.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/basic.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/compress-literals.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/compress-literals.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/format.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/format.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/golden.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/golden.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/gzip-compat.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/gzip-compat.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/levels.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/levels.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/long-distance-matcher.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/long-distance-matcher.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/multi-threaded.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/multi-threaded.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/multiple-files.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/multiple-files.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/row-match-finder.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/row-match-finder.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/setup
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/setup
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/stream-size.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/stream-size.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/verbose-wlog.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/verbose-wlog.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/window-resize.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/compression/window-resize.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/decompression/golden.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/decompression/golden.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/decompression/pass-through.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/decompression/pass-through.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/dict-builder/empty-input.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/dict-builder/empty-input.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/dict-builder/no-inputs.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/dict-builder/no-inputs.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/dictionaries/dictionary-mismatch.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/dictionaries/dictionary-mismatch.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/dictionaries/golden.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/dictionaries/golden.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/dictionaries/setup
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/dictionaries/setup
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/dictionaries/setup_once
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/dictionaries/setup_once
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/file-stat/compress-file-to-dir-without-write-perm.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/file-stat/compress-file-to-dir-without-write-perm.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/file-stat/compress-file-to-file.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/file-stat/compress-file-to-file.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/file-stat/compress-file-to-stdout.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/file-stat/compress-file-to-stdout.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/file-stat/compress-stdin-to-file.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/file-stat/compress-stdin-to-file.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/file-stat/compress-stdin-to-stdout.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/file-stat/compress-stdin-to-stdout.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/file-stat/decompress-file-to-file.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/file-stat/decompress-file-to-file.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/file-stat/decompress-file-to-stdout.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/file-stat/decompress-file-to-stdout.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/file-stat/decompress-stdin-to-file.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/file-stat/decompress-stdin-to-file.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/file-stat/decompress-stdin-to-stdout.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/file-stat/decompress-stdin-to-stdout.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/progress/no-progress.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/progress/no-progress.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/progress/progress.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/progress/progress.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/run.py
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/run.py
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/zstd-symlinks/setup
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/zstd-symlinks/setup
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/zstd-symlinks/zstdcat.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/cli-tests/zstd-symlinks/zstdcat.sh
vendored
Normal file → Executable file
270
externals/zstd/tests/fuzz/Makefile
vendored
Normal file
270
externals/zstd/tests/fuzz/Makefile
vendored
Normal file
@@ -0,0 +1,270 @@
|
||||
# ################################################################
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
||||
# in the COPYING file in the root directory of this source tree).
|
||||
# You may select, at your option, one of the above-listed licenses.
|
||||
# ################################################################
|
||||
|
||||
# Optionally user defined flags
|
||||
CFLAGS ?= -O3
|
||||
CXXFLAGS ?= -O3
|
||||
CPPFLAGS ?=
|
||||
ASFLAGS ?=
|
||||
LDFLAGS ?=
|
||||
ARFLAGS ?=
|
||||
LIB_FUZZING_ENGINE ?= libregression.a
|
||||
PYTHON ?= python
|
||||
ifeq ($(shell uname), Darwin)
|
||||
DOWNLOAD?=curl -L -o
|
||||
else
|
||||
DOWNLOAD?=wget -O
|
||||
endif
|
||||
CORPORA_URL_PREFIX:=https://github.com/facebook/zstd/releases/download/fuzz-corpora/
|
||||
|
||||
LIBZSTD = ../../lib
|
||||
DEBUGLEVEL ?= 2
|
||||
ZSTD_LEGACY_SUPPORT ?= 1
|
||||
|
||||
include $(LIBZSTD)/libzstd.mk
|
||||
|
||||
ZSTDDIR = ../../lib
|
||||
PRGDIR = ../../programs
|
||||
CONTRIBDIR = ../../contrib
|
||||
|
||||
DEFAULT_SEQ_PROD_DIR = $(CONTRIBDIR)/externalSequenceProducer
|
||||
DEFAULT_SEQ_PROD_SRC = $(DEFAULT_SEQ_PROD_DIR)/sequence_producer.c
|
||||
THIRD_PARTY_SEQ_PROD_OBJ ?=
|
||||
|
||||
FUZZ_CPPFLAGS := -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \
|
||||
-I$(ZSTDDIR)/dictBuilder -I$(ZSTDDIR)/deprecated -I$(ZSTDDIR)/legacy \
|
||||
-I$(CONTRIBDIR)/seekable_format -I$(PRGDIR) -I$(DEFAULT_SEQ_PROD_DIR) \
|
||||
-DZSTD_MULTITHREAD -DZSTD_LEGACY_SUPPORT=1 $(CPPFLAGS)
|
||||
FUZZ_EXTRA_FLAGS := -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
||||
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
|
||||
-Wstrict-prototypes -Wundef \
|
||||
-Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
|
||||
-Wredundant-decls -Wno-deprecated-declarations \
|
||||
-g -fno-omit-frame-pointer
|
||||
FUZZ_CFLAGS := $(FUZZ_EXTRA_FLAGS) $(CFLAGS)
|
||||
FUZZ_ASFLAGS := $(FUZZ_EXTRA_FLAGS) $(ASFLAGS)
|
||||
FUZZ_CXXFLAGS := $(FUZZ_EXTRA_FLAGS) -std=c++11 $(CXXFLAGS)
|
||||
FUZZ_LDFLAGS := -pthread $(LDFLAGS)
|
||||
FUZZ_ARFLAGS := $(ARFLAGS)
|
||||
FUZZ_TARGET_FLAGS = $(FUZZ_CPPFLAGS) $(FUZZ_CXXFLAGS) $(FUZZ_LDFLAGS)
|
||||
|
||||
FUZZ_ROUND_TRIP_FLAGS := -DFUZZING_ASSERT_VALID_SEQUENCE
|
||||
|
||||
FUZZ_HEADERS := fuzz_helpers.h fuzz.h zstd_helpers.h fuzz_data_producer.h
|
||||
FUZZ_SRC := $(PRGDIR)/util.c ./fuzz_helpers.c ./zstd_helpers.c ./fuzz_data_producer.c
|
||||
|
||||
SEEKABLE_HEADERS = $(CONTRIBDIR)/seekable_format/zstd_seekable.h
|
||||
SEEKABLE_OBJS = $(CONTRIBDIR)/seekable_format/zstdseek_compress.c $(CONTRIBDIR)/seekable_format/zstdseek_decompress.c
|
||||
|
||||
ZSTDCOMMON_SRC := $(ZSTD_COMMON_FILES)
|
||||
ZSTDCOMP_SRC := $(ZSTD_COMPRESS_FILES)
|
||||
ZSTDDECOMP_SRC := $(ZSTD_DECOMPRESS_FILES)
|
||||
ZSTDDICT_SRC := $(ZSTD_DICTBUILDER_FILES)
|
||||
ZSTDLEGACY_SRC := $(ZSTD_LEGACY_FILES)
|
||||
FUZZ_SRC := \
|
||||
$(FUZZ_SRC) \
|
||||
$(ZSTDDECOMP_SRC) \
|
||||
$(ZSTDCOMMON_SRC) \
|
||||
$(ZSTDCOMP_SRC) \
|
||||
$(ZSTDDICT_SRC) \
|
||||
$(ZSTDLEGACY_SRC) \
|
||||
$(DEFAULT_SEQ_PROD_SRC)
|
||||
FUZZ_SRC := $(sort $(wildcard $(FUZZ_SRC)))
|
||||
|
||||
FUZZ_D_OBJ1 := $(subst $(ZSTDDIR)/common/,d_lib_common_,$(FUZZ_SRC))
|
||||
FUZZ_D_OBJ2 := $(subst $(ZSTDDIR)/compress/,d_lib_compress_,$(FUZZ_D_OBJ1))
|
||||
FUZZ_D_OBJ3 := $(subst $(ZSTDDIR)/decompress/,d_lib_decompress_,$(FUZZ_D_OBJ2))
|
||||
FUZZ_D_OBJ4 := $(subst $(ZSTDDIR)/dictBuilder/,d_lib_dictBuilder_,$(FUZZ_D_OBJ3))
|
||||
FUZZ_D_OBJ5 := $(subst $(ZSTDDIR)/legacy/,d_lib_legacy_,$(FUZZ_D_OBJ4))
|
||||
FUZZ_D_OBJ6 := $(subst $(PRGDIR)/,d_prg_,$(FUZZ_D_OBJ5))
|
||||
FUZZ_D_OBJ7 := $(subst $(DEFAULT_SEQ_PROD_DIR)/,d_default_seq_prod_,$(FUZZ_D_OBJ6))
|
||||
FUZZ_D_OBJ8 := $(subst $\./,d_fuzz_,$(FUZZ_D_OBJ7))
|
||||
FUZZ_D_OBJ9 := $(FUZZ_D_OBJ8:.c=.o)
|
||||
FUZZ_D_OBJ10 := $(THIRD_PARTY_SEQ_PROD_OBJ) $(FUZZ_D_OBJ9)
|
||||
FUZZ_DECOMPRESS_OBJ := $(FUZZ_D_OBJ10:.S=.o)
|
||||
|
||||
FUZZ_RT_OBJ1 := $(subst $(ZSTDDIR)/common/,rt_lib_common_,$(FUZZ_SRC))
|
||||
FUZZ_RT_OBJ2 := $(subst $(ZSTDDIR)/compress/,rt_lib_compress_,$(FUZZ_RT_OBJ1))
|
||||
FUZZ_RT_OBJ3 := $(subst $(ZSTDDIR)/decompress/,rt_lib_decompress_,$(FUZZ_RT_OBJ2))
|
||||
FUZZ_RT_OBJ4 := $(subst $(ZSTDDIR)/dictBuilder/,rt_lib_dictBuilder_,$(FUZZ_RT_OBJ3))
|
||||
FUZZ_RT_OBJ5 := $(subst $(ZSTDDIR)/legacy/,rt_lib_legacy_,$(FUZZ_RT_OBJ4))
|
||||
FUZZ_RT_OBJ6 := $(subst $(PRGDIR)/,rt_prg_,$(FUZZ_RT_OBJ5))
|
||||
FUZZ_RT_OBJ7 := $(subst $(DEFAULT_SEQ_PROD_DIR)/,rt_default_seq_prod_,$(FUZZ_RT_OBJ6))
|
||||
FUZZ_RT_OBJ8 := $(subst $\./,rt_fuzz_,$(FUZZ_RT_OBJ7))
|
||||
FUZZ_RT_OBJ9 := $(FUZZ_RT_OBJ8:.c=.o)
|
||||
FUZZ_RT_OBJ10 := $(THIRD_PARTY_SEQ_PROD_OBJ) $(FUZZ_RT_OBJ9)
|
||||
FUZZ_ROUND_TRIP_OBJ := $(FUZZ_RT_OBJ10:.S=.o)
|
||||
|
||||
.PHONY: default all clean cleanall
|
||||
|
||||
default: all
|
||||
|
||||
FUZZ_TARGETS := \
|
||||
simple_round_trip \
|
||||
stream_round_trip \
|
||||
block_round_trip \
|
||||
simple_decompress \
|
||||
stream_decompress \
|
||||
block_decompress \
|
||||
dictionary_round_trip \
|
||||
dictionary_decompress \
|
||||
zstd_frame_info \
|
||||
simple_compress \
|
||||
dictionary_loader \
|
||||
raw_dictionary_round_trip \
|
||||
dictionary_stream_round_trip \
|
||||
decompress_dstSize_tooSmall \
|
||||
fse_read_ncount \
|
||||
sequence_compression_api \
|
||||
seekable_roundtrip \
|
||||
huf_round_trip \
|
||||
huf_decompress
|
||||
|
||||
all: libregression.a $(FUZZ_TARGETS)
|
||||
|
||||
rt_lib_common_%.o: $(ZSTDDIR)/common/%.c
|
||||
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $(FUZZ_ROUND_TRIP_FLAGS) $< -c -o $@
|
||||
|
||||
rt_lib_compress_%.o: $(ZSTDDIR)/compress/%.c
|
||||
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $(FUZZ_ROUND_TRIP_FLAGS) $< -c -o $@
|
||||
|
||||
rt_lib_decompress_%.o: $(ZSTDDIR)/decompress/%.c
|
||||
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $(FUZZ_ROUND_TRIP_FLAGS) $< -c -o $@
|
||||
|
||||
rt_lib_decompress_%.o: $(ZSTDDIR)/decompress/%.S
|
||||
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_ASFLAGS) $(FUZZ_ROUND_TRIP_FLAGS) $< -c -o $@
|
||||
|
||||
rt_lib_dictBuilder_%.o: $(ZSTDDIR)/dictBuilder/%.c
|
||||
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $(FUZZ_ROUND_TRIP_FLAGS) $< -c -o $@
|
||||
|
||||
rt_lib_legacy_%.o: $(ZSTDDIR)/legacy/%.c
|
||||
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $(FUZZ_ROUND_TRIP_FLAGS) $< -c -o $@
|
||||
|
||||
rt_prg_%.o: $(PRGDIR)/%.c
|
||||
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $(FUZZ_ROUND_TRIP_FLAGS) $< -c -o $@
|
||||
|
||||
rt_fuzz_%.o: %.c
|
||||
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $(FUZZ_ROUND_TRIP_FLAGS) $< -c -o $@
|
||||
|
||||
rt_default_seq_prod_%.o: $(DEFAULT_SEQ_PROD_DIR)/%.c
|
||||
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $(FUZZ_ROUND_TRIP_FLAGS) $< -c -o $@
|
||||
|
||||
d_lib_common_%.o: $(ZSTDDIR)/common/%.c
|
||||
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $< -c -o $@
|
||||
|
||||
d_lib_compress_%.o: $(ZSTDDIR)/compress/%.c
|
||||
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $< -c -o $@
|
||||
|
||||
d_lib_decompress_%.o: $(ZSTDDIR)/decompress/%.c
|
||||
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $< -c -o $@
|
||||
|
||||
d_lib_decompress_%.o: $(ZSTDDIR)/decompress/%.S
|
||||
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_ASFLAGS) $< -c -o $@
|
||||
|
||||
d_lib_dictBuilder_%.o: $(ZSTDDIR)/dictBuilder/%.c
|
||||
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $< -c -o $@
|
||||
|
||||
d_lib_legacy_%.o: $(ZSTDDIR)/legacy/%.c
|
||||
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $< -c -o $@
|
||||
|
||||
d_prg_%.o: $(PRGDIR)/%.c
|
||||
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $< -c -o $@
|
||||
|
||||
d_fuzz_%.o: %.c
|
||||
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $< -c -o $@
|
||||
|
||||
d_default_seq_prod_%.o: $(DEFAULT_SEQ_PROD_DIR)/%.c
|
||||
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $< -c -o $@
|
||||
|
||||
simple_round_trip: $(FUZZ_HEADERS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_simple_round_trip.o
|
||||
$(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_simple_round_trip.o $(LIB_FUZZING_ENGINE) -o $@
|
||||
|
||||
stream_round_trip: $(FUZZ_HEADERS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_stream_round_trip.o
|
||||
$(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_stream_round_trip.o $(LIB_FUZZING_ENGINE) -o $@
|
||||
|
||||
block_round_trip: $(FUZZ_HEADERS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_block_round_trip.o
|
||||
$(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_block_round_trip.o $(LIB_FUZZING_ENGINE) -o $@
|
||||
|
||||
simple_decompress: $(FUZZ_HEADERS) $(FUZZ_DECOMPRESS_OBJ) d_fuzz_simple_decompress.o
|
||||
$(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_DECOMPRESS_OBJ) d_fuzz_simple_decompress.o $(LIB_FUZZING_ENGINE) -o $@
|
||||
|
||||
stream_decompress: $(FUZZ_HEADERS) $(FUZZ_DECOMPRESS_OBJ) d_fuzz_stream_decompress.o
|
||||
$(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_DECOMPRESS_OBJ) d_fuzz_stream_decompress.o $(LIB_FUZZING_ENGINE) -o $@
|
||||
|
||||
block_decompress: $(FUZZ_HEADERS) $(FUZZ_DECOMPRESS_OBJ) d_fuzz_block_decompress.o
|
||||
$(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_DECOMPRESS_OBJ) d_fuzz_block_decompress.o $(LIB_FUZZING_ENGINE) -o $@
|
||||
|
||||
dictionary_round_trip: $(FUZZ_HEADERS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_dictionary_round_trip.o
|
||||
$(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_dictionary_round_trip.o $(LIB_FUZZING_ENGINE) -o $@
|
||||
|
||||
raw_dictionary_round_trip: $(FUZZ_HEADERS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_raw_dictionary_round_trip.o
|
||||
$(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_raw_dictionary_round_trip.o $(LIB_FUZZING_ENGINE) -o $@
|
||||
|
||||
dictionary_stream_round_trip: $(FUZZ_HEADERS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_dictionary_stream_round_trip.o
|
||||
$(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_dictionary_stream_round_trip.o $(LIB_FUZZING_ENGINE) -o $@
|
||||
|
||||
dictionary_decompress: $(FUZZ_HEADERS) $(FUZZ_DECOMPRESS_OBJ) d_fuzz_dictionary_decompress.o
|
||||
$(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_DECOMPRESS_OBJ) d_fuzz_dictionary_decompress.o $(LIB_FUZZING_ENGINE) -o $@
|
||||
|
||||
simple_compress: $(FUZZ_HEADERS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_simple_compress.o
|
||||
$(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_simple_compress.o $(LIB_FUZZING_ENGINE) -o $@
|
||||
|
||||
zstd_frame_info: $(FUZZ_HEADERS) $(FUZZ_DECOMPRESS_OBJ) d_fuzz_zstd_frame_info.o
|
||||
$(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_DECOMPRESS_OBJ) d_fuzz_zstd_frame_info.o $(LIB_FUZZING_ENGINE) -o $@
|
||||
|
||||
dictionary_loader: $(FUZZ_HEADERS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_dictionary_loader.o
|
||||
$(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_dictionary_loader.o $(LIB_FUZZING_ENGINE) -o $@
|
||||
|
||||
decompress_dstSize_tooSmall: $(FUZZ_HEADERS) $(FUZZ_DECOMPRESS_OBJ) d_fuzz_decompress_dstSize_tooSmall.o
|
||||
$(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_DECOMPRESS_OBJ) d_fuzz_decompress_dstSize_tooSmall.o $(LIB_FUZZING_ENGINE) -o $@
|
||||
|
||||
fse_read_ncount: $(FUZZ_HEADERS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_fse_read_ncount.o
|
||||
$(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_fse_read_ncount.o $(LIB_FUZZING_ENGINE) -o $@
|
||||
|
||||
sequence_compression_api: $(FUZZ_HEADERS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_sequence_compression_api.o
|
||||
$(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_sequence_compression_api.o $(LIB_FUZZING_ENGINE) -o $@
|
||||
|
||||
seekable_roundtrip: $(FUZZ_HEADERS) $(SEEKABLE_HEADERS) $(FUZZ_ROUND_TRIP_OBJ) $(SEEKABLE_OBJS) rt_fuzz_seekable_roundtrip.o
|
||||
$(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_ROUND_TRIP_OBJ) $(SEEKABLE_OBJS) rt_fuzz_seekable_roundtrip.o $(LIB_FUZZING_ENGINE) -o $@
|
||||
|
||||
huf_round_trip: $(FUZZ_HEADERS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_huf_round_trip.o
|
||||
$(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_huf_round_trip.o $(LIB_FUZZING_ENGINE) -o $@
|
||||
|
||||
huf_decompress: $(FUZZ_HEADERS) $(FUZZ_DECOMPRESS_OBJ) d_fuzz_huf_decompress.o
|
||||
$(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_DECOMPRESS_OBJ) d_fuzz_huf_decompress.o $(LIB_FUZZING_ENGINE) -o $@
|
||||
|
||||
libregression.a: $(FUZZ_HEADERS) $(PRGDIR)/util.h $(PRGDIR)/util.c d_fuzz_regression_driver.o
|
||||
$(AR) $(FUZZ_ARFLAGS) $@ d_fuzz_regression_driver.o
|
||||
|
||||
corpora/%_seed_corpus.zip:
|
||||
@mkdir -p corpora
|
||||
$(DOWNLOAD) $@ $(CORPORA_URL_PREFIX)$*_seed_corpus.zip
|
||||
|
||||
corpora/%: corpora/%_seed_corpus.zip
|
||||
unzip -q $^ -d $@
|
||||
|
||||
.PHONY: corpora
|
||||
corpora: $(patsubst %,corpora/%,$(FUZZ_TARGETS))
|
||||
|
||||
.PHONY: seedcorpora
|
||||
seedcorpora: $(patsubst %,corpora/%_seed_corpus.zip,$(FUZZ_TARGETS))
|
||||
|
||||
regressiontest: corpora
|
||||
CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" $(PYTHON) ./fuzz.py build all
|
||||
$(PYTHON) ./fuzz.py regression all
|
||||
|
||||
clean:
|
||||
@$(RM) *.a *.o $(FUZZ_TARGETS)
|
||||
@echo Cleaning completed
|
||||
|
||||
cleanall:
|
||||
@$(RM) -r Fuzzer
|
||||
@$(RM) -r corpora
|
||||
@echo Cleaning completed
|
||||
0
externals/zstd/tests/fuzz/fuzz.py
vendored
Normal file → Executable file
0
externals/zstd/tests/fuzz/fuzz.py
vendored
Normal file → Executable file
16
externals/zstd/tests/fuzz/seq_prod_fuzz_example/Makefile
vendored
Normal file
16
externals/zstd/tests/fuzz/seq_prod_fuzz_example/Makefile
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# Copyright (c) Yann Collet, Meta Platforms, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
||||
# in the COPYING file in the root directory of this source tree).
|
||||
# You may select, at your option, one of the above-listed licenses.
|
||||
|
||||
CC = clang
|
||||
CFLAGS = -g -fno-omit-frame-pointer -fsanitize=undefined,address,fuzzer -I../ -I../../../lib/
|
||||
|
||||
.PHONY: default
|
||||
default: example_seq_prod.o
|
||||
|
||||
example_seq_prod.o: example_seq_prod.c
|
||||
$(CC) -c $(CFLAGS) $^ -o $@
|
||||
45
externals/zstd/tests/gzip/Makefile
vendored
Normal file
45
externals/zstd/tests/gzip/Makefile
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# ################################################################
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
||||
# in the COPYING file in the root directory of this source tree).
|
||||
# You may select, at your option, one of the above-listed licenses.
|
||||
# ################################################################
|
||||
|
||||
PRGDIR = ../../programs
|
||||
VOID = /dev/null
|
||||
export PATH := .:$(PATH)
|
||||
|
||||
.PHONY: all
|
||||
#all: test-gzip-env
|
||||
all: test-helin-segv test-hufts test-keep test-list test-memcpy-abuse test-mixed
|
||||
all: test-null-suffix-clobber test-stdin test-trailing-nul test-unpack-invalid
|
||||
all: test-zdiff test-zgrep-context test-zgrep-f test-zgrep-signal test-znew-k test-z-suffix
|
||||
@echo Testing completed
|
||||
|
||||
.PHONY: zstd
|
||||
zstd:
|
||||
$(MAKE) -C $(PRGDIR) zstd
|
||||
ln -sf $(PRGDIR)/zstd gzip
|
||||
@echo PATH=$(PATH)
|
||||
gzip --version
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@$(MAKE) -C $(PRGDIR) $@ > $(VOID)
|
||||
@$(RM) *.trs *.log
|
||||
@echo Cleaning completed
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# validated only for Linux, macOS, Hurd and some BSD targets
|
||||
#------------------------------------------------------------------------------
|
||||
ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD DragonFly NetBSD))
|
||||
|
||||
test-%: zstd
|
||||
@./test-driver.sh --test-name $* --log-file $*.log --trs-file $*.trs --expect-failure "no" --color-tests "yes" --enable-hard-errors "yes" ./$*.sh
|
||||
# || echo ignoring error
|
||||
|
||||
endif
|
||||
0
externals/zstd/tests/gzip/gzip-env.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/gzip/gzip-env.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/libzstd_builds.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/libzstd_builds.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/playTests.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/playTests.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/rateLimiter.py
vendored
Normal file → Executable file
0
externals/zstd/tests/rateLimiter.py
vendored
Normal file → Executable file
60
externals/zstd/tests/regression/Makefile
vendored
Normal file
60
externals/zstd/tests/regression/Makefile
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
# ################################################################
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
||||
# in the COPYING file in the root directory of this source tree).
|
||||
# You may select, at your option, one of the above-listed licenses.
|
||||
# ################################################################
|
||||
|
||||
CFLAGS ?= -O3
|
||||
|
||||
CURL_CFLAGS := $(shell curl-config --cflags)
|
||||
CURL_LDFLAGS := $(shell curl-config --libs) -pthread
|
||||
|
||||
PROGDIR := ../../programs
|
||||
LIBDIR := ../../lib
|
||||
ZSTD_CPPFLAGS := -I$(PROGDIR) -I$(LIBDIR) -I$(LIBDIR)/common -Wno-deprecated-declarations
|
||||
|
||||
REGRESSION_CFLAGS = $(CFLAGS) $(CURL_CFLAGS)
|
||||
REGRESSION_CPPFLAGS = $(CPPFLAGS) $(ZSTD_CPPFLAGS)
|
||||
REGRESSION_LDFLAGS = $(LDFLAGS) $(CURL_LDFLAGS)
|
||||
|
||||
all: test
|
||||
|
||||
xxhash.o: $(LIBDIR)/common/xxhash.c $(LIBDIR)/common/xxhash.h
|
||||
$(CC) $(REGRESSION_CFLAGS) $(REGRESSION_CPPFLAGS) $< -c -o $@
|
||||
|
||||
util.o: $(PROGDIR)/util.c $(PROGDIR)/util.h
|
||||
$(CC) $(REGRESSION_CFLAGS) $(REGRESSION_CPPFLAGS) $< -c -o $@
|
||||
|
||||
data.o: data.c data.h $(PROGDIR)/util.h $(LIBDIR)/common/xxhash.h
|
||||
$(CC) $(REGRESSION_CFLAGS) $(REGRESSION_CPPFLAGS) $< -c -o $@
|
||||
|
||||
config.o: config.c config.h levels.h
|
||||
$(CC) $(REGRESSION_CFLAGS) $(REGRESSION_CPPFLAGS) $< -c -o $@
|
||||
|
||||
method.h: data.h config.h result.h
|
||||
|
||||
method.o: method.c method.h
|
||||
$(CC) $(REGRESSION_CFLAGS) $(REGRESSION_CPPFLAGS) $< -c -o $@
|
||||
|
||||
result.o: result.c result.h
|
||||
$(CC) $(REGRESSION_CFLAGS) $(REGRESSION_CPPFLAGS) $< -c -o $@
|
||||
|
||||
test.o: test.c data.h config.h method.h
|
||||
$(CC) $(REGRESSION_CFLAGS) $(REGRESSION_CPPFLAGS) $< -c -o $@
|
||||
|
||||
.PHONY: libzstd.a
|
||||
libzstd.a:
|
||||
$(MAKE) -C $(LIBDIR) libzstd.a-mt
|
||||
cp $(LIBDIR)/libzstd.a .
|
||||
|
||||
test: test.o data.o config.o util.o method.o result.o xxhash.o libzstd.a
|
||||
$(CC) $^ $(REGRESSION_LDFLAGS) -o $@
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
$(MAKE) -C $(LIBDIR) clean
|
||||
$(RM) *.o *.a test
|
||||
0
externals/zstd/tests/test-license.py
vendored
Normal file → Executable file
0
externals/zstd/tests/test-license.py
vendored
Normal file → Executable file
0
externals/zstd/tests/test-variants.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/test-variants.sh
vendored
Normal file → Executable file
0
externals/zstd/tests/test-zstd-versions.py
vendored
Normal file → Executable file
0
externals/zstd/tests/test-zstd-versions.py
vendored
Normal file → Executable file
Reference in New Issue
Block a user