Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added a regression test for the FollowTail problem on *BSD.

  • Loading branch information...
commit 3ccb5efad2d98c140574ce9c2021349a656b0336 1 parent 5c12212
@bingos bingos authored
View
1  MANIFEST
@@ -154,6 +154,7 @@ t/30_loops/00_base/wheel_sf_udp.pm
t/30_loops/00_base/wheel_sf_unix.pm
t/30_loops/00_base/wheel_tail.pm
t/90_regression/averell-callback-ret.t
+t/90_regression/bingos-followtail.t
t/90_regression/broeren-win32-nbio.t
t/90_regression/cfedde-filter-httpd.t
t/90_regression/ferrari-server-unix.t
View
1  mylib/PoeBuildInfo.pm
@@ -56,6 +56,7 @@ sub DIST_ABSTRACT () {
sub CLEAN_FILES () {
my @clean_files = qw(
+ bingos-followtail
coverage.report
poe_report.xml
run_network_tests
View
55 t/90_regression/bingos-followtail.t
@@ -0,0 +1,55 @@
+#!/usr/bin/perl -w
+# vim: filetype=perl
+
+use strict;
+
+use POE qw(Wheel::FollowTail);
+use Test::More tests => 1;
+
+my $filename = 'bingos-followtail';
+
+open FH, "> $filename" or die "$!\n";
+
+POE::Session->create(
+ package_states => [
+ 'main' => [qw(_start _input _error _shutdown)],
+ ],
+ heap => { filename => $filename, },
+);
+
+$poe_kernel->run();
+exit 0;
+
+sub _start {
+ my ($kernel,$heap) = @_[KERNEL,HEAP];
+ $heap->{wheel} = POE::Wheel::FollowTail->new(
+ Filename => $heap->{filename},
+ InputEvent => '_input',
+ ErrorEvent => '_error',
+ );
+ $heap->{counter} = 0;
+ print FH "Cows go moo, yes they do\n";
+ close FH;
+ return;
+}
+
+sub _shutdown {
+ delete $_[HEAP]->{wheel};
+ return;
+}
+
+sub _input {
+ my ($kernel,$heap,$input) = @_[KERNEL,HEAP,ARG0];
+ $heap->{counter}++;
+ ok( $heap->{counter} == 1, 'Cows went moo' );
+ $kernel->delay( '_shutdown', 5 ); # Wait five seconds.
+ return;
+}
+
+sub _error {
+ my ($heap,$operation, $errnum, $errstr, $wheel_id) = @_[HEAP,ARG0..ARG3];
+ diag("Wheel $wheel_id generated $operation error $errnum: $errstr\n");
+ delete $heap->{wheel};
+ return;
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.