X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fregression%2Fruntests;h=de8b38e4926fea22664664cba15ed3f27dff352e;hb=00619a1fc4da25db5282f6770825a129d1625986;hp=6703e372cb65ced42509771fa5d552d20caa74a0;hpb=d6698dbfb468b564d41a6cf3bea31c6d71912175;p=cql-java-moved-to-github.git diff --git a/test/regression/runtests b/test/regression/runtests index 6703e37..de8b38e 100755 --- a/test/regression/runtests +++ b/test/regression/runtests @@ -1,20 +1,24 @@ #!/usr/bin/perl -w -# $Id: runtests,v 1.5 2002-11-20 17:55:46 mike Exp $ +# $Id: runtests,v 1.11 2007-06-29 11:47:25 mike Exp $ use IO::File; use strict; +$ENV{CLASSPATH} .= ":../../lib/cql-java.jar"; + if (@ARGV != 2) { print STDERR "Usage: $0 \n"; exit(1); } my $compiler = $ARGV[0]; -my $norman = $ARGV[1]; +my $norman = $ARGV[1]; # name of XML normaliser program +my($ntests, $ncorrect) = (0, 0); while () { my $sdir = $_; s@sections/@@; + next if /^CVS$/ || /^10$/; print "testing section $_ - ", read_file("$sdir/name"), "\n"; while (<$sdir/*.cql>) { @@ -24,19 +28,25 @@ while () { my $afile = $qfile; $afile =~ s/\.cql$/.xcql/; print " query $_ - $query "; + $ntests++; my $correct = read_file("$norman < $afile |"); - my $tested = read_file("$compiler < $qfile | $norman |") - or print "\n *** test compiler exited non-zero\n"; - if ($tested eq $correct) { + my $tested = read_file("$compiler < $qfile | $norman |"); + if (!$tested) { + print "\n *** test compiler exited non-zero\n"; + } elsif ($tested eq $correct) { print "OK\n"; + $ncorrect++; } else { - print "\n *** different XCQL output\n"; - print "=== correct ===\n$correct"; + print "\n *** XCQL output differs from $afile\n"; 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) = @_;