scc

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

chktest.sh (433B)


      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 	rm -f *.o $i $tmp1 $tmp2
     13 
     14 	(echo $i
     15 	 $CC $CFLAGS -o $i $i.c
     16 	 echo '/^output:$/+;/^end:$/-'w $tmp1 | ed -s $i.c
     17 	 ./$i > $tmp2 2>&1
     18 	 diff -u $tmp1 $tmp2) >> test.log 2>&1 &&
     19 
     20 	printf '[PASS]' || printf '[FAIL]'
     21         printf '\t%s\t%s\n' $i $state
     22 done < $file