add plotting to snakefile
This commit is contained in:
parent
28bac2a850
commit
2acf3ef301
@ -1,6 +1,12 @@
|
|||||||
import csv
|
import csv
|
||||||
def_flags="--no-default-features --features std,snapshot_restore,singlecore"
|
def_flags="--no-default-features --features std,snapshot_restore,singlecore"
|
||||||
|
|
||||||
|
rule build_showmap:
|
||||||
|
output:
|
||||||
|
directory("bins/target_showmap")
|
||||||
|
shell:
|
||||||
|
"cargo build --target-dir {output} {def_flags},systemstate"
|
||||||
|
|
||||||
rule build_random:
|
rule build_random:
|
||||||
output:
|
output:
|
||||||
directory("bins/target_random")
|
directory("bins/target_random")
|
||||||
@ -74,6 +80,58 @@ rule run_bench:
|
|||||||
script="export FUZZ_RANDOM=1\n"+script
|
script="export FUZZ_RANDOM=1\n"+script
|
||||||
shell(script)
|
shell(script)
|
||||||
|
|
||||||
|
rule run_showmap:
|
||||||
|
input:
|
||||||
|
"build/{target}.elf",
|
||||||
|
"bins/target_showmap",
|
||||||
|
"timedump/{fuzzer}/{target}.{num}.case"
|
||||||
|
output:
|
||||||
|
"timedump/{fuzzer}/{target}.{num}.trace.ron"
|
||||||
|
run:
|
||||||
|
with open('target_symbols.csv') as csvfile:
|
||||||
|
reader = csv.DictReader(csvfile)
|
||||||
|
line = next((x for x in reader if x['kernel']==wildcards.target), None)
|
||||||
|
if line == None:
|
||||||
|
return False
|
||||||
|
kernel=line['kernel']
|
||||||
|
fuzz_main=line['main_function']
|
||||||
|
fuzz_input=line['input_symbol']
|
||||||
|
fuzz_len=line['input_size']
|
||||||
|
bkp=line['return_function']
|
||||||
|
script="""
|
||||||
|
mkdir -p $(dirname {output})
|
||||||
|
export KERNEL=$(pwd)/{input[0]}
|
||||||
|
export FUZZ_MAIN={fuzz_main}
|
||||||
|
export FUZZ_INPUT={fuzz_input}
|
||||||
|
export FUZZ_INPUT_LEN={fuzz_len}
|
||||||
|
export BREAKPOINT={bkp}
|
||||||
|
export TRACE_DUMP=$(pwd)/{output}
|
||||||
|
export FUZZER=$(pwd)/{input[1]}/debug/fret
|
||||||
|
export DO_SHOWMAP=$(pwd)/{input[2]}
|
||||||
|
set +e
|
||||||
|
../fuzzer.sh
|
||||||
|
exit 0
|
||||||
|
"""
|
||||||
|
if wildcards.fuzzer == 'random':
|
||||||
|
script="export FUZZ_RANDOM=1\n"+script
|
||||||
|
shell(script)
|
||||||
|
|
||||||
|
rule tarnsform_trace:
|
||||||
|
input:
|
||||||
|
"timedump/{fuzzer}/{target}.{num}.trace.ron"
|
||||||
|
output:
|
||||||
|
"timedump/{fuzzer}/{target}.{num}.trace.csv"
|
||||||
|
shell:
|
||||||
|
"$(pwd)/../../../../state2gantt/target/debug/state2gantt {input} > {output[0]}"
|
||||||
|
|
||||||
|
rule trace2gantt:
|
||||||
|
input:
|
||||||
|
"timedump/{fuzzer}/{target}.{num}.trace.csv"
|
||||||
|
output:
|
||||||
|
"timedump/{fuzzer}/{target}.{num}.trace.csv.png"
|
||||||
|
shell:
|
||||||
|
"Rscript --vanilla $(pwd)/../../../../state2gantt/gantt.R {input}"
|
||||||
|
|
||||||
rule all_bins:
|
rule all_bins:
|
||||||
input:
|
input:
|
||||||
"bins/target_random",
|
"bins/target_random",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user