scc

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

runtests.sh (541B)


      1 #!/bin/sh
      2 
      3 file=${1?' empty input file'}
      4 
      5 trap 'rm -f *.o  $tmp1 $tmp2' EXIT
      6 trap 'exit $?' 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 	 ${MAKE-make} -s $i
     19 	 echo '/^output:$/+;/^end:$/-'w $tmp1 | ed -s $i.c
     20 
     21 	 timeout 30 $EXEC ./$i >$tmp2 2>&1
     22 
     23 	 if grep '^RESULT: SKIP$' $tmp2
     24 	 then
     25 		printf '\tSKIP\t%s\n' $i $state
     26 		continue
     27 	 fi
     28 	 diff -u $tmp1 $tmp2) >> test.log 2>&1 &&
     29 
     30 	printf '[PASS]' || printf '[FAIL]'
     31         printf '\t%s\t%s\n' $i $state
     32 done < $file