ref: b8a5015e5759505472294abea476ffffa4c387e7
parent: d691713e7dd054277bf83dc26b0b1d2a92fd5409
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Aug 14 07:35:38 EDT 2015
Improve test script in cc1 This version has less escape hell problems and it enables warnings in cc1.
--- 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
--
⑨