#!/bin/sh

out=/tmp/out
chk=/tmp/chk

#trap "rm -f $out $chk" EXIT INT QUIT

for i in *.c
do
	rm -f $out $chk
	awk '
	/^name:/                  {printf "Running %s ", $2}
	/^output:$/               {copyon=1}
	/^\*/                     {copyon=0}
	copyon==1 && !/^output:$/ {print $0 >> "'$chk'"}
	' $i

	../cc1 $i > $out 2>&1
  	if cmp $out $chk >/dev/null 2>&1
  	then
   		echo [OK]
  	else
  		echo [FAILED]
 	fi
done

#!/bin/sh

out=/tmp/$$.out
chk=/tmp/$$.chk

trap "rm -f $out $chk" EXIT INT QUIT HUP

for i in *.c
do
	awk '
	BEGIN {
		out="'$out'";chk="'$chk'"
		system("rm -f " out " " chk)
	}
	/^name:/ {
		printf "Running %s ", $2
	}
	/^output:$/ {
		copyon=1
	}
	/^\*/  {
		copyon=0
	}
	copyon==1 && !/^output:$/  {
		print $0 >> chk
	}
	END {
		system("../cc1 -w '$i' > " out " 2>&1")
		print system("cmp -s " out " " chk) ? "[FAILED]" : "[OK]"
	}' $i
done

Improve test script in cc1
Improve test script in cc1

This version has less escape hell problems and it enables warnings
in cc1.
