On Wednesday 20 June 2007 12:39:08 [EMAIL PROTECTED] wrote: > Modified: trunk/lib/Parrot/Test.pm > =========================================================================== >=== --- trunk/lib/Parrot/Test.pm (original) > +++ trunk/lib/Parrot/Test.pm Wed Jun 20 12:39:06 2007
> @@ -411,6 +412,76 @@ > return $path; > } > > + > +# These functions are only used by various > +# Parrot::Test::<lang> modules. > +# See RT#43266 > +# This implementation is experimental and currently only works > +# for languages/plumhead > +sub generate_languages_functions { > + > + my %test_map = ( > + output_is => 'is_eq', > + output_like => 'like', > + output_isnt => 'isnt_eq' > + ); > + > + foreach my $func ( keys %test_map ) { > + > + my $test_sub = sub { > + my $self = shift; > + my ( $code, $output, $desc, %options ) = @_; > + > + my $count = $self->{builder}->current_test() + 1; > + > + # These are the thing that depend on the actual language > implementation + my $out_fn = $self->get_out_fn( $count, > \%options ); + my $lang_fn = $self->get_lang_fn( $count, > \%options ); + my @test_prog = $self->get_test_prog( $count, > \%options ); + > + Parrot::Test::write_code_to_file( $code, $lang_fn ); > + > + # set a TODO for Test::Builder to find > + my $skip_why = $self->skip_why( \%options ); > + if ($skip_why) { > + $self->{builder}->skip($skip_why); > + } > + else { > + > + # STDERR is written into same output file > + my $exit_code = Parrot::Test::run_command( > + [EMAIL PROTECTED], > + CD => $self->{relpath}, > + STDOUT => $out_fn, > + STDERR => $out_fn > + ); > + > + my $meth = $test_map{$func}; > + > + # That's the reason for: no strict 'refs'; > + my $pass = $self->{builder}->$meth( > Parrot::Test::slurp_file($out_fn), $output, $desc ); + That line works under strict 'refs'; all method lookups are symbolic in Perl 5. > unless ($pass) { > + my $diag = ''; > + my $test_prog = join ' && ', @test_prog; > + $diag .= "'$test_prog' failed with exit code > $exit_code." if $exit_code; + > $self->{builder}->diag($diag) if $diag; > + } > + } I think this code eats segfaults, as per RT #39197. There's a lot of opportunity for refactoring and cleanup in the Parrot::Test modules. There's too much duplication as it is. -- c