X-Git-Url: http://git.indexdata.com/?p=irspy-moved-to-github.git;a=blobdiff_plain;f=lib%2FZOOM%2FIRSpy.pm;h=b3c0aeb15e8de464b155625bccabe60bd052d75d;hp=6997079e5f5a568cad3313f4285edd9021535f05;hb=09a78b8e8d348d62681278705447c19070cbd6b1;hpb=45dc9803fe506f2e308d5c0be48c266290ac8df1 diff --git a/lib/ZOOM/IRSpy.pm b/lib/ZOOM/IRSpy.pm index 6997079..b3c0aeb 100644 --- a/lib/ZOOM/IRSpy.pm +++ b/lib/ZOOM/IRSpy.pm @@ -1,4 +1,4 @@ -# $Id: IRSpy.pm,v 1.69 2007-02-26 14:49:23 mike Exp $ +# $Id: IRSpy.pm,v 1.72 2007-02-28 17:36:00 mike Exp $ package ZOOM::IRSpy; @@ -199,8 +199,9 @@ sub initialise { $this->log("irspy_debug", "query '", $this->{query}, "'"); my $rs = $this->{conn}->search(new ZOOM::Query::CQL($this->{query})); + $this->log("irspy", "'", $this->{query}, "' found ", + $rs->size(), " target records"); delete $this->{query}; # No longer needed at all - $this->log("irspy_debug", "found ", $rs->size(), " target records"); my $gatherTargets = !$this->{targets}; foreach my $i (1 .. $rs->size()) { my $target = _render_record($rs, $i-1, "id"); @@ -262,7 +263,8 @@ sub _irspy_to_zeerex { if ($save_xml) { unlink('/tmp/irspy_orig.xml'); - open FH, '>/tmp/irspy_orig.xml'; + open FH, '>/tmp/irspy_orig.xml' + or die "can't write irspy_orig.xml: $!"; print FH $irspy_doc->toString(); close FH; } @@ -270,7 +272,8 @@ sub _irspy_to_zeerex { my $result = $this->{irspy_to_zeerex_style}->transform($irspy_doc, %params); if ($save_xml) { unlink('/tmp/irspy_transformed.xml'); - open FH, '>/tmp/irspy_transformed.xml'; + open FH, '>/tmp/irspy_transformed.xml' + or die "can't write irspy_transformed.xml: $!"; print FH $result->toString(); close FH; } @@ -346,6 +349,7 @@ sub check { $tname = "Main" if !defined $tname; $this->{tree} = $this->_gather_tests($tname) or die "No tests defined for '$tname'"; + $this->{tree}->resolve(); #$this->{tree}->print(0); my $nskipped = 0; @@ -474,12 +478,22 @@ sub check { $conn->next_task(0); if ($res == ZOOM::IRSpy::Status::TEST_BAD) { my $address = $conn->option('current_test_address'); - ($address, my $n) = $this->_last_sibling_test($address); - if (defined $address) { - $conn->log("irspy_test", "skipped $n tests"); - $conn->option(current_test_address => $address); - $nskipped += $n; + $conn->log("irspy", "top-level test failed!") + if $address eq ""; + my $node = $this->{tree}->select($address); + my $skipcount = 0; + while (defined $node->next() && + length($node->next()->address()) >= length($address)) { + $conn->log("irspy_debug", "skipping from '", + $node->address(), "' to '", + $node->next()->address(), "'"); + $node = $node->next(); + $skipcount++; } + + $conn->option(current_test_address => $node->address()); + $conn->log("irspy_test", "skipped $skipcount tests"); + $nskipped += $skipcount; } } elsif ($res == ZOOM::IRSpy::Status::TEST_SKIPPED) {