From ebf8d6a1cdf52cb094df6b2b3937433d8bd32e38 Mon Sep 17 00:00:00 2001 From: Tomasz Michalak Date: Thu, 23 May 2019 15:06:25 +0200 Subject: [PATCH] 053-pip-ctrlin: Fall back to todos bigger than specified number of lines Signed-off-by: Tomasz Michalak --- fuzzers/053-pip-ctrlin/generate.tcl | 31 ++++++++++++++++++++++++++++- fuzzers/pip_loop.mk | 1 + 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/fuzzers/053-pip-ctrlin/generate.tcl b/fuzzers/053-pip-ctrlin/generate.tcl index ac1a0b4e..8436938f 100644 --- a/fuzzers/053-pip-ctrlin/generate.tcl +++ b/fuzzers/053-pip-ctrlin/generate.tcl @@ -21,8 +21,37 @@ route_design # write_checkpoint -force design.dcp +# This function checks the input todo file to ensure there is enough stimulus. +# By default if the input todo file is bigger than the specified number of lines then +# it is used in the subsequent stages of the script. +# However, when the input todo is smaller then a todo file from a previous iteration, +# which meets the minimum lines requirement, gets chosen. +# This helps with increasing the stimuli without increasing the +# global number of specimen used in every iteration. +proc get_todo {{min_lines 0}} { + if {[info exists ::env(ITER)]} { + set current_iter $::env(ITER) + } else { + set current_iter 1 + } + set todo_file "../../todo/${current_iter}_all.txt" + lassign [exec wc -l $todo_file] line_count file_name + if {$min_lines == 0} { + return $file_name + } + if {$current_iter == 1 && $line_count < $min_lines} { + error "ERROR: Initial TODO is too small" + } + while {$line_count < $min_lines} { + incr current_iter -1 + set todo_file "../../todo/${current_iter}_all.txt" + lassign [exec wc -l $todo_file] line_count file_name + } + return $file_name +} -set fp [open "../../todo.txt" r] + +set fp [open [get_todo 10] r] set todo_lines {} for {gets $fp line} {$line != ""} {gets $fp line} { lappend todo_lines [split $line .] diff --git a/fuzzers/pip_loop.mk b/fuzzers/pip_loop.mk index bc4ca248..43b6e1c1 100644 --- a/fuzzers/pip_loop.mk +++ b/fuzzers/pip_loop.mk @@ -22,6 +22,7 @@ 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