simplify 8*x as well as x*8
[qbe.git] / tools / cra.sh
blob5988267818c49b4fb625075ed2997d4aef6bcd55
1 #!/bin/sh
3 DIR=`cd $(dirname "$0"); pwd`
4 QBE=$DIR/../qbe
5 BUGF=/tmp/bug.id
6 FIND=$1
7 FIND=${FIND:-afl-find}
9 if ! test -f $BUGF
10 then
11 echo 1 > $BUGF
14 while true
16 ID=`cat $BUGF`
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
25 BUG=`ls $FIND/crashes/id* | sed -ne "${ID}{p;q}"`
27 echo "*** Crash $ID"
28 cp $BUG bug.ssa
30 $QBE bug.ssa > /dev/null
31 RET=$?
32 if test \( $RET -ne 0 \) -a \( $RET -ne 1 \)
33 then
34 exit 1
37 expr $ID + 1 > $BUGF
38 done