[hackers] [scc] Improve test script in cc1 || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Fri, 14 Aug 2015 17:08:59 +0200 (CEST)

commit b8a5015e5759505472294abea476ffffa4c387e7
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri Aug 14 11:35:38 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Aug 14 11:35:38 2015 +0200

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

diff --git a/cc1/tests/chktest.sh b/cc1/tests/chktest.sh
index 5ce264e..75d2c34 100755
--- a/cc1/tests/chktest.sh
+++ b/cc1/tests/chktest.sh
_AT_@ -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
Received on Fri Aug 14 2015 - 17:08:59 CEST

This archive was generated by hypermail 2.3.0 : Fri Aug 14 2015 - 17:12:11 CEST