projects
/
irspy-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Register the "irspy_data" log-level.
[irspy-moved-to-github.git]
/
lib
/
ZOOM
/
IRSpy
/
Test.pm
diff --git
a/lib/ZOOM/IRSpy/Test.pm
b/lib/ZOOM/IRSpy/Test.pm
index
20fa772
..
0bf89bd
100644
(file)
--- a/
lib/ZOOM/IRSpy/Test.pm
+++ b/
lib/ZOOM/IRSpy/Test.pm
@@
-1,4
+1,3
@@
-# $Id: Test.pm,v 1.3 2006-07-21 11:49:27 mike Exp $
package ZOOM::IRSpy::Test;
package ZOOM::IRSpy::Test;
@@
-6,6
+5,11
@@
use 5.008;
use strict;
use warnings;
use strict;
use warnings;
+use Scalar::Util;
+
+use Exporter 'import';
+our @EXPORT = qw(zoom_error_timeout_update zoom_error_timeout_check);
+
=head1 NAME
ZOOM::IRSpy::Test - base class for tests in IRSpy
=head1 NAME
ZOOM::IRSpy::Test - base class for tests in IRSpy
@@
-20,41
+24,42
@@
I<## To follow>
=cut
=cut
-sub new {
+
+sub subtests { () }
+
+sub timeout { undef }
+
+sub start {
my $class = shift();
my $class = shift();
- my($irspy) = @_;
+ my($conn) = @_;
- return bless {
- irspy => $irspy,
- }, $class;
+ die "can't start the base-class test";
}
}
-sub irspy {
- my $this = shift();
- return $this->{irspy};
-}
+our $max_timeout_errors = $ZOOM::IRSpy::max_timeout_errors;
+sub zoom_error_timeout_update {
+ my ($conn, $exception) = @_;
-sub run {
- my $this = shift();
- die "can't run the base-class test";
+ if ($exception =~ /Timeout/i) {
+ $conn->record->zoom_error->{TIMEOUT}++;
+ $conn->log("irspy_test", "Increase timeout error counter to: " .
+ $conn->record->zoom_error->{TIMEOUT});
+ }
}
}
-sub run_tests {
- my $this = shift();
- my @tname = @_;
+sub zoom_error_timeout_check {
+ my $conn = shift;
- my $res = 0;
- foreach my $tname (@tname) {
- my $sub = $this->irspy()->_run_test($tname);
- $res = $sub if $sub > $res;
+ if ($conn->record->zoom_error->{TIMEOUT} >= $max_timeout_errors) {
+ $conn->log("irspy_test", "Got $max_timeout_errors or more timeouts, give up...");
+ return 1;
}
}
- return $res;
+ return 0;
}
}
-
=head1 SEE ALSO
ZOOM::IRSpy
=head1 SEE ALSO
ZOOM::IRSpy