Guest User

Untitled

a guest
Apr 27th, 2023
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 8.17 KB | None | 0 0
  1. I see that output from test was caught, and the $result is defined, but is_test and is_bailout are false. Probably that is OK. Also noticed that $spool is undef. I found that the value for that variable is configured via `PERL_TEST_HARNESS_DUMP_TAP` environment variable.
  2.  
  3. /home/kes/perl5/perlbrew/perls/perl-5.30.3/lib/5.30.3/TAP/Parser/Grammar.pm
  4.    x296:     for my $token_data ( @{ $self->{ordered_tokens} } ) {
  5.    x297:         if ( $line =~ $token_data->{syntax} ) {
  6.    x298:             my $handler = $token_data->{handler};
  7.    x299:             $token = $self->$handler($line);
  8.    x300:             last;
  9.     301:         }
  10.     302:     }
  11.     303:
  12.    x304:     $token = $self->_make_unknown_token($line) unless $token;
  13.     305:
  14.   >>306:     return $self->{parser}->make_result($token);
  15.     307: }
  16.  
  17. DBG>$token
  18. {
  19.   raw => Execution of t1.t aborted due to compilation errors.,
  20.   type => unknown,
  21. }
  22.  
  23. /home/kes/perl5/perlbrew/perls/perl-5.30.3/lib/5.30.3/TAP/Parser.pm
  24.     1456:     }    # _has_callbacks
  25.     1457:     else {
  26.     1458:         return sub {
  27.    x1459:             my $result = eval { $grammar->tokenize };
  28.    x1460:             $self->_add_error($@) if $@;
  29.     1461:
  30.    x1462:             if ( defined $result ) {
  31.    x1463:                 $result = $next_state->($result);
  32.     1464:
  33.     1465:                 # Echo TAP to spool file
  34.   >>1466:                 print {$spool} $result->raw, "\n" if $spool;
  35.     1467:             }
  36.     1468:             else {
  37.    x1469:                 $result = $end_handler->();
  38.     1470:             }
  39.     1471:
  40.    x1472:             return $result;
  41.    x1473:         };
  42.     1474:     }    # no callbacks
  43.     1475: }
  44.  
  45. DBG>$spool
  46. undef
  47.  
  48.  
  49. /home/kes/perl5/perlbrew/perls/perl-5.30.3/lib/5.30.3/TAP/Harness.pm
  50.    x608:     my $mux  = $self->_construct( $self->multiplexer_class );
  51.     609:
  52.     610:     RESULT: {
  53.     611:
  54.     612:         # Keep multiplexer topped up
  55.    x613:         FILL:
  56.    x614:         while ( $mux->parsers < $jobs ) {
  57.    x615:             my $job = $scheduler->get_job;
  58.     616:
  59.     617:             # If we hit a spinner stop filling and start running.
  60.    x618:             last FILL if !defined $job || $job->is_spinner;
  61.     619:
  62.    x620:             my ( $parser, $session ) = $self->make_parser($job);
  63.    x621:             $mux->add( $parser, [ $session, $job ] );
  64.     622:         }
  65.     623:
  66.    x624:         DB::x;
  67.    x625:         if ( my ( $parser, $stash, $result ) = $mux->next ) {
  68.    x626:             my ( $session, $job ) = @$stash;
  69.    x627:             if ( defined $result ) {
  70.   1>628:                 $session->result($result);
  71.    x629:                 $self->_bailout($result) if $result->is_bailout;
  72.     630:             }
  73.     631:             else {
  74.     632:
  75.     633:                 # End of parser. Automatically removed from the mux.
  76.    x634:                 $self->finish_parser( $parser, $session );
  77.    x635:                 $self->_after_test( $aggregate, $job, $parser );
  78.    x636:                 $job->finish;
  79.     637:             }
  80.    x638:             redo RESULT;
  81.  
  82.  
  83. DBG>l 0
  84.  
  85. /home/kes/perl5/perlbrew/perls/perl-5.30.3/lib/5.30.3/TAP/Formatter/Console/ParallelSession.pm
  86.     118:
  87.     119: =cut
  88.     120:
  89.     121: sub result {
  90.    x122:     my ( $self, $result ) = @_;
  91.    x123:     my $formatter = $self->formatter;
  92.     124:
  93.     125:     # my $really_quiet = $formatter->really_quiet;
  94.     126:     # my $show_count   = $self->_should_show_count;
  95.     127:
  96.   >>128:     if ( $result->is_test ) {
  97.    x129:         my $context = $shared{$formatter};
  98.    x130:         $context->{tests}++;
  99.     131:
  100.    x132:         my $active = $context->{active};
  101.    x133:         if ( @$active == 1 ) {
  102.     134:
  103.     135:             # There is only one test, so use the serial output format.
  104.    x136:             return $self->SUPER::result($result);
  105.     137:         }
  106.     138:
  107.    x139:         $self->_output_ruler( $self->parser->tests_run == 1 );
  108.     140:     }
  109.    x141:     elsif ( $result->is_bailout ) {
  110.    x142:         $formatter->_failure_output(
  111.     143:                 "Bailout called.  Further testing stopped:  "
  112.     144:               . $result->explanation
  113.     145:               . "\n" );
  114.     146:     }
  115.     147: }
  116.     148:
  117.  
  118.  
  119. DBG>$result
  120. TAP::Parser::Result::Unknown {
  121.   raw => syntax error at t1.t line 1, at EOF,
  122.   type => unknown,
  123. }
  124.  
  125. DBG>$result->is_test
  126.  
  127. DBG>$result->is_bailout
  128.  
  129. ...
  130.  
  131. /home/kes/perl5/perlbrew/perls/perl-5.30.3/lib/5.30.3/TAP/Harness.pm
  132.    x608:     my $mux  = $self->_construct( $self->multiplexer_class );
  133.     609:
  134.     610:     RESULT: {
  135.     611:
  136.     612:         # Keep multiplexer topped up
  137.    x613:         FILL:
  138.    x614:         while ( $mux->parsers < $jobs ) {
  139.    x615:             my $job = $scheduler->get_job;
  140.     616:
  141.     617:             # If we hit a spinner stop filling and start running.
  142.    x618:             last FILL if !defined $job || $job->is_spinner;
  143.     619:
  144.    x620:             my ( $parser, $session ) = $self->make_parser($job);
  145.    x621:             $mux->add( $parser, [ $session, $job ] );
  146.     622:         }
  147.     623:
  148.    x624:         DB::x;
  149.    x625:         if ( my ( $parser, $stash, $result ) = $mux->next ) {
  150.    x626:             my ( $session, $job ) = @$stash;
  151.    x627:             if ( defined $result ) {
  152.   1>628:                 $session->result($result);
  153.    x629:                 $self->_bailout($result) if $result->is_bailout;
  154.     630:             }
  155.     631:             else {
  156.     632:
  157.     633:                 # End of parser. Automatically removed from the mux.
  158.    x634:                 $self->finish_parser( $parser, $session );
  159.    x635:                 $self->_after_test( $aggregate, $job, $parser );
  160.    x636:                 $job->finish;
  161.     637:             }
  162.    x638:             redo RESULT;
  163.  
  164.  
  165. DBG>l 0
  166.  
  167. /home/kes/perl5/perlbrew/perls/perl-5.30.3/lib/5.30.3/TAP/Formatter/Console/ParallelSession.pm
  168.     118:
  169.     119: =cut
  170.     120:
  171.     121: sub result {
  172.    x122:     my ( $self, $result ) = @_;
  173.    x123:     my $formatter = $self->formatter;
  174.     124:
  175.     125:     # my $really_quiet = $formatter->really_quiet;
  176.     126:     # my $show_count   = $self->_should_show_count;
  177.     127:
  178.   >>128:     if ( $result->is_test ) {
  179.    x129:         my $context = $shared{$formatter};
  180.    x130:         $context->{tests}++;
  181.     131:
  182.    x132:         my $active = $context->{active};
  183.    x133:         if ( @$active == 1 ) {
  184.     134:
  185.     135:             # There is only one test, so use the serial output format.
  186.    x136:             return $self->SUPER::result($result);
  187.     137:         }
  188.     138:
  189.    x139:         $self->_output_ruler( $self->parser->tests_run == 1 );
  190.     140:     }
  191.    x141:     elsif ( $result->is_bailout ) {
  192.    x142:         $formatter->_failure_output(
  193.     143:                 "Bailout called.  Further testing stopped:  "
  194.     144:               . $result->explanation
  195.     145:               . "\n" );
  196.     146:     }
  197.     147: }
  198.     148:
  199.  
  200.  
  201. DBG>$result
  202. TAP::Parser::Result::Unknown {
  203.   raw => Execution of t1.t aborted due to compilation errors.,
  204.   type => unknown,
  205. }
  206.  
  207. DBG>$result->is_test
  208.  
  209. DBG>$result->is_bailout
  210.  
  211. Both are false.
  212.  
  213.  
  214. /home/kes/perl5/perlbrew/perls/perl-5.30.3/lib/5.30.3/TAP/Harness.pm
  215.    x873:     $session->close_test;
  216.    x874:     $self->_close_spool($parser);
  217.     875:
  218.    x876:     return $parser;
  219.     877: }
  220.     878:
  221.     879: sub _open_spool {
  222.    x880:     my $self = shift;
  223.    x881:     my $test = shift;
  224.     882:
  225.   >>883:     if ( my $spool_dir = $ENV{PERL_TEST_HARNESS_DUMP_TAP} ) {
  226.     884:
  227.    x885:         my $spool = File::Spec->catfile( $spool_dir, $test );
  228.     886:
  229.     887:         # Make the directory
  230.    x888:         my ( $vol, $dir, undef ) = File::Spec->splitpath($spool);
  231.    x889:         my $path = File::Spec->catpath( $vol, $dir, '' );
  232.    x890:         eval { mkpath($path) };
  233.    x891:         $self->_croak($@) if $@;
  234.     892:
  235.    x893:         my $spool_handle = IO::Handle->new;
  236.    x894:         open( $spool_handle, ">$spool" )
  237.     895:           or $self->_croak(" Can't write $spool ( $! ) ");
  238.     896:
  239.    x897:         return $spool_handle;
  240.     898:     }
  241.     899:
  242.    x900:     return;
  243.     901: }
  244.  
Tags: perl
Advertisement
Add Comment
Please, Sign In to add comment