X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fregression%2Fruntests;h=c12cd3c8791fb6ab5ea4d6751a8c5baf1d4431f4;hb=d48bccaed9308a737cdfa55ba555891d0ad85b87;hp=78e411762dce0c64ed036344f4075734de60ebf6;hpb=6bcdff4c474737f8e983873fdde87fbc01631405;p=cql-java-moved-to-github.git diff --git a/test/regression/runtests b/test/regression/runtests index 78e4117..c12cd3c 100755 --- a/test/regression/runtests +++ b/test/regression/runtests @@ -1,20 +1,24 @@ #!/usr/bin/perl -w -# $Id: runtests,v 1.3 2002-11-06 22:03:58 mike Exp $ use IO::File; use strict; +$ENV{CLASSPATH} .= ":../../src/main/java"; +$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$/; print "testing section $_ - ", read_file("$sdir/name"), "\n"; while (<$sdir/*.cql>) { @@ -23,18 +27,26 @@ while () { my $query = read_file($qfile); my $afile = $qfile; $afile =~ s/\.cql$/.xcql/; - print " query $_ - $query\n"; + print " query $_ - $query "; + $ntests++; my $correct = read_file("$norman < $afile |"); - my $tested = read_file("$compiler < $qfile | $norman |") - or die "can't run test compiler '$compiler | $norman': $!"; - if ($tested ne $correct) { - print " *** different XCQL output\n"; - print "=== correct ===\n$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 *** 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) = @_;