scc

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

chktest.sh (444B)


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