forked from f4pga/prjxray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpip_loop.mk
75 lines (65 loc) · 2.17 KB
/
pip_loop.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
TODO_N ?= 50
# Number of spcimens
ifeq ($(QUICK),Y)
N = 1
TODO_N = 3
SEGMATCH_FLAGS?=
else
# Should be at least the -m value
N ?= 20
SEGMATCH_FLAGS?=-m 15 -M 45
endif
# Iteration number (each containing N specimens)
# Driven by int_loop.sh
ITER ?= 1
MAKETODO_FLAGS ?=--pip-type pips_int --seg-type int
SPECIMENS_DEPS ?=
# See int_loop_check.py
# rempips took 35 iters once, so set 50 as a good start point
CHECK_ARGS ?= --zero-entries --timeout-iters 50
SPECIMENS := $(addprefix build/$(ITER)/specimen_,$(shell seq -f '%03.0f' $(N)))
SPECIMENS_OK := $(addsuffix /OK,$(SPECIMENS))
# Individual fuzzer directory, such as ~/prjxray/fuzzers/010-lutinit
export FUZDIR=$(shell pwd)
export ITER
all: database
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(SELF_DIR)/pip_list.mk
$(SPECIMENS_OK): build/todo.txt $(SPECIMENS_DEPS)
mkdir -p build/$(ITER)
+if [ -f ${FUZDIR}/generate.sh ] ; then \
bash ${FUZDIR}/generate.sh $(subst /OK,,$@) ; \
else \
bash ${XRAY_DIR}/utils/top_generate.sh $(subst /OK,,$@) ; \
fi
touch $@
# Used 1) to see if we are done 2) pips to try in generate.tcl
build/todo.txt: piplist $(XRAY_DIR)/fuzzers/int_maketodo.py build/database/seeded
XRAY_DATABASE_DIR=${FUZDIR}/build/database \
python3 $(XRAY_DIR)/fuzzers/int_maketodo.py \
$(MAKETODO_FLAGS) |sort >build/todo_all.txt
cat build/todo_all.txt | sort -R | head -n$(TODO_N) > build/todo.txt.tmp
mv build/todo.txt.tmp build/todo.txt
# Per iter files
mkdir -p build/$(ITER)
cp build/todo_all.txt build/todo.txt build/$(ITER)/
# All in one dir for easier trending
mkdir -p build/todo
cp build/todo_all.txt build/todo/$(ITER)_all.txt
# Initial copy for first todo.txt
# Subsequent are based on updated db
build/database/seeded:
mkdir -p build/database/${XRAY_DATABASE}
cp ${XRAY_DATABASE_DIR}/${XRAY_DATABASE}/segbits*.db build/database/${XRAY_DATABASE}
touch build/database/seeded
# FIXME: consider moving to script
run:
$(MAKE) clean
+$(XRAY_DIR)/fuzzers/int_loop.sh --check-args "$(CHECK_ARGS)"
touch run.ok
clean:
rm -rf build run.ok todo
# Remove iteration specific files, but keep piplist.tcl output
cleaniter:
rm -rf build/$(ITER) build/todo.txt
.PHONY: all database pushdb run clean cleaniter