Review this patch instead; it's more complete.
Index: MANIFEST =================================================================== --- MANIFEST (revision 23336) +++ MANIFEST (working copy) @@ -1,7 +1,7 @@ # ex: set ro: # $Id$ # -# generated by tools\dev\mk_manifest_and_skip.pl Sat Dec 1 14:55:37 2007 UT +# generated by tools/dev/mk_manifest_and_skip.pl Sun Dec 2 04:27:17 2007 UT # # See tools/dev/install_files.pl for documentation on the # format of this file. @@ -3007,6 +3007,8 @@ t/configure/056-fatal_step.t [] t/configure/057-fatal_step.t [] t/configure/058-fatal_step.t [] +t/configure/059-silent.t [] +t/configure/060-silent.t [] t/configure/101-init_manifest-01.t [] t/configure/101-init_manifest-02.t [] t/configure/102-init_defaults-01.t [] @@ -3154,6 +3156,7 @@ t/configure/testlib/init/gamma.pm [] t/configure/testlib/init/iota.pm [] t/configure/testlib/init/kappa.pm [] +t/configure/testlib/init/lambda.pm [] t/configure/testlib/init/zeta.pm [] t/configure/testlib/inter/theta.pm [] t/distro/file_metadata.t [] Index: lib/Parrot/Configure/Options/Conf.pm =================================================================== --- lib/Parrot/Configure/Options/Conf.pm (revision 23336) +++ lib/Parrot/Configure/Options/Conf.pm (working copy) @@ -69,6 +69,7 @@ profile sbindir sharedstatedir + silent sysconfdir test verbose @@ -128,6 +129,7 @@ Configure.pl to halt --fatal-step Comma-delimited string of configuration steps which upon failure cause Configure.pl to halt + --silent Don't be verbose, interactive or fatal --nomanicheck Don't check the MANIFEST --languages="list of languages" Specify a list of languages to process Index: lib/Parrot/Configure.pm =================================================================== --- lib/Parrot/Configure.pm (revision 23336) +++ lib/Parrot/Configure.pm (working copy) @@ -221,8 +221,12 @@ my $conf = shift; my $n = 0; # step number - my ( $verbose, $verbose_step, $fatal, $fatal_step, $ask ) = - $conf->options->get(qw( verbose verbose-step fatal fatal-step ask )); + my ( $silent, $verbose, $verbose_step, $fatal, $fatal_step, $ask ); + $silent = $conf->options->get(qw( silent )); + unless ($silent) { + ( $verbose, $verbose_step, $fatal, $fatal_step, $ask ) = + $conf->options->get(qw( verbose verbose-step fatal fatal-step ask )); + } $conf->{log} = []; my %steps_to_die_for = (); @@ -259,6 +263,7 @@ verbose_step => $verbose_step, ask => $ask, n => $n, + silent => $silent, } ); if ( ! defined $rv ) { @@ -383,8 +388,10 @@ } } - print "\n", $step->description, '...'; - print "\n" if $args->{verbose} && $args->{verbose} == 2; + unless ($args->{silent}) { + print "\n", $step->description, '...'; + print "\n" if $args->{verbose} && $args->{verbose} == 2; + } my $ret; # When successful, a Parrot configuration step now returns 1 @@ -405,14 +412,16 @@ # A Parrot configuration step can run successfully, but if it fails to # achieve its objective it is supposed to return an undefined status. if ( $ret ) { - _finish_printing_result( - { - step => $step, - step_name => $step_name, - args => $args, - description => $step->description, - } - ); + unless ($args->{silent}) { + _finish_printing_result( + { + step => $step, + step_name => $step_name, + args => $args, + description => $step->description, + } + ); + } # reset verbose value for the next step $conf->options->set( verbose => $args->{verbose} ); if ($conf->options->get(q{configure_trace}) ) { Index: t/configure/testlib/init/lambda.pm =================================================================== --- t/configure/testlib/init/lambda.pm (revision 0) +++ t/configure/testlib/init/lambda.pm (revision 0) @@ -0,0 +1,39 @@ +# Copyright (C) 2001-2003, The Perl Foundation. +# $Id$ + +=head1 NAME + +t/configure/testlib/init/lambda.pm - Module used in configuration tests + +=cut + +package init::lambda; +use strict; +use warnings; + +use base qw(Parrot::Configure::Step::Base); + +use Parrot::Configure::Step; + +sub _init { + my $self = shift; + my %data; + $data{description} = undef; + $data{args} = [ qw( ) ]; + $data{result} = q{}; + return \%data; +} + +sub runstep { + my ( $self, $conf ) = @_; + return 1; +} + +1; + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4:
Property changes on: t/configure/testlib/init/lambda.pm ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Index: t/configure/059-silent.t =================================================================== --- t/configure/059-silent.t (revision 0) +++ t/configure/059-silent.t (revision 0) @@ -0,0 +1,108 @@ +#! perl +# Copyright (C) 2007, The Perl Foundation. +# $Id$ +# 059-silent.t + +use strict; +use warnings; + +use Test::More tests => 13; +use Carp; +use lib qw( lib t/configure/testlib ); +use Parrot::Configure; +use Parrot::Configure::Options qw( process_options ); +use Parrot::IO::Capture::Mini; + +$| = 1; +is( $|, 1, "output autoflush is set" ); + +my $args = process_options( + { + argv => [ q{--silent} ], + mode => q{configure}, + } +); +ok( defined $args, "process_options returned successfully" ); +my %args = %$args; + +my $conf = Parrot::Configure->new; +ok( defined $conf, "Parrot::Configure->new() returned okay" ); + +my $step = q{init::gamma}; +my $description = 'Determining if your computer does gamma'; + +$conf->add_steps($step); +my @confsteps = @{ $conf->steps }; +isnt( scalar @confsteps, 0, + "Parrot::Configure object 'steps' key holds non-empty array reference" ); +is( scalar @confsteps, 1, "Parrot::Configure object 'steps' key holds ref to 1-element array" ); +my $nontaskcount = 0; +foreach my $k (@confsteps) { + $nontaskcount++ unless $k->isa("Parrot::Configure::Task"); +} +is( $nontaskcount, 0, "Each step is a Parrot::Configure::Task object" ); +is( $confsteps[0]->step, $step, "'step' element of Parrot::Configure::Task struct identified" ); +is( ref( $confsteps[0]->params ), + 'ARRAY', "'params' element of Parrot::Configure::Task struct is array ref" ); +ok( !ref( $confsteps[0]->object ), + "'object' element of Parrot::Configure::Task struct is not yet a ref" ); + +$conf->options->set(%args); +is( $conf->options->{c}->{debugging}, + 1, "command-line option '--debugging' has been stored in object" ); + +my $errstr; +{ + my $rv; + my ( $tie, @lines ); + $tie = tie *STDOUT, "Parrot::IO::Capture::Mini" + or croak "Unable to tie"; + local $SIG{__WARN__} = \&_capture; + eval { $rv = $conf->runsteps; }; + @lines = $tie->READLINE; + ok(! @lines, "silent option worked"); + like( + $errstr, + qr/step $step died during execution: Dying gamma just to see what happens/, + "Got expected error message despite silent option" + ); +} +untie *STDOUT; + +pass("Completed all tests in $0"); + +sub _capture { $errstr = $_[0]; } + +################### DOCUMENTATION ################### + +=head1 NAME + +060-silent.t - test what happens when the C<--silent> option is set + +=head1 SYNOPSIS + + % prove t/configure/059-silent.t + +=head1 DESCRIPTION + +The files in this directory test functionality used by F<Configure.pl>. + +The tests in this file examine what happens when your configuration step dies +during execution but the C<--silent> option has been set. + +=head1 AUTHOR + +James E Keenan + +=head1 SEE ALSO + +Parrot::Configure, 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/059-silent.t ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Index: t/configure/060-silent.t =================================================================== --- t/configure/060-silent.t (revision 0) +++ t/configure/060-silent.t (revision 0) @@ -0,0 +1,99 @@ +#! perl +# Copyright (C) 2007, The Perl Foundation. +# $Id$ +# 060-silent.t + +use strict; +use warnings; + +use Test::More tests => 12; +use Carp; +use lib qw( lib t/configure/testlib ); +use Parrot::Configure; +use Parrot::Configure::Options qw( process_options ); +use Parrot::IO::Capture::Mini; + +$| = 1; +is( $|, 1, "output autoflush is set" ); + +my $args = process_options( + { + argv => [ q{--silent} ], + mode => q{configure}, + } +); +ok( defined $args, "process_options returned successfully" ); +my %args = %$args; + +my $conf = Parrot::Configure->new; +ok( defined $conf, "Parrot::Configure->new() returned okay" ); + +my $step = q{init::lambda}; +my $description = 'Determining if your computer does lambda'; + +$conf->add_steps($step); +my @confsteps = @{ $conf->steps }; +isnt( scalar @confsteps, 0, + "Parrot::Configure object 'steps' key holds non-empty array reference" ); +is( scalar @confsteps, 1, "Parrot::Configure object 'steps' key holds ref to 1-element array" ); +my $nontaskcount = 0; +foreach my $k (@confsteps) { + $nontaskcount++ unless $k->isa("Parrot::Configure::Task"); +} +is( $nontaskcount, 0, "Each step is a Parrot::Configure::Task object" ); +is( $confsteps[0]->step, $step, "'step' element of Parrot::Configure::Task struct identified" ); +is( ref( $confsteps[0]->params ), + 'ARRAY', "'params' element of Parrot::Configure::Task struct is array ref" ); +ok( !ref( $confsteps[0]->object ), + "'object' element of Parrot::Configure::Task struct is not yet a ref" ); + +$conf->options->set(%args); +is( $conf->options->{c}->{debugging}, + 1, "command-line option '--debugging' has been stored in object" ); + +{ + my $rv; + my ( $tie, @lines ); + $tie = tie *STDOUT, "Parrot::IO::Capture::Mini" + or croak "Unable to tie"; + $rv = $conf->runsteps; + @lines = $tie->READLINE; + ok(! @lines, "silent option worked"); +} +untie *STDOUT; + +pass("Completed all tests in $0"); + +################### DOCUMENTATION ################### + +=head1 NAME + +060-silent.t - test what happens when the C<--silent> option is set + +=head1 SYNOPSIS + + % prove t/configure/060-silent.t + +=head1 DESCRIPTION + +The files in this directory test functionality used by F<Configure.pl>. + +The tests in this file examine what happens when your configuration step +succeeds but the C<--silent> option has been set. + +=head1 AUTHOR + +James E Keenan + +=head1 SEE ALSO + +Parrot::Configure, 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/060-silent.t ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native