clb.mk and fuzzer.mk: rerun the fuzzer in case of failure

Signed-off-by: Alessandro Comodi <acomodi@antmicro.com>
This commit is contained in:
Alessandro Comodi 2019-01-17 15:35:29 +01:00
parent 8b66865106
commit 13e5fbdf99
2 changed files with 20 additions and 2 deletions

View File

@ -4,6 +4,14 @@ CLB_DBFIXUP ?=
# ie set to N if only for SLICEM
SLICEL ?= Y
# This set of variables are used to store the increment
# in the number of CLBs in case they are not enough and
# the generated database is inconsistent
CLBN ?= 0
INC ?= 50
VAR ?= "CLBN=$$(($(CLBN) + $(INC)))"
ENV_VAR ?= "CLBN=$(CLBN)"
include ../fuzzer.mk
database: build/segbits_clbx.db

View File

@ -1,17 +1,27 @@
N ?= 1
SPECIMENS := $(addprefix build/specimen_,$(shell seq -f '%03.0f' $(N)))
SPECIMENS_OK := $(addsuffix /OK,$(SPECIMENS))
ENV_VAR ?=
VAR ?=
ITER ?= 0
MAX_ITER ?= 10
all: database
$(SPECIMENS_OK):
mkdir -p build
bash ${XRAY_DIR}/utils/top_generate.sh $(subst /OK,,$@)
if [ -f `pwd`/generate.sh ]; then export $(ENV_VAR); bash `pwd`/generate.sh $(subst /OK,,$@); else bash ${XRAY_DIR}/utils/top_generate.sh $(subst /OK,,$@); fi
run:
# If the database presents errors or is incomplete, the fuzzer is rerun.
# When it reaches the maximum number of iterations it fails.
@if [ $(ITER) -gt $(MAX_ITER) ]; then \
echo "Max Iterations reached. Fuzzer unsolvable."; \
exit 1; \
fi
$(MAKE) clean
$(MAKE) database
$(MAKE) pushdb
$(MAKE) pushdb || $(MAKE) $(VAR) ITER=$$(($(ITER) + 1)) run
touch run.ok
clean: