I haven't completely sorted through the above issues, but here's a somewhat refactored module and two test files. Because of issues discussed in RT 48070, I'm suggesting the use of IO::CaptureOutput rather than Parrot::IO::Capture::Mini for capturing verbose output. I've enclosed the relevant tests in a SKIP block for those (many) of you who do not have this module installed. Please let me know of any problems.
I will apply the patch in 2-3 days if no one objects. Thank you very much. kid51
Index: MANIFEST =================================================================== --- MANIFEST (revision 23423) +++ MANIFEST (working copy) @@ -1,7 +1,7 @@ # ex: set ro: # $Id$ # -# generated by tools/dev/mk_manifest_and_skip.pl Mon Dec 3 17:41:41 2007 UT +# generated by tools/dev/mk_manifest_and_skip.pl Tue Dec 4 00:18:30 2007 UT # # See tools/dev/install_files.pl for documentation on the # format of this file. @@ -3115,7 +3115,8 @@ t/configure/141-auto_env-01.t [] t/configure/141-auto_env-02.t [] t/configure/141-auto_env-03.t [] -t/configure/142-auto_aio.t [] +t/configure/142-auto_aio-01.t [] +t/configure/142-auto_aio-02.t [] t/configure/143-auto_gmp-01.t [] t/configure/144-auto_readline.t [] t/configure/145-auto_gdbm-01.t [] Index: t/configure/142-auto_aio-01.t =================================================================== --- t/configure/142-auto_aio-01.t (revision 0) +++ t/configure/142-auto_aio-01.t (revision 0) @@ -0,0 +1,85 @@ +#! perl +# Copyright (C) 2007, The Perl Foundation. +# $Id$ +# 142-auto_aio-01.t + +use strict; +use warnings; +use Test::More tests => 12; +use Carp; +use lib qw( lib t/configure/testlib ); +use_ok('config::init::defaults'); +use_ok('config::auto::aio'); +use Parrot::Configure; +use Parrot::Configure::Options qw( process_options ); +use Parrot::Configure::Test qw( test_step_thru_runstep); + +my $args = process_options( + { + argv => [ ], + mode => q{configure}, + } +); + +my $conf = Parrot::Configure->new; + +test_step_thru_runstep( $conf, q{init::defaults}, $args ); + +my $pkg = q{auto::aio}; + +$conf->add_steps($pkg); +$conf->options->set( %{$args} ); + +my ( $task, $step_name, @step_params, $step); +$task = $conf->steps->[1]; +$step_name = $task->step; [EMAIL PROTECTED] = @{ $task->params }; + +$step = $step_name->new(); +ok( defined $step, "$step_name constructor returned defined value" ); +isa_ok( $step, $step_name ); +ok( $step->description(), "$step_name has description" ); + +my $ret = $step->runstep($conf); +ok( $ret, "$step_name runstep() returned true value" ); +like( + $step->result(), + qr/^(yes|no)$/i, + "One of two possible valid results was set" +); + +pass("Completed all tests in $0"); + +################### DOCUMENTATION ################### + +=head1 NAME + +142-auto_aio-01.t - test config::auto::aio + +=head1 SYNOPSIS + + % prove t/configure/142-auto_aio-01.t + +=head1 DESCRIPTION + +The files in this directory test functionality used by F<Configure.pl>. + +The tests in this file test methods found in configuration step class +config::auto::aio. + +=head1 AUTHOR + +James E Keenan + +=head1 SEE ALSO + +config::auto::aio, F<Configure.pl>. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Property changes on: t/configure/142-auto_aio-01.t ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Index: t/configure/142-auto_aio-02.t =================================================================== --- t/configure/142-auto_aio-02.t (revision 0) +++ t/configure/142-auto_aio-02.t (revision 0) @@ -0,0 +1,97 @@ +#! perl +# Copyright (C) 2007, The Perl Foundation. +# $Id$ +# 142-auto_aio-02.t + +use strict; +use warnings; +use Test::More tests => 14; +use Carp; +use lib qw( lib t/configure/testlib ); +use_ok('config::init::defaults'); +use_ok('config::auto::aio'); +use Parrot::Configure; +use Parrot::Configure::Options qw( process_options ); +use Parrot::Configure::Test qw( test_step_thru_runstep); + +my $args = process_options( + { + argv => [ q{--verbose} ], + mode => q{configure}, + } +); + +my $conf = Parrot::Configure->new; + +test_step_thru_runstep( $conf, q{init::defaults}, $args ); + +my $pkg = q{auto::aio}; + +$conf->add_steps($pkg); +$conf->options->set( %{$args} ); + +my ( $task, $step_name, @step_params, $step); +$task = $conf->steps->[1]; +$step_name = $task->step; [EMAIL PROTECTED] = @{ $task->params }; + +$step = $step_name->new(); +ok( defined $step, "$step_name constructor returned defined value" ); +isa_ok( $step, $step_name ); +ok( $step->description(), "$step_name has description" ); + +SKIP: { + eval { use IO::CaptureOutput; }; + skip 'IO::CaptureOutput not installed', 3 if $@; + my ($stdout, $stderr); + my $ret = IO::CaptureOutput::capture sub + { $step->runstep($conf) }, \$stdout, \$stderr; + ok( $ret, "$step_name runstep() returned true value" ); + like( + $step->result(), + qr/^(yes|no)$/i, + "One of two possible valid results was set" + ); + like( + $stdout, + qr/\s+\((yes|no)\)\s+/, + "Got expected verbose output" + ); +} + +pass("Keep Devel::Cover happy"); +pass("Completed all tests in $0"); + +################### DOCUMENTATION ################### + +=head1 NAME + +142-auto_aio-02.t - test config::auto::aio + +=head1 SYNOPSIS + + % prove t/configure/142-auto_aio-02.t + +=head1 DESCRIPTION + +The files in this directory test functionality used by F<Configure.pl>. + +The tests in this file test methods found in configuration step class +config::auto::aio in the case where C<--verbose> is selected. + +=head1 AUTHOR + +James E Keenan + +=head1 SEE ALSO + +config::auto::aio, F<Configure.pl>. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Property changes on: t/configure/142-auto_aio-02.t ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Index: t/configure/142-auto_aio.t =================================================================== --- t/configure/142-auto_aio.t (revision 23423) +++ t/configure/142-auto_aio.t (working copy) @@ -1,55 +0,0 @@ -#! perl -# Copyright (C) 2007, The Perl Foundation. -# $Id$ -# 142-auto_aio.t - -use strict; -use warnings; -use Test::More tests => 2; -use Carp; -use lib qw( lib ); -use_ok('config::auto::aio'); - -=for hints_for_testing The documentation for this package is skimpy; -please try to improve it, e.g., by explaining what 'aio' is. Please -evaluate the comment about 'sigaction err'. Try to cover all branches -and conditions. Check latest reports of Parrot configuration tools -testing coverage to see where your time available for writing tests is -spent. - -=cut - -pass("Completed all tests in $0"); - -################### DOCUMENTATION ################### - -=head1 NAME - -142-auto_aio.t - test config::auto::aio - -=head1 SYNOPSIS - - % prove t/configure/142-auto_aio.t - -=head1 DESCRIPTION - -The files in this directory test functionality used by F<Configure.pl>. - -The tests in this file test subroutines exported by config::auto::aio. - -=head1 AUTHOR - -James E Keenan - -=head1 SEE ALSO - -config::auto::aio, F<Configure.pl>. - -=cut - -# Local Variables: -# mode: cperl -# cperl-indent-level: 4 -# fill-column: 100 -# End: -# vim: expandtab shiftwidth=4: Index: config/auto/aio.pm =================================================================== --- config/auto/aio.pm (revision 23423) +++ config/auto/aio.pm (working copy) @@ -3,12 +3,23 @@ =head1 NAME -config/auto/aio.pm - Test for AIO +config/auto/aio.pm - Test for AI/O =head1 DESCRIPTION -Determines whether the platform supports AIO. +Determines whether the platform supports asynchronous input/output. +From the documentation to Marc Lehmann's CPAN module IO::AIO +(L<http://search.cpan.org/dist/IO-AIO/AIO.pm>): + +I<"Asynchronous means that operations that can normally block your program +(e.g. reading from disk) will be done asynchronously: the operation will +still block, but you can do something else in the meantime. This is +extremely useful for programs that need to stay interactive even when +doing heavy I/O (GUI programs, high performance network servers etc.), +but can also be used to easily do operations in parallel that are +normally done sequentially ...."> + =cut package auto::aio; @@ -33,15 +44,13 @@ sub runstep { my ( $self, $conf ) = ( shift, shift ); - my $test; my $verbose = $conf->options->get('verbose'); my $libs = $conf->data->get('libs'); $conf->data->add( ' ', libs => '-lrt' ); - cc_gen('config/auto/aio/aio.in'); - eval { cc_build(); }; - if ( !$@ ) { - $test = cc_run(35); + my $errormsg = _first_probe_for_aio(); + if ( ! $errormsg ) { + my $test = cc_run(35); # if the test is failing with sigaction err # we should repeat it with a different signal number @@ -72,6 +81,14 @@ return 1; } +sub _first_probe_for_aio { + my $errormsg; + cc_gen('config/auto/aio/aio.in'); + eval { cc_build(); }; + $errormsg = 1 if $@; + return $errormsg; +} + 1; # Local Variables: