2018-12-12 04:22:16 +01:00
|
|
|
# Number of spcimens
|
|
|
|
|
ifeq ($(QUICK),Y)
|
|
|
|
|
N ?= 1
|
|
|
|
|
SEGMATCH_FLAGS=
|
|
|
|
|
else
|
|
|
|
|
# Should be at least the -m value
|
|
|
|
|
N ?= 20
|
|
|
|
|
SEGMATCH_FLAGS=-m 10 -M 20
|
|
|
|
|
endif
|
|
|
|
|
# Iteration number (each containing N specimens)
|
|
|
|
|
# Driven by int_loop.sh
|
|
|
|
|
ITER ?= 1
|
2018-12-12 20:57:17 +01:00
|
|
|
MAKETODO_FLAGS ?=
|
2018-12-12 06:13:10 +01:00
|
|
|
TODO_N ?= 10
|
|
|
|
|
PIP_TYPE?=pips_int
|
|
|
|
|
PIPLIST_TCL?=$(XRAY_DIR)/fuzzers/piplist.tcl
|
2018-12-12 04:22:16 +01:00
|
|
|
|
2018-12-11 23:44:01 +01:00
|
|
|
# See int_loop_check.py
|
2018-12-11 23:47:49 +01:00
|
|
|
# rempips took 35 iters once, so set 50 as a good start point
|
|
|
|
|
CHECK_ARGS := --zero-entries --timeout-iters 50
|
2018-12-12 04:22:16 +01:00
|
|
|
SPECIMENS := $(addprefix build/$(ITER)/specimen_,$(shell seq -f '%03.0f' $(N)))
|
2018-12-06 01:05:17 +01:00
|
|
|
SPECIMENS_OK := $(addsuffix /OK,$(SPECIMENS))
|
|
|
|
|
# Individual fuzzer directory, such as ~/prjxray/fuzzers/010-lutinit
|
|
|
|
|
export FUZDIR=$(shell pwd)
|
|
|
|
|
|
2018-12-12 04:22:16 +01:00
|
|
|
# Specimens from current run must complete, but previous iterations may exist
|
2018-12-06 01:05:17 +01:00
|
|
|
database: $(SPECIMENS_OK)
|
2018-12-12 04:22:16 +01:00
|
|
|
${XRAY_SEGMATCH} $(SEGMATCH_FLAGS) -o build/segbits_int_l.db $(shell find build -name segdata_int_l.txt)
|
|
|
|
|
${XRAY_SEGMATCH} $(SEGMATCH_FLAGS) -o build/segbits_int_r.db $(shell find build -name segdata_int_r.txt)
|
|
|
|
|
# May be undersolved
|
|
|
|
|
ifneq ($(QUICK),Y)
|
|
|
|
|
${XRAY_DBFIXUP} --db-root build --clb-int
|
|
|
|
|
endif
|
2018-12-12 20:51:55 +01:00
|
|
|
# Keep a copy to track iter progress
|
|
|
|
|
cp build/segbits_int_l.db build/$(ITER)/segbits_int_l.db
|
|
|
|
|
cp build/segbits_int_r.db build/$(ITER)/segbits_int_r.db
|
2018-12-06 01:05:17 +01:00
|
|
|
|
|
|
|
|
pushdb:
|
|
|
|
|
${XRAY_MERGEDB} int_l build/segbits_int_l.db
|
|
|
|
|
${XRAY_MERGEDB} int_r build/segbits_int_r.db
|
|
|
|
|
|
|
|
|
|
$(SPECIMENS_OK): build/todo.txt
|
2018-12-12 04:22:16 +01:00
|
|
|
mkdir -p build/$(ITER)
|
2018-12-06 01:05:17 +01:00
|
|
|
bash ${XRAY_DIR}/utils/top_generate.sh $(subst /OK,,$@)
|
|
|
|
|
touch $@
|
|
|
|
|
|
2018-12-12 06:13:10 +01:00
|
|
|
build/$(PIP_TYPE)_l.txt: $(XRAY_DIR)/fuzzers/piplist.tcl
|
2018-12-12 04:22:16 +01:00
|
|
|
mkdir -p build/$(ITER)
|
2018-12-12 06:13:10 +01:00
|
|
|
cd build && vivado -mode batch -source $(PIPLIST_TCL)
|
2018-12-06 01:05:17 +01:00
|
|
|
|
|
|
|
|
# Used 1) to see if we are done 2) pips to try in generate.tcl
|
2018-12-12 06:13:10 +01:00
|
|
|
build/todo.txt: build/$(PIP_TYPE)_l.txt $(XRAY_DIR)/fuzzers/int_maketodo.py
|
|
|
|
|
python3 $(XRAY_DIR)/fuzzers/int_maketodo.py --pip-type $(PIP_TYPE) $(MAKETODO_FLAGS) >build/todo_all.txt
|
|
|
|
|
cat build/todo_all.txt | sort -R | head -n$(TODO_N) > build/todo.txt.tmp
|
2018-12-06 01:05:17 +01:00
|
|
|
mv build/todo.txt.tmp build/todo.txt
|
|
|
|
|
|
|
|
|
|
# XXX: conider moving to script
|
|
|
|
|
run:
|
2018-12-11 21:24:46 +01:00
|
|
|
$(MAKE) clean
|
2018-12-12 06:36:42 +01:00
|
|
|
XRAY_DIR=${XRAY_DIR} MAKE="$(MAKE)" QUICK=$(QUICK) $(XRAY_DIR)/fuzzers/int_loop.sh --check-args "$(CHECK_ARGS)" --iter-pushdb
|
2018-12-06 01:05:17 +01:00
|
|
|
touch run.ok
|
|
|
|
|
|
|
|
|
|
clean:
|
|
|
|
|
rm -rf build run.ok todo
|
|
|
|
|
|
|
|
|
|
# Remove iteration specific files, but keep piplist.tcl output
|
|
|
|
|
cleanprj:
|
2018-12-12 04:22:16 +01:00
|
|
|
rm -rf build/$(ITER) build/todo.txt
|
2018-12-06 01:05:17 +01:00
|
|
|
|
|
|
|
|
.PHONY: database pushdb run clean cleanprj
|
|
|
|
|
|