-# $Id: IRSpy.pm,v 1.68 2007-02-23 16:45:55 mike Exp $
+# $Id: IRSpy.pm,v 1.72 2007-02-28 17:36:00 mike Exp $
package ZOOM::IRSpy;
$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");
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;
}
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;
}
$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;
die "$conn has no current task for event $ev ($evstr)" if !$task;
my $res;
- eval { $conn->_check() };
- if ($@) {
+ eval { $conn->check() };
+ if ($@ && ref $@ && $@->isa("ZOOM::Exception")) {
my $sub = $task->{cb}->{exception};
die $@ if !defined $sub;
$res = &$sub($conn, $task, $task->udata(), $@);
+ } elsif ($@) {
+ die "Unexpected non-ZOOM exception: " . ref($@) . " ($@)";
} else {
my $sub = $task->{cb}->{$ev};
if (!defined $sub) {
$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) {