[libpoe-test-loops-perl] 01/04: Imported Upstream version 1.357
gregor herrmann
gregoa at debian.org
Sat Jul 12 17:37:10 UTC 2014
This is an automated email from the git hooks/post-receive script.
gregoa pushed a commit to branch master
in repository libpoe-test-loops-perl.
commit d99a398a26fdf63c29ac59b31a868956122f56b0
Author: gregor herrmann <gregoa at debian.org>
Date: Sat Jul 12 19:31:04 2014 +0200
Imported Upstream version 1.357
---
CHANGES | 44 ++++++++++++++-
LICENSE | 2 +-
META.json | 4 +-
META.yml | 4 +-
Makefile.PL | 6 +-
README.mkdn | 66 +++++++++++-----------
lib/POE/Test/DondeEstan.pm | 2 +-
lib/POE/Test/Loops.pm | 2 +-
lib/POE/Test/Loops/k_alarms.pm | 48 ++++++++--------
lib/POE/Test/Loops/wheel_accept.pm | 13 +++--
lib/POE/Test/Loops/wheel_sf_udp.pm | 4 +-
lib/POE/Test/Loops/wheel_tail.pm | 9 +++
lib/POE/Test/Loops/z_rt54319_bazerka_followtail.pm | 42 ++++++++++----
13 files changed, 160 insertions(+), 86 deletions(-)
diff --git a/CHANGES b/CHANGES
index d55b45a..4c622d7 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,9 +1,47 @@
==================================================
-Changes from 2013-07-08 00:00:00 +0000 to present.
+Changes from 2013-07-12 00:00:00 +0000 to present.
==================================================
------------------------------------------
-version 1.355 at 2014-07-08 04:46:36 +0000
+version 1.357 at 2014-07-12 06:41:17 +0000
+------------------------------------------
+
+ Change: b38be9a86069bdb41244d40198bd30fa94c9cda0
+ Author: Rocco Caputo <rcaputo at cpan.org>
+ Date : 2014-07-12 02:35:21 +0000
+
+ Take about 2sec off each POE::Wheel::Accept test that runs.
+
+ Change: dc33d14687a3c44e118e4ea702700b54a5e085e5
+ Author: Rocco Caputo <rcaputo at cpan.org>
+ Date : 2014-07-12 02:26:30 +0000
+
+ Take about 3sec off the UDP SocketFactory test.
+
+ Change: 63153832441b24466c948c375ac3d5f4f7d46eb5
+ Author: Rocco Caputo <rcaputo at cpan.org>
+ Date : 2014-07-12 00:58:37 +0000
+
+ Reduce the time to test basic timers.
+
+------------------------------------------
+version 1.356 at 2014-07-12 02:41:59 +0000
+------------------------------------------
+
+ Change: a99ffee13fa9a7d149479f89b20855ec4f299e9d
+ Author: Rocco Caputo <rcaputo at cpan.org>
+ Date : 2014-07-11 22:41:59 +0000
+
+ Reduce the time for another test from ~9sec to ~3.5sec.
+
+ Change: 49b986fda759a77198fd9a315474797b6619b376
+ Author: Rocco Caputo <rcaputo at cpan.org>
+ Date : 2014-07-11 22:09:46 +0000
+
+ Reduce the ending timeout for wheel_tail.pm.
+
+------------------------------------------
+version 1.355 at 2014-07-08 04:36:33 +0000
------------------------------------------
Change: abba8d0ecf3f47a70c4fc52c94b6affdd1f701d8
@@ -158,5 +196,5 @@ version 1.352 at 2013-08-19 22:42:04 +0000
f5
=================================================
-Plus 26 releases after 2013-07-08 00:00:00 +0000.
+Plus 26 releases after 2013-07-12 00:00:00 +0000.
=================================================
diff --git a/LICENSE b/LICENSE
index 87cdc71..8aac4fc 100644
--- a/LICENSE
+++ b/LICENSE
@@ -22,7 +22,7 @@ This is free software, licensed under:
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
- 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
diff --git a/META.json b/META.json
index 9ba5cc4..48a6912 100644
--- a/META.json
+++ b/META.json
@@ -28,7 +28,7 @@
},
"runtime" : {
"requires" : {
- "Test::More" : "1.001002"
+ "Test::More" : "1.001003"
}
}
},
@@ -45,6 +45,6 @@
"web" : "https://github.com/rcaputo/poe-test-loops"
}
},
- "version" : "1.355"
+ "version" : "1.357"
}
diff --git a/META.yml b/META.yml
index aaa8304..c13e25d 100644
--- a/META.yml
+++ b/META.yml
@@ -13,9 +13,9 @@ meta-spec:
version: '1.4'
name: POE-Test-Loops
requires:
- Test::More: '1.001002'
+ Test::More: '1.001003'
resources:
bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=POE-Test-Loops
homepage: http://search.cpan.org/dist/POE-Test-Loops/
repository: git://github.com/rcaputo/poe-test-loops.git
-version: '1.355'
+version: '1.357'
diff --git a/Makefile.PL b/Makefile.PL
index ec05553..9353172 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -22,9 +22,9 @@ my %WriteMakefileArgs = (
"LICENSE" => "perl",
"NAME" => "POE::Test::Loops",
"PREREQ_PM" => {
- "Test::More" => "1.001002"
+ "Test::More" => "1.001003"
},
- "VERSION" => "1.355",
+ "VERSION" => "1.357",
"test" => {
"TESTS" => "t/*.t"
}
@@ -32,7 +32,7 @@ my %WriteMakefileArgs = (
my %FallbackPrereqs = (
- "Test::More" => "1.001002"
+ "Test::More" => "1.001003"
);
diff --git a/README.mkdn b/README.mkdn
index 00de1ac..e436784 100644
--- a/README.mkdn
+++ b/README.mkdn
@@ -4,34 +4,34 @@ POE::Test::Loops - Reusable tests for POE::Loop authors
# SYNOPSIS
- #!/usr/bin/perl -w
-
- use strict;
- use Getopt::Long;
- use POE::Test::Loops;
-
- my ($dir_base, $flag_help, @loop_modules, $flag_verbose);
- my $result = GetOptions(
- 'dirbase=s' => \$dir_base,
- 'loop=s' => \@loop_modules,
- 'verbose' => \$flag_verbose,
- 'help' => \$flag_help,
- );
-
- if (
- !$result or !$dir_base or $flag_help or !@loop_modules
- ) {
- die(
- "$0 usage:\n",
- " --dirbase DIR (required) base directory for tests\n",
- " --loop MODULE (required) loop modules to test\n",
- " --verbose show some extra output\n",
- " --help you're reading it\n",
- );
- }
-
- POE::Test::Loops::generate($dir_base, \@loop_modules, $flag_verbose);
- exit 0;
+ #!/usr/bin/perl -w
+
+ use strict;
+ use Getopt::Long;
+ use POE::Test::Loops;
+
+ my ($dir_base, $flag_help, @loop_modules, $flag_verbose);
+ my $result = GetOptions(
+ 'dirbase=s' => \$dir_base,
+ 'loop=s' => \@loop_modules,
+ 'verbose' => \$flag_verbose,
+ 'help' => \$flag_help,
+ );
+
+ if (
+ !$result or !$dir_base or $flag_help or !@loop_modules
+ ) {
+ die(
+ "$0 usage:\n",
+ " --dirbase DIR (required) base directory for tests\n",
+ " --loop MODULE (required) loop modules to test\n",
+ " --verbose show some extra output\n",
+ " --help you're reading it\n",
+ );
+ }
+
+ POE::Test::Loops::generate($dir_base, \@loop_modules, $flag_verbose);
+ exit 0;
# DESCRIPTION
@@ -50,11 +50,11 @@ Generates the loop tests. DIRBASE is the (relative) directory in
which a subdirectory for each of the LOOPS is created. If VERBOSE is
set to a TRUE value some progress reporting is printed.
- POE::Test::Loops::generate(
- "./t",
- [ "POE::Loop::Yours" ],
- 1,
- );
+ POE::Test::Loops::generate(
+ "./t",
+ [ "POE::Loop::Yours" ],
+ 1,
+ );
# SEE ALSO
diff --git a/lib/POE/Test/DondeEstan.pm b/lib/POE/Test/DondeEstan.pm
index ef9dc1b..ecd9d44 100644
--- a/lib/POE/Test/DondeEstan.pm
+++ b/lib/POE/Test/DondeEstan.pm
@@ -1,5 +1,5 @@
package POE::Test::DondeEstan;
-$POE::Test::DondeEstan::VERSION = '1.355';
+$POE::Test::DondeEstan::VERSION = '1.357';
use warnings;
use strict;
diff --git a/lib/POE/Test/Loops.pm b/lib/POE/Test/Loops.pm
index 1a585c4..99b7f54 100644
--- a/lib/POE/Test/Loops.pm
+++ b/lib/POE/Test/Loops.pm
@@ -1,7 +1,7 @@
# vim: ts=2 sw=2 expandtab
package POE::Test::Loops;
-$POE::Test::Loops::VERSION = '1.355';
+$POE::Test::Loops::VERSION = '1.357';
use warnings;
use strict;
diff --git a/lib/POE/Test/Loops/k_alarms.pm b/lib/POE/Test/Loops/k_alarms.pm
index ce91285..4b49a1c 100644
--- a/lib/POE/Test/Loops/k_alarms.pm
+++ b/lib/POE/Test/Loops/k_alarms.pm
@@ -17,6 +17,8 @@ BEGIN {
use constant TRACE_DEFAULT => exists($INC{'Devel/Cover.pm'});
}
+use constant WAIT => 0.5;
+
BEGIN { use_ok("POE") }
# Test the ID-based alarm API. Start several test paths. Each path
@@ -50,56 +52,56 @@ sub test_start {
# Path #1: single alarm; make sure it rings.
$heap->{test}->{path_one} = 0;
- $kernel->alarm( path_one => time() + 2, 1.1 );
+ $kernel->alarm( path_one => time() + WAIT, 1.1 );
# Path #2: two alarms; make sure only the second one rings.
$heap->{test}->{path_two} = 0;
- $kernel->alarm( path_two => time() + 2, 2.1 );
- $kernel->alarm( path_two => time() + 2, 2.2 );
+ $kernel->alarm( path_two => time() + WAIT, 2.1 );
+ $kernel->alarm( path_two => time() + WAIT, 2.2 );
# Path #3: two alarms; make sure they both ring in order.
$heap->{test}->{path_three} = 0;
- $kernel->alarm_add( path_three => time() + 2, 3.1 );
- $kernel->alarm_add( path_three => time() + 2, 3.2 );
+ $kernel->alarm_add( path_three => time() + WAIT, 3.1 );
+ $kernel->alarm_add( path_three => time() + WAIT, 3.2 );
# Path #4: interleaved alarm and alarm_add; only the last two should
# ring, in order.
$heap->{test}->{path_four} = 0;
- $kernel->alarm( path_four => time() + 2, 4.1 );
- $kernel->alarm_add( path_four => time() + 2, 4.2 );
- $kernel->alarm( path_four => time() + 2, 4.3 );
- $kernel->alarm_add( path_four => time() + 2, 4.4 );
+ $kernel->alarm( path_four => time() + WAIT, 4.1 );
+ $kernel->alarm_add( path_four => time() + WAIT, 4.2 );
+ $kernel->alarm( path_four => time() + WAIT, 4.3 );
+ $kernel->alarm_add( path_four => time() + WAIT, 4.4 );
# Path #5: an alarm that is squelched; nothing should ring.
$heap->{test}->{path_five} = 1;
- $kernel->alarm( path_five => time() + 2, 5.1 );
+ $kernel->alarm( path_five => time() + WAIT, 5.1 );
$kernel->alarm( 'path_five' );
# Path #6: single delay; make sure it rings.
$heap->{test}->{path_six} = 0;
- $kernel->delay( path_six => 2, 6.1 );
+ $kernel->delay( path_six => WAIT, 6.1 );
# Path #7: two delays; make sure only the second one rings.
$heap->{test}->{path_seven} = 0;
- $kernel->delay( path_seven => 2, 7.1 );
- $kernel->delay( path_seven => 2, 7.2 );
+ $kernel->delay( path_seven => WAIT, 7.1 );
+ $kernel->delay( path_seven => WAIT, 7.2 );
# Path #8: two delays; make sure they both ring in order.
$heap->{test}->{path_eight} = 0;
- $kernel->delay_add( path_eight => 2, 8.1 );
- $kernel->delay_add( path_eight => 2, 8.2 );
+ $kernel->delay_add( path_eight => WAIT, 8.1 );
+ $kernel->delay_add( path_eight => WAIT, 8.2 );
# Path #9: interleaved delay and delay_add; only the last two should
# ring, in order.
$heap->{test}->{path_nine} = 0;
- $kernel->alarm( path_nine => 2, 9.1 );
- $kernel->alarm_add( path_nine => 2, 9.2 );
- $kernel->alarm( path_nine => 2, 9.3 );
- $kernel->alarm_add( path_nine => 2, 9.4 );
+ $kernel->alarm( path_nine => WAIT, 9.1 );
+ $kernel->alarm_add( path_nine => WAIT, 9.2 );
+ $kernel->alarm( path_nine => WAIT, 9.3 );
+ $kernel->alarm_add( path_nine => WAIT, 9.4 );
# Path #10: a delay that is squelched; nothing should ring.
$heap->{test}->{path_ten} = 1;
- $kernel->delay( path_ten => 2, 10.1 );
+ $kernel->delay( path_ten => WAIT, 10.1 );
$kernel->alarm( 'path_ten' );
# Path #11: ensure alarms are enqueued in time order.
@@ -355,7 +357,7 @@ POE::Session->create(
# Heisenberg strikes again!
my $now = time;
- my $test_15 = $kernel->delay_set( test_15 => 1 => 15 );
+ my $test_15 = $kernel->delay_set( test_15 => WAIT, 15 );
my $test_scalar = $kernel->alarm_remove( $test_15 );
is($test_scalar->[0], 'test_15', "alarm 15 remove: name is correct");
@@ -374,8 +376,8 @@ POE::Session->create(
is($_[ARG0], 13, "alarm 13: received proper data");
# Set a couple alarms, then clear them all.
- $kernel->delay( test_16 => 1 );
- $kernel->delay( test_17 => 1 );
+ $kernel->delay( test_16 => WAIT );
+ $kernel->delay( test_17 => WAIT );
$kernel->alarm_remove_all();
# Test alarm adjusting on little queues.
diff --git a/lib/POE/Test/Loops/wheel_accept.pm b/lib/POE/Test/Loops/wheel_accept.pm
index 8921c9d..56882e7 100644
--- a/lib/POE/Test/Loops/wheel_accept.pm
+++ b/lib/POE/Test/Loops/wheel_accept.pm
@@ -22,6 +22,7 @@ unless (-f "run_network_tests") {
plan skip_all => "Network access (and permission) required to run this test";
}
+use constant CONNECTOR_COUNT => 5;
plan tests => 2;
my $bound_port;
@@ -61,25 +62,27 @@ sub listener_start {
);
$heap->{accept_count} = 0;
- $_[KERNEL]->delay( got_timeout => 30 );
+ $_[KERNEL]->delay( got_timeout => 10 );
}
sub listener_stop {
if (defined $bound_port) {
ok(
- $_[HEAP]->{accept_count} == 5,
+ $_[HEAP]->{accept_count} == CONNECTOR_COUNT,
"listening socket accepted connections"
);
}
}
sub listener_got_connection {
- $_[HEAP]->{accept_count}++;
- $_[KERNEL]->delay( got_timeout => 3 );
+ if (++$_[HEAP]->{accept_count} == CONNECTOR_COUNT) {
+ $_[KERNEL]->delay( got_timeout => 1 );
+ }
}
sub listener_got_error {
delete $_[HEAP]->{listener_wheel};
+ $_[KERNEL]->delay( got_timeout => 1 );
}
sub listener_got_timeout {
@@ -117,7 +120,7 @@ POE::Session->create(
);
if (defined $bound_port) {
- for (my $connector_count=0; $connector_count < 5; $connector_count++) {
+ foreach (1..CONNECTOR_COUNT) {
POE::Session->create(
inline_states => {
_start => \&connector_start,
diff --git a/lib/POE/Test/Loops/wheel_sf_udp.pm b/lib/POE/Test/Loops/wheel_sf_udp.pm
index e94dd78..cc69501 100644
--- a/lib/POE/Test/Loops/wheel_sf_udp.pm
+++ b/lib/POE/Test/Loops/wheel_sf_udp.pm
@@ -171,7 +171,7 @@ sub udp_peer_a_input {
or $heap->{peer_a_send_error}++;
}
else {
- $kernel->select_read($socket);
+ $kernel->delay( ev_took_too_long => 0.5 );
}
}
else {
@@ -192,7 +192,7 @@ sub udp_peer_b_input {
or $heap->{peer_b_send_error}++;
}
else {
- $kernel->select_read($socket);
+ $kernel->delay( ev_took_too_long => 0.5 );
}
}
else {
diff --git a/lib/POE/Test/Loops/wheel_tail.pm b/lib/POE/Test/Loops/wheel_tail.pm
index 9c8966e..8db829d 100644
--- a/lib/POE/Test/Loops/wheel_tail.pm
+++ b/lib/POE/Test/Loops/wheel_tail.pm
@@ -82,6 +82,12 @@ sub sss_start {
sub sss_block {
my ($kernel, $heap, $block) = @_[KERNEL, HEAP, ARG0];
DEBUG and warn "=== handle tail got block ($block)";
+
+ if ($block eq 'DONEDONEDONEDONE') {
+ $kernel->delay( ev_timeout => 1 );
+ return;
+ }
+
$heap->{read_count}++;
$kernel->delay( ev_timeout => 10 );
}
@@ -191,6 +197,9 @@ sub client_tcp_got_alarm {
# Delay is 1 for slow hardware.
$kernel->delay( got_alarm => 1 );
}
+ else {
+ $heap->{wheel}->put( 'DONEDONEDONEDONE' );
+ }
}
sub client_tcp_got_error {
diff --git a/lib/POE/Test/Loops/z_rt54319_bazerka_followtail.pm b/lib/POE/Test/Loops/z_rt54319_bazerka_followtail.pm
index 80f4c29..d4d65df 100644
--- a/lib/POE/Test/Loops/z_rt54319_bazerka_followtail.pm
+++ b/lib/POE/Test/Loops/z_rt54319_bazerka_followtail.pm
@@ -1,17 +1,22 @@
#! /usr/bin/env perl
# vim: ts=2 sw=2 expandtab
-# Verify that POE::Wheel::FollowTail does indeed follow a file's tail.
-
use strict;
use warnings;
+sub POE::Kernel::CATCH_EXCEPTIONS () { 0 }
+sub POE::Kernel::ASSERT_DEFAULT () { 1 }
+
+use Time::HiRes qw(time);
use IO::Handle;
use POE qw(Wheel::FollowTail);
-use constant TESTS => 10;
-use Test::More;
+use constant {
+ TESTS => 6,
+ TIME_BETWEEN_WRITES => 0.5,
+};
+use Test::More;
use File::Temp;
# Sanely generate the tempfile
@@ -22,7 +27,10 @@ plan skip_all => "Unable to create tempfile for testing" if $@;
$write_fh->autoflush(1);
my $write_count = 0;
-plan tests => 10;
+plan tests => TESTS;
+
+# Write to the log 2x as fast as it's polled.
+# Make sure none of the lines is delayed overly long.
POE::Session->create(
inline_states => {
@@ -31,32 +39,46 @@ POE::Session->create(
},
on_tick => sub {
print $write_fh ++$write_count, " ", time(), "\n";
- $_[KERNEL]->delay("on_tick" => 1) if $write_count < TESTS;
+ $_[KERNEL]->delay("on_tick" => TIME_BETWEEN_WRITES) if $write_count < TESTS;
},
+ _stop => sub { undef },
}
);
+# Read from the log at one check every 3 seconds.
+
+my $poll_interval = TIME_BETWEEN_WRITES * 2;
+my $per_test_timeout = TIME_BETWEEN_WRITES * 3;
+
POE::Session->create(
inline_states => {
_start => sub {
$_[HEAP]{tailor} = POE::Wheel::FollowTail->new(
Filename => $write_fh->filename,
InputEvent => "got_log_line",
- PollInterval => 3,
+ PollInterval => $poll_interval,
);
- $_[KERNEL]->delay(timeout => 20);
+
+ # A long timeout to begin with.
+ $_[KERNEL]->delay(timeout => $poll_interval * TESTS);
},
got_log_line => sub {
my ($write, $time) = split /\s+/, $_[ARG0];
- my $elapsed = time() - $time;
- ok($elapsed <= 6, "response time <=6 seconds ($elapsed)");
+ my $elapsed = sprintf("%.2f", time() - $time);
+ ok(
+ $elapsed <= $per_test_timeout,
+ "response time <= $per_test_timeout sec ($elapsed)"
+ );
return if $write < TESTS;
+
+ # Stop the timeout when we're done.
$_[KERNEL]->delay(timeout => undef);
delete $_[HEAP]{tailor};
},
timeout => sub {
delete $_[HEAP]{tailor};
},
+ _stop => sub { undef },
}
);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libpoe-test-loops-perl.git
More information about the Pkg-perl-cvs-commits
mailing list