shithub: scc

Download patch

ref: 14474dfd1a3b9a3912b4b73980ed6dad1f604576
parent: 9bf16fdaec39d2cde807c8408532f9535e29652e
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Nov 24 10:08:06 EST 2015

Simplify cc1/tests/chktest.sh

--- a/cc1/tests/chktest.sh
+++ b/cc1/tests/chktest.sh
@@ -2,37 +2,23 @@
 
 out=/tmp/$$.out
 chk=/tmp/$$.chk
-err=test.log
 
 trap "rm -f $out $chk" EXIT INT QUIT HUP
-rm -f $err
+rm -f test.log
 
 for i in *.c
 do
-	awk '
-	BEGIN {
-		out="'$out'"
-		chk="'$chk'"
-		err="'$err'"
-		test="'$i'"
-		system("rm -f " out " " chk)
-	}
-	/^name:/ {
-		printf "Running %s ", $2
-	}
-	/^output:$/ {
-		copyon=1
-	}
-	/^\*\//  {
-		copyon=0
-	}
-	copyon==1 && !/^output:$/  {
-		print $0 >> chk
-	}
-	END {
-		system("../cc1 -I. -w " test " > " out " 2>&1")
-		cmd="diff -c " chk " " out " >> " err
-		print test >> err
-		print system(cmd) ? "[FAILED]" : "[OK]"
-	}' $i
+	rm -f $out $chk
+	awk '/^name:/    {printf "Running %s ", $2}
+	     /^output:$/ {copyon=1; next}
+	     /^\*\//     {copyon=0; next}
+	     copyon==1   {print > "'$chk'"}' $i
+
+	../cc1 -I. -w $i > $out 2>&1
+	if diff -c $chk $out >> test.log
+	then
+		echo [OK]
+	else
+		echo [FAILED]
+	fi
 done