scc

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

chktest.sh (436B)


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