Changeset 21808 for util

Show
Ignore:
Timestamp:
08/06/08 14:24:17 (4 months ago)
Author:
audreyt
Message:

* Check in the state of where things are, pending a portable way to

terminate children spawned by open |.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • util/yaml_harness.pl

    r21805 r21808  
    279279    my $kid  = $self->{_child_num} ? "[$self->{_child_num}] " : ""; 
    280280    warn "$kid$test\n"; 
    281     my $t = timeit( 1, sub { $self->SUPER::run_test($test, @rest) } ); 
     281    use Time::HiRes; 
     282    use Time::Out 'timeout'; 
     283    my $t = timeout(10, sub { timeit( 1, 
     284        sub { $self->SUPER::run_test($test, @rest) } 
     285    ) }); 
     286    if ($Test::Harness::Straps::GLOBAL_FH) { 
     287        warn $Test::Harness::Straps::GLOBAL_FH; 
     288        die "We really want to kill ths FH child here... but how?"; 
     289        close $Test::Harness::Straps::GLOBAL_FH; 
     290    } 
    282291    warn "    ".timestr($t)."\n"; 
    283292} 
     293 
     294use Test::Harness::Straps (); 
     295 
     296package Test::Harness::Straps; 
     297use vars '$GLOBAL_FH'; 
     298no warnings 'redefine'; 
    284299 
    285300sub analyze_fh { 
    286301    my($self, $name, $fh) = @_; 
     302    $GLOBAL_FH = $fh; 
    287303 
    288304    my $it = Test::Harness::Iterator->new($fh); 
    289305 
    290     use Time::HiRes; 
    291     use Time::Out 'timeout'; 
    292     my $results = Test::Harness::Results->new; 
    293     timeout 60 => sub { $results = $self->_analyze_iterator($name, $it) }; 
     306    my $results; 
     307    $results = $self->_analyze_iterator($name, $it); 
     308    undef $GLOBAL_FH; 
    294309    return $results; 
    295310} 
    296  
    297311__END__ 
    298312# Simple YAML test harness written over Test::Harness::Straps.