[#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}
|
sed "s/-/~/")-${OS_RELEASE}
|
||||||
.PHONY: debpackage debclean
|
.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_TIMEOUT ?= 30
|
||||||
FUZZ_FUNCTIONS ?= "all"
|
FUZZ_FUNCTIONS ?= ""
|
||||||
FUZZ_AUX ?= ""
|
FUZZ_AUX ?= ""
|
||||||
|
|
||||||
# Make all binaries
|
# Make all binaries
|
||||||
|
@ -99,18 +100,22 @@ check-ngfuzz:
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
.PHONY: install-fuzzing-deps
|
.PHONY: install-ngfuzz
|
||||||
install-fuzzing-deps: check-clang check-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
|
.PHONY: fuzz
|
||||||
fuzz: install-fuzzing-deps
|
fuzz: check-clang install-ngfuzz
|
||||||
@START_PATH=$$(pwd); \
|
@START_PATH=$$(pwd); \
|
||||||
ROOT_PATH=$$(realpath --relative-to=$(FUZZ_NGFUZZ_DIR) $$START_PATH) ; \
|
ROOT_PATH=$$(realpath --relative-to=$(FUZZING_DIR)/ngfuzz $$START_PATH) ; \
|
||||||
cd $(FUZZ_NGFUZZ_DIR) && \
|
cd $(FUZZING_DIR)/ngfuzz && \
|
||||||
./ngfuzz -clean && \
|
./bin/ngfuzz clean && \
|
||||||
./ngfuzz -fuzz $(FUZZ_FUNCTIONS) -rootdir $$ROOT_PATH -timeout $(FUZZ_TIMEOUT) $(FUZZ_AUX) && \
|
env CGO_ENABLED=1 ./bin/ngfuzz fuzz --funcs $(FUZZ_FUNCTIONS) --rootdir $$ROOT_PATH --timeout $(FUZZ_TIMEOUT) $(FUZZ_AUX) && \
|
||||||
./ngfuzz -report
|
./bin/ngfuzz coverage --rootdir $$ROOT_PATH
|
||||||
|
|
||||||
|
|
||||||
# Reformat code
|
# Reformat code
|
||||||
fmt:
|
fmt:
|
||||||
|
|
Loading…
Add table
Reference in a new issue