Emit "=== end ===" after comparison.
[cql-java-moved-to-github.git] / test / regression / runtests
index f1d462b..008c271 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
-# $Id: runtests,v 1.7 2002-11-21 09:57:28 mike Exp $
+# $Id: runtests,v 1.9 2007-06-21 10:10:32 mike Exp $
 
 use IO::File;
 use strict;
@@ -13,6 +13,7 @@ if (@ARGV != 2) {
 }
 my $compiler = $ARGV[0];
 my $norman = $ARGV[1];         # name of XML normaliser program
+my($ntests, $ncorrect) = (0, 0);
 
 while (<sections/*>) {
     my $sdir = $_;
@@ -30,16 +31,22 @@ while (<sections/*>) {
        my $correct = read_file("$norman < $afile |");
        my $tested = read_file("$compiler < $qfile | $norman |")
            or print "\n    *** test compiler exited non-zero\n";
+       $ntests++;
        if ($tested eq $correct) {
            print "OK\n";
+           $ncorrect++;
        } else {
            print "\n    *** different XCQL output\n";
            print "=== correct ===\n$correct";
            print "=== tested ===\n$tested";
+           print "=== end ===\n";
        }
     }
 }
 
+print sprintf("%d of %d passed: %d%%\n",
+             $ncorrect, $ntests, (100 * $ncorrect) / $ntests);
+
 sub read_file {
     my($name) = @_;