scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit b8a5015e5759505472294abea476ffffa4c387e7
parent d691713e7dd054277bf83dc26b0b1d2a92fd5409
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 14 Aug 2015 11:35:38 +0200

Improve test script in cc1

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

Diffstat:
Mcc1/tests/chktest.sh | 40+++++++++++++++++++++++-----------------
1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/cc1/tests/chktest.sh b/cc1/tests/chktest.sh @@ -1,25 +1,31 @@ #!/bin/sh -out=/tmp/out -chk=/tmp/chk +out=/tmp/$$.out +chk=/tmp/$$.chk -#trap "rm -f $out $chk" EXIT INT QUIT +trap "rm -f $out $chk" EXIT INT QUIT HUP 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 + 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