[fuzz] Add regressiontest targets
This commit is contained in:
parent
bfad5568b5
commit
6bb781e0f1
10
Makefile
10
Makefile
@ -12,6 +12,7 @@ ZSTDDIR = lib
|
|||||||
BUILDIR = build
|
BUILDIR = build
|
||||||
ZWRAPDIR = zlibWrapper
|
ZWRAPDIR = zlibWrapper
|
||||||
TESTDIR = tests
|
TESTDIR = tests
|
||||||
|
FUZZDIR = $(TESTDIR)/fuzz
|
||||||
|
|
||||||
# Define nul output
|
# Define nul output
|
||||||
VOID = /dev/null
|
VOID = /dev/null
|
||||||
@ -215,6 +216,15 @@ arm-ppc-compilation:
|
|||||||
$(MAKE) -C $(PRGDIR) clean zstd CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static"
|
$(MAKE) -C $(PRGDIR) clean zstd CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static"
|
||||||
$(MAKE) -C $(PRGDIR) clean zstd CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static ZSTDRTTEST= MOREFLAGS="-m64 -static"
|
$(MAKE) -C $(PRGDIR) clean zstd CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static ZSTDRTTEST= MOREFLAGS="-m64 -static"
|
||||||
|
|
||||||
|
regressiontest:
|
||||||
|
$(MAKE) -C $(FUZZDIR) regressiontest
|
||||||
|
|
||||||
|
uasanregressiontest:
|
||||||
|
$(MAKE) -C $(FUZZDIR) regressiontest CC=clang CXX=clang++ CFLAGS="-O3 -fsanitize=address,undefined" CXXFLAGS="-O3 -fsanitize=address,undefined"
|
||||||
|
|
||||||
|
msanregressiontest:
|
||||||
|
$(MAKE) -C $(FUZZDIR) regressiontest CC=clang CXX=clang++ CFLAGS="-O3 -fsanitize=memory" CXXFLAGS="-O3 -fsanitize=memory"
|
||||||
|
|
||||||
# run UBsan with -fsanitize-recover=signed-integer-overflow
|
# run UBsan with -fsanitize-recover=signed-integer-overflow
|
||||||
# due to a bug in UBsan when doing pointer subtraction
|
# due to a bug in UBsan when doing pointer subtraction
|
||||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63303
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63303
|
||||||
|
@ -14,6 +14,13 @@ CPPFLAGS ?=
|
|||||||
LDFLAGS ?=
|
LDFLAGS ?=
|
||||||
ARFLAGS ?=
|
ARFLAGS ?=
|
||||||
LIB_FUZZING_ENGINE ?= libregression.a
|
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/
|
||||||
|
|
||||||
ZSTDDIR = ../../lib
|
ZSTDDIR = ../../lib
|
||||||
PRGDIR = ../../programs
|
PRGDIR = ../../programs
|
||||||
@ -48,18 +55,20 @@ FUZZ_SRC := \
|
|||||||
FUZZ_OBJ := $(patsubst %.c,%.o, $(wildcard $(FUZZ_SRC)))
|
FUZZ_OBJ := $(patsubst %.c,%.o, $(wildcard $(FUZZ_SRC)))
|
||||||
|
|
||||||
|
|
||||||
.PHONY: default all clean
|
.PHONY: default all clean cleanall
|
||||||
|
|
||||||
default: all
|
default: all
|
||||||
|
|
||||||
all: \
|
FUZZ_TARGETS := \
|
||||||
simple_round_trip \
|
simple_round_trip \
|
||||||
stream_round_trip \
|
stream_round_trip \
|
||||||
block_round_trip \
|
block_round_trip \
|
||||||
simple_decompress \
|
simple_decompress \
|
||||||
stream_decompress \
|
stream_decompress \
|
||||||
block_decompress
|
block_decompress
|
||||||
|
|
||||||
|
all: $(FUZZ_TARGETS)
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $^ -c -o $@
|
$(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $^ -c -o $@
|
||||||
|
|
||||||
@ -93,7 +102,25 @@ libFuzzer:
|
|||||||
@git clone https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer
|
@git clone https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer
|
||||||
@cd Fuzzer && ./build.sh
|
@cd Fuzzer && ./build.sh
|
||||||
|
|
||||||
|
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))
|
||||||
|
|
||||||
|
regressiontest: corpora
|
||||||
|
CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" $(PYTHON) ./fuzz.py build all
|
||||||
|
$(PYTHON) ./fuzz.py regression all
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@$(MAKE) -C $(ZSTDDIR) clean
|
@$(MAKE) -C $(ZSTDDIR) clean
|
||||||
@$(RM) -f *.a *.o
|
@$(RM) -f *.a *.o
|
||||||
@$(RM) -f simple_round_trip stream_round_trip simple_decompress stream_decompress
|
@$(RM) -f simple_round_trip stream_round_trip simple_decompress stream_decompress
|
||||||
|
|
||||||
|
cleanall:
|
||||||
|
@$(RM) -rf Fuzzer
|
||||||
|
@$(RM) -rf corpora
|
||||||
|
Loading…
Reference in New Issue
Block a user