X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fregression%2Fruntests;h=1630be9e5310b5d481759fed3e6132cc4f2ed215;hb=b306a0bee75d8a4cc9eef354a217fe8d335b36e8;hp=5def86c2658f92dbf13c614b280d6ec8d862243c;hpb=4b83264af4ba6c1cb101a597fa6d7bb144ab4023;p=cql-java-moved-to-github.git diff --git a/test/regression/runtests b/test/regression/runtests index 5def86c..1630be9 100755 --- a/test/regression/runtests +++ b/test/regression/runtests @@ -1,21 +1,25 @@ #!/usr/bin/perl -w -# $Id: runtests,v 1.6 2002-11-20 23:10:17 mike Exp $ +# $Id: runtests,v 1.12 2007-07-03 15:53:52 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$/ || /^10$/; + next if /^CVS$/; print "testing section $_ - ", read_file("$sdir/name"), "\n"; while (<$sdir/*.cql>) { @@ -25,19 +29,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) = @_;