[#229] Add ngfuzz installation to makefile #229
1 changed files with 16 additions and 11 deletions
27
Makefile
27
Makefile
|
@ -30,9 +30,10 @@ PKG_VERSION ?= $(shell echo $(VERSION) | sed "s/^v//" | \
|
|||
sed "s/-/~/")-${OS_RELEASE}
|
||||
.PHONY: debpackage debclean
|
||||
|
||||
FUZZ_NGFUZZ_DIR ?= ""
|
||||
FUZZING_DIR = $(shell pwd)/tests/fuzzing/files
|
||||
NGFUZZ_REPO = https://gitflic.ru/project/yadro/ngfuzz.git
|
||||
FUZZ_TIMEOUT ?= 30
|
||||
FUZZ_FUNCTIONS ?= "all"
|
||||
FUZZ_FUNCTIONS ?= ""
|
||||
FUZZ_AUX ?= ""
|
||||
|
||||
# Make all binaries
|
||||
|
@ -99,18 +100,22 @@ check-ngfuzz:
|
|||
exit 1; \
|
||||
fi
|
||||
|
||||
.PHONY: install-fuzzing-deps
|
||||
install-fuzzing-deps: check-clang check-ngfuzz
|
||||
.PHONY: install-ngfuzz
|
||||
install-ngfuzz:
|
||||
ifeq (,$(wildcard $(FUZZING_DIR)/ngfuzz))
|
||||
@rm -rf $(FUZZING_DIR)/ngfuzz
|
||||
@git clone $(NGFUZZ_REPO) $(FUZZING_DIR)/ngfuzz
|
||||
@cd $(FUZZING_DIR)/ngfuzz && make
|
||||
endif
|
||||
|
||||
.PHONY: fuzz
|
||||
fuzz: install-fuzzing-deps
|
||||
fuzz: check-clang install-ngfuzz
|
||||
@START_PATH=$$(pwd); \
|
||||
ROOT_PATH=$$(realpath --relative-to=$(FUZZ_NGFUZZ_DIR) $$START_PATH) ; \
|
||||
cd $(FUZZ_NGFUZZ_DIR) && \
|
||||
./ngfuzz -clean && \
|
||||
./ngfuzz -fuzz $(FUZZ_FUNCTIONS) -rootdir $$ROOT_PATH -timeout $(FUZZ_TIMEOUT) $(FUZZ_AUX) && \
|
||||
./ngfuzz -report
|
||||
|
||||
ROOT_PATH=$$(realpath --relative-to=$(FUZZING_DIR)/ngfuzz $$START_PATH) ; \
|
||||
cd $(FUZZING_DIR)/ngfuzz && \
|
||||
./bin/ngfuzz clean && \
|
||||
env CGO_ENABLED=1 ./bin/ngfuzz fuzz --funcs $(FUZZ_FUNCTIONS) --rootdir $$ROOT_PATH --timeout $(FUZZ_TIMEOUT) $(FUZZ_AUX) && \
|
||||
./bin/ngfuzz coverage --rootdir $$ROOT_PATH
|
||||
|
||||
# Reformat code
|
||||
fmt:
|
||||
|
|
Loading…
Add table
Reference in a new issue