[Bps-public-commit] smokingit-worker branch, master, updated. 6349d54e19c0fd508cf1fd31527f4bb71edfc5e6

Alex Vandiver alexmv at bestpractical.com
Thu Mar 26 03:41:10 EDT 2015


The branch, master has been updated
       via  6349d54e19c0fd508cf1fd31527f4bb71edfc5e6 (commit)
       via  8c3943fac4867417792e0ae826ff08691cfcc57e (commit)
       via  98276876c9f31eb4d71e596847acdc3f5be86735 (commit)
      from  d246a205d47c4a5afdab204bd898eec323705511 (commit)

Summary of changes:
 lib/TAP/Harness/AnyEvent.pm            |  2 +-
 lib/TAP/Parser/Multiplexer/AnyEvent.pm | 36 ++++++++++++++++------------------
 2 files changed, 18 insertions(+), 20 deletions(-)

- Log -----------------------------------------------------------------
commit 98276876c9f31eb4d71e596847acdc3f5be86735
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Mar 26 01:57:57 2015 -0400

    Setting @ISA is insufficient if the base package isn't loaded

diff --git a/lib/TAP/Harness/AnyEvent.pm b/lib/TAP/Harness/AnyEvent.pm
index ae7faa1..cd19bcf 100644
--- a/lib/TAP/Harness/AnyEvent.pm
+++ b/lib/TAP/Harness/AnyEvent.pm
@@ -6,7 +6,7 @@ use vars qw($VERSION @ISA);
 use AnyEvent;
 use AnyEvent::Util qw//;
 
- at ISA = 'TAP::Harness';
+use base 'TAP::Harness';
 
 =head1 NAME
 

commit 8c3943fac4867417792e0ae826ff08691cfcc57e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Mar 26 02:00:43 2015 -0400

    Close filehandles after their watchers are done
    
    Otherwise, the watcher is still in the set of filehandles to select()
    on, and may hang because select returns EBADF.

diff --git a/lib/TAP/Parser/Multiplexer/AnyEvent.pm b/lib/TAP/Parser/Multiplexer/AnyEvent.pm
index c7978f0..3f2b84b 100644
--- a/lib/TAP/Parser/Multiplexer/AnyEvent.pm
+++ b/lib/TAP/Parser/Multiplexer/AnyEvent.pm
@@ -75,9 +75,6 @@ sub _initialize {
         *TAP::Parser::Iterator::Process::_finish = sub {
             my $self = shift;
             $self->{_next} = sub {return};
-            ( delete $self->{out} )->close;
-            ( delete $self->{err} )->close if $self->{sel};
-            delete $self->{sel} if $self->{sel};
             $self->{teardown}->() if $self->{teardown};
             $self->{done}->end;
         }
@@ -168,6 +165,7 @@ sub add {
                     # watcher.  Pushing the undef is done once all parts
                     # of ->{done} are complete.
                     undef $aeh;
+                    $h->close;
                     $it->{done}->end;
                 }
             },

commit 6349d54e19c0fd508cf1fd31527f4bb71edfc5e6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Mar 26 02:02:34 2015 -0400

    Only tear down the parser once all filehandles are done
    
    Otherwise, if STDERR is closed before the test is done outputting
    results to STDOUT, the last STDOUT results will be lost.  Leave the
    parser running until all filehandles are done, and the exit code has
    been captured.

diff --git a/lib/TAP/Parser/Multiplexer/AnyEvent.pm b/lib/TAP/Parser/Multiplexer/AnyEvent.pm
index 3f2b84b..d54fa7e 100644
--- a/lib/TAP/Parser/Multiplexer/AnyEvent.pm
+++ b/lib/TAP/Parser/Multiplexer/AnyEvent.pm
@@ -65,19 +65,15 @@ sub _initialize {
     my $self = shift;
     $self->{count}   = 0;
 
-    # AnyEvent futzes with SIGCHLD.  We split the former _finish method
-    # of TAP::Parser::Iterator::Process into two parts -- the exit-code
-    # part, and the closing-sockets part.  The latter lies in _finish,
-    # the former is installed per-child using L<AnyEvent/child>.
+    # Instead of closing up shop as soon as the first EOF is hit, which
+    # is what ::Process does usually, trust the filehandle watchers
+    # below to do their own cleanup.  Once they are all closed and the
+    # process has exited, the standard _finish steps will be followed;
+    # see the call to ->begin( sub { ... } ), below.
     {
         no warnings 'redefine';
         require TAP::Parser::Iterator::Process;
-        *TAP::Parser::Iterator::Process::_finish = sub {
-            my $self = shift;
-            $self->{_next} = sub {return};
-            $self->{teardown}->() if $self->{teardown};
-            $self->{done}->end;
-        }
+        *TAP::Parser::Iterator::Process::_finish = sub {};
     }
 
     $self->{on_result} = shift;
@@ -126,10 +122,12 @@ sub add {
     my $it = $parser->_iterator;
     $it->{done} = AnyEvent->condvar;
     $it->{done}->begin( sub {
-        # Once we have all of the exit code (below), parsing from
-        # sockets (below that), and closing of sockets (above), send the
-        # undef that signals this test is done.
+        # Once we have all of the exit code (below), and all sockets are
+        # closed (below that), send the undef that signals this test is
+        # done.
         undef $it->{done};
+        $self->{_next} = sub {return};
+        $self->{teardown}->() if $self->{teardown};
         $self->{count}--;
         $self->{on_result}->( $parser, $stash, undef );
     } );
@@ -161,9 +159,9 @@ sub add {
                     # Not EOF?  Return it.
                     $self->{on_result}->( $parser, $stash, $result );
                 } else {
-                    # If this is the end of the line, remove the
-                    # watcher.  Pushing the undef is done once all parts
-                    # of ->{done} are complete.
+                    # If this is the end of the line, remove the watcher
+                    # and close the filehandle.  Pushing the undef is
+                    # done once all parts of ->{done} are complete.
                     undef $aeh;
                     $h->close;
                     $it->{done}->end;
@@ -171,6 +169,8 @@ sub add {
             },
         );
     }
+
+    $it->{done}->end;
     $self->{count}++;
 }
 

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list