add Makefile for benchmarks

This commit is contained in:
Alwin Berger 2022-05-04 22:56:40 +02:00
parent 70dec21c8c
commit 5d28754e1b

View File

@ -0,0 +1,50 @@
BENCHDIR = target/bench
TARGET = tmr.axf
EXAMPLE = "\xff\05\x84\x84\x84\x84\x84\x84\x84\x84"
TARGET_TRACE = tmp/target_trace.ron
TARGET_EDGES = tmp/target_edges.ron
$(BENCHDIR)/bin:
mkdir -p $@
$(BENCHDIR)/bin/fuzz_vanilla: $(BENCHDIR)/bin
cargo build --features feed_afl,sched_queue
cp target/debug/fuzzer $@
$(BENCHDIR)/bin/fuzz_state: $(BENCHDIR)/bin
cargo build --features feed_state,sched_state
cp target/debug/fuzzer $@
$(BENCHDIR)/bin/fuzz_graph: $(BENCHDIR)/bin
cargo build --features feed_graph,sched_graph
cp target/debug/fuzzer $@
$(BENCHDIR)/bin/fuzz_graph_snip: $(BENCHDIR)/bin
cargo build --features feed_graph,sched_graph,muta_snip
cp target/debug/fuzzer $@
$(BENCHDIR)/bin/fuzz_graph_afl: $(BENCHDIR)/bin
cargo build --features feed_graph,sched_graph,feed_afl
cp target/debug/fuzzer $@
$(BENCHDIR)/bin/fuzz_graph_all: $(BENCHDIR)/bin
cargo build --features feed_graph,sched_graph,feed_afl,muta_snip
cp target/debug/fuzzer $@
binaries: $(BENCHDIR)/bin/fuzz_vanilla $(BENCHDIR)/bin/fuzz_state $(BENCHDIR)/bin/fuzz_graph $(BENCHDIR)/bin/fuzz_graph_snip $(BENCHDIR)/bin/fuzz_graph_afl $(BENCHDIR)/bin/fuzz_graph_all
# variants: vanilla, state, graph, graph_snip, graph_afl, graph_all
$(BENCHDIR)/bench_%.log: $(BENCHDIR)/bin/fuzz_% $(TARGET_TRACE)
for i in {1..5}; do ./fuzzer_bench.sh $< $(TARGET) --libafl-traces $(TARGET_TRACE) > $@_$$i; done
for i in $@_*; do tail -n 1 $$i >> $@; done
benchmarks: target/bench/bench_vanilla.log target/bench/bench_state.log target/bench/bench_graph.log target/bench/bench_graph_snip.log target/bench/bench_graph_afl.log target/bench/bench_graph_all.log
all: binaries
clean_bench:
rm -rf $(BENCHDIR)/bench_*
clean:
rm -rf target/bench