scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

chktest.sh (452B)


      1 #!/bin/sh
      2 
      3 file=${1?' empty input file'}
      4 tmp1=`mktemp`
      5 tmp2=`mktemp`
      6 trap "rm -f *.o  $tmp1 $tmp2" EXIT INT QUIT TERM
      7 ulimit -c 0
      8 rm -f test.log
      9 
     10 while read i state
     11 do
     12 	state=${state:-"\t"}
     13 	rm -f *.o $tmp1 $tmp2
     14 
     15 	(echo $i
     16 	 ./cc.sh $CFLAGS -o $i $i.c
     17 	 echo '/^output:$/+;/^end:$/-'w $tmp1 | ed -s $i.c
     18 	 ./$i > $tmp2 2>> test.log
     19 	 diff -u $tmp1 $tmp2) >> test.log 2>&1 &&
     20 
     21 	printf '[PASS]' || printf '[FAIL]'
     22 	printf "$state\t%s\n" $i
     23 done < $file