qbe

Internal scc patchset buffer for QBE
Log | Files | Refs | README | LICENSE

cra.sh (503B)


      1 #!/bin/sh
      2 
      3 DIR=`cd $(dirname "$0"); pwd`
      4 QBE=$DIR/../qbe
      5 BUGF=/tmp/bug.id
      6 FIND=$1
      7 FIND=${FIND:-afl-find}
      8 
      9 if ! test -f $BUGF
     10 then
     11 	echo 1 > $BUGF
     12 fi
     13 
     14 while true
     15 do
     16 	ID=`cat $BUGF`
     17 
     18 	if test `ls $FIND/crashes/id* | wc -l` -lt $ID
     19 	then
     20 		rm -f bug.ssa
     21 		echo "All done!"
     22 		exit 0
     23 	fi
     24 
     25 	BUG=`ls $FIND/crashes/id* | sed -ne "${ID}{p;q}"`
     26 
     27 	echo "*** Crash $ID"
     28 	cp $BUG bug.ssa
     29 
     30 	$QBE bug.ssa > /dev/null
     31 	RET=$?
     32 	if test \( $RET -ne 0 \) -a \( $RET -ne 1 \)
     33 	then
     34 		exit 1
     35 	fi
     36 
     37 	expr $ID + 1 > $BUGF
     38 done