Please review patch attached, which provides --fatal and --fatal-step
options.
Index: MANIFEST
===================================================================
--- MANIFEST (revision 22201)
+++ MANIFEST (working copy)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Thu Oct 18 00:43:31 2007 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Thu Oct 18 02:54:19 2007 UT
#
# See tools/dev/install_files.pl for documentation on the
# format of this file.
@@ -2953,6 +2953,15 @@
t/configure/037-run_single_step.t []
t/configure/038-run_single_step.t []
t/configure/039-slurp_file.t []
+t/configure/050-fatal.t []
+t/configure/051-fatal_step.t []
+t/configure/052-fatal_step.t []
+t/configure/053-fatal_step.t []
+t/configure/054-fatal_step.t []
+t/configure/055-fatal_step.t []
+t/configure/056-fatal_step.t []
+t/configure/057-fatal_step.t []
+t/configure/058-fatal_step.t []
t/configure/101-init_manifest-01.t []
t/configure/101-init_manifest-02.t []
t/configure/102-init_defaults-01.t []
Index: lib/Parrot/Configure/Options/Conf.pm
===================================================================
--- lib/Parrot/Configure/Options/Conf.pm (revision 22201)
+++ lib/Parrot/Configure/Options/Conf.pm (working copy)
@@ -29,6 +29,8 @@
define
exec-prefix
execcapable
+ fatal
+ fatal-step
floatval
gc
help
@@ -82,10 +84,10 @@
our $parrot_version = Parrot::BuildUtil::parrot_version();
our $svnid = '$Id$',
- my %short_circuits = (
+my %short_circuits = (
help => \&print_help,
version => \&print_version,
- );
+);
our %options_components = (
'valid_options' => [EMAIL PROTECTED],
@@ -122,6 +124,10 @@
--verbose=2 Output every setting change
--verbose-step=N Set verbose for step N only
--verbose-step=regex Set verbose for step matching description
+ --fatal Failure of any configuration step will cause
+ Configure.pl to halt
+ --fatal-step Comma-delimited string of configuration steps
+ which upon failure cause Configure.pl to halt
--nomanicheck Don't check the MANIFEST
--step=(gen::languages)
Execute a single configure step
Index: lib/Parrot/Configure.pm
===================================================================
--- lib/Parrot/Configure.pm (revision 22201)
+++ lib/Parrot/Configure.pm (working copy)
@@ -221,9 +221,36 @@
my $conf = shift;
my $n = 0; # step number
- my ( $verbose, $verbose_step, $ask ) = $conf->options->get(qw( verbose
verbose-step ask ));
+ my ( $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 = ();
+ # If the --fatal option is true, then all config steps are mapped into
+ # %steps_to_die_for and there is no consideration of --fatal-step.
+ if ($fatal) {
+ %steps_to_die_for = map {$_, 1} @{ $conf->{list_of_steps} };
+ }
+ # We make certain that argument to --fatal-step is a comma-delimited
+ # string of configuration steps, each of which is a string delimited by
+ # two colons, the first half of which is one of init|inter|auto|gen
+ # (This will be modified to take a step sequence number.)
+ elsif ( defined ( $fatal_step ) ) {
+ %steps_to_die_for = $conf->_handle_fatal_step_option( $fatal_step );
+ }
+ else {
+ # No action needed; this is the default case where no step is fatal
+ }
+
foreach my $task ( $conf->steps ) {
+ my $red_flag;
+ my $step_name = $task->step;
+ if ( scalar ( keys ( %steps_to_die_for ) ) ) {
+ if ( $steps_to_die_for{$step_name} ) {
+ $red_flag++;
+ }
+ }
+
$n++;
my $rv = $conf->_run_this_step(
{
@@ -234,10 +261,51 @@
n => $n,
}
);
+ if ( ! defined $rv ) {
+ if ( $red_flag ) {
+ return;
+ } else {
+ $conf->{log}->[$n] = {
+ step => $step_name,
+ };
+ }
+ }
}
return 1;
}
+sub _handle_fatal_step_option {
+ my $conf = shift;
+ my ($fatal_step) = @_;
+ my %steps_to_die_for = ();
+ my $named_step_pattern = qr/(?:init|inter|auto|gen)::[a-z]+/;
+ my $unit_step_pattern = qr/\d+|$named_step_pattern/;
+ if ( $fatal_step =~ /^
+ $unit_step_pattern
+ (, $unit_step_pattern)*
+ $/x
+ ) {
+ my @fatal_steps = split /,/, $fatal_step;
+ for my $s (@fatal_steps) {
+ if ($s =~ /^\d+$/) {
+ die "No configuration step corresponding to $fatal_step"
+ unless defined $conf->{list_of_steps}->[$s - 1];
+ my $step_name = $conf->{list_of_steps}->[$s - 1];
+ if ($step_name =~ /$named_step_pattern/) {
+ $steps_to_die_for{$step_name}++;
+ } else {
+ die "Configuration step corresponding to $s is invalid";
+ }
+ } else {
+ $steps_to_die_for{$s}++;
+ }
+ }
+ } else {
+ die "Argument to 'fatal-step' option must be comma-delimited string of
valid configuration steps or configuration step sequence numbers";
+ }
+ return %steps_to_die_for;
+}
+
=item * C<run_single_step()>
The invoking L<Parrot::Configure> object is passed as the first argument to
@@ -252,7 +320,8 @@
my $conf = shift;
my $taskname = shift;
- my ( $verbose, $verbose_step, $ask ) = $conf->options->get(qw( verbose
verbose-step ask ));
+ my ( $verbose, $verbose_step, $ask ) =
+ $conf->options->get(qw( verbose verbose-step ask ));
my $task = ( $conf->steps() )[0];
if ( $task->{"Parrot::Configure::Task::step"} eq $taskname ) {
@@ -337,10 +406,11 @@
# 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) {
+ if ( $ret ) {
_finish_printing_result(
{
step => $step,
+ step_name => $step_name,
args => $args,
description => $step->description,
}
Index: Configure.pl
===================================================================
--- Configure.pl (revision 22201)
+++ Configure.pl (working copy)
@@ -44,6 +44,15 @@
Run C<--verbose=2> for step number C<N> or matching description.
+=item C<--fatal>
+
+Tells Configure.pl to halt completely if any configuration step fails.
+
+=item C<--fatal-step={init::alpha,inter::beta,auto::gamma}>
+
+Tells Configure.pl to halt completely if any configuration step in
+comma-delimited string individually fails.
+
=item C<--nomanicheck>
Tells Configure.pl not to run the MANIFEST check.
@@ -343,9 +352,10 @@
# as command-line option
$opttest->run_build_tests();
+my $make = $conf->data->get('make');
# from Parrot::Configure::Messages
-print_conclusion( $conf->data->get('make') );
-exit(0);
+my $rv = print_conclusion( $conf, $make );
+exit($rv);
################### DOCUMENTATION ###################
Index: t/configure/054-fatal_step.t
===================================================================
--- t/configure/054-fatal_step.t (revision 0)
+++ t/configure/054-fatal_step.t (revision 0)
@@ -0,0 +1,104 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 054-fatal_step.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 => [ qw( --fatal-step=init::alpha ) ],
+ 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::kappa};
+my $description = 'Determining if your computer does kappa';
+
+$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($rv, "runsteps() returned true value");
+my $bigmsg = join q{}, @lines;
+like(
+ $bigmsg,
+ qr/$description\.\.\./s,
+ "Got STDOUT message expected upon running $step"
+);
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+054-fatal_step.t - test bad step failure case in Parrot::Configure
+
+=head1 SYNOPSIS
+
+ % prove t/configure/054-fatal_step.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file examine what happens when a valid value is specified
for the C<--fatal-step> but a different configuration step is run.
+
+=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/054-fatal_step.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: t/configure/058-fatal_step.t
===================================================================
--- t/configure/058-fatal_step.t (revision 0)
+++ t/configure/058-fatal_step.t (revision 0)
@@ -0,0 +1,95 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 058-fatal_step.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 $s = 1;
+my $args = process_options(
+ {
+ argv => [ qq{--fatal-step=$s} ],
+ 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{foo::zeta};
+my $description = 'Determining if your computer does zeta';
+
+$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;
+eval { $rv = $conf->runsteps; };
+like($@, qr/^Configuration step corresponding to $s is invalid/,
+ "Got expected error message when value to --fatal-step option was
misspecified");
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+058-fatal_step.t - test bad step failure case in Parrot::Configure
+
+=head1 SYNOPSIS
+
+ % prove t/configure/058-fatal_step.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file examine what happens when you misspecify the value for
+the C<--fatal-step> option.
+
+=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/058-fatal_step.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: t/configure/051-fatal_step.t
===================================================================
--- t/configure/051-fatal_step.t (revision 0)
+++ t/configure/051-fatal_step.t (revision 0)
@@ -0,0 +1,120 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 051-fatal_step.t
+
+use strict;
+use warnings;
+
+use Test::More tests => 14;
+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 => [ qw( --fatal-step=init::zeta ) ],
+ 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::zeta};
+my $description = 'Determining if your computer does zeta';
+
+$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 );
+my ( $errtie, @errlines );
+{
+ $tie = tie *STDOUT, "Parrot::IO::Capture::Mini"
+ or croak "Unable to tie";
+ $errtie = tie *STDERR, "Parrot::IO::Capture::Mini"
+ or croak "Unable to tie";
+ $rv = $conf->runsteps;
+ @lines = $tie->READLINE;
+ @errlines = $errtie->READLINE;
+ $tie = undef;
+ $errtie = undef;
+}
+untie *STDOUT;
+untie *STDERR;
+ok(! defined $rv, 'runsteps() returned undef');
+my $bigmsg = join q{}, @lines;
+like(
+ $bigmsg,
+ qr/$description\.\.\./s,
+ "Got STDOUT message expected upon running $step"
+);
+my $errbigmsg = join q{}, @errlines;
+like(
+ $errbigmsg,
+ qr/step $step failed:/s,
+ "Got STDERR message expected upon running $step"
+);
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+051-fatal_step.t - test bad step failure case in Parrot::Configure
+
+=head1 SYNOPSIS
+
+ % prove t/configure/051-fatal_step.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file examine what happens when you set the C<--fatal-step>
+option for a single configuration step and that step returns an undefined
+value.
+
+=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/051-fatal_step.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: t/configure/050-fatal.t
===================================================================
--- t/configure/050-fatal.t (revision 0)
+++ t/configure/050-fatal.t (revision 0)
@@ -0,0 +1,90 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 050-fatal.t
+
+use strict;
+use warnings;
+
+use Test::More tests => 6;
+use Carp;
+use lib qw( lib t/configure/testlib );
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Step::List qw( get_steps_list );
+use Parrot::IO::Capture::Mini;
+
+$| = 1;
+is($|, 1, "output autoflush is set");
+
+my $args = process_options( {
+ argv => [ q{--fatal} ],
+ 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 $first_step = q{init::zeta};
+my $description = 'Determining if your computer does zeta';
+
+$conf->add_steps( $first_step, get_steps_list() );
+
+$conf->options->set(%args);
+is($conf->options->{c}->{debugging}, 1,
+ "command-line option '--debugging' has been stored in object");
+
+my $rv;
+my (@lines, @errlines);
+{
+ my ($tie, $errtie);
+ $tie = tie *STDOUT, "Parrot::IO::Capture::Mini"
+ or croak "Unable to tie";
+ $errtie = tie *STDERR, "Parrot::IO::Capture::Mini"
+ or croak "Unable to tie";
+ $rv = $conf->runsteps;
+ @lines = $tie->READLINE;
+ @errlines = $errtie->READLINE;
+}
+untie *STDOUT;
+untie *STDERR;
+
+ok(! defined $rv, "runsteps returned undefined value as expected");
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+050-fatal.t - see what happens when C<--fatal-step> is set for all
configuration steps
+
+=head1 SYNOPSIS
+
+ % prove t/configure/050-fatal.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file examine what happens when you require the failure of
+any configuration step to cause all configuration to cease.
+
+=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/050-fatal.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: t/configure/055-fatal_step.t
===================================================================
--- t/configure/055-fatal_step.t (revision 0)
+++ t/configure/055-fatal_step.t (revision 0)
@@ -0,0 +1,120 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 055-fatal_step.t
+
+use strict;
+use warnings;
+
+use Test::More tests => 14;
+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 => [ qw( --fatal-step=1 ) ],
+ 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::zeta};
+my $description = 'Determining if your computer does zeta';
+
+$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 );
+my ( $errtie, @errlines );
+{
+ $tie = tie *STDOUT, "Parrot::IO::Capture::Mini"
+ or croak "Unable to tie";
+ $errtie = tie *STDERR, "Parrot::IO::Capture::Mini"
+ or croak "Unable to tie";
+ $rv = $conf->runsteps;
+ @lines = $tie->READLINE;
+ @errlines = $errtie->READLINE;
+ $tie = undef;
+ $errtie = undef;
+}
+untie *STDOUT;
+untie *STDERR;
+ok(! defined $rv, 'runsteps() returned undef');
+my $bigmsg = join q{}, @lines;
+like(
+ $bigmsg,
+ qr/$description\.\.\./s,
+ "Got STDOUT message expected upon running $step"
+);
+my $errbigmsg = join q{}, @errlines;
+like(
+ $errbigmsg,
+ qr/step $step failed:/s,
+ "Got STDERR message expected upon running $step"
+);
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+055-fatal_step.t - test bad step failure case in Parrot::Configure
+
+=head1 SYNOPSIS
+
+ % prove t/configure/055-fatal_step.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file examine what happens when you set the C<--fatal-step>
+option for a single configuration step via s configuration sequence number and
+that step returns an undefined value.
+
+=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/055-fatal_step.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: t/configure/052-fatal_step.t
===================================================================
--- t/configure/052-fatal_step.t (revision 0)
+++ t/configure/052-fatal_step.t (revision 0)
@@ -0,0 +1,120 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 052-fatal_step.t
+
+use strict;
+use warnings;
+
+use Test::More tests => 14;
+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{--fatal-step=init::zeta,init::manifest} ],
+ 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::zeta};
+my $description = 'Determining if your computer does zeta';
+
+$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 );
+my ( $errtie, @errlines );
+{
+ $tie = tie *STDOUT, "Parrot::IO::Capture::Mini"
+ or croak "Unable to tie";
+ $errtie = tie *STDERR, "Parrot::IO::Capture::Mini"
+ or croak "Unable to tie";
+ $rv = $conf->runsteps;
+ @lines = $tie->READLINE;
+ @errlines = $errtie->READLINE;
+ $tie = undef;
+ $errtie = undef;
+}
+untie *STDOUT;
+untie *STDERR;
+ok(! defined $rv, 'runsteps() returned undef');
+my $bigmsg = join q{}, @lines;
+like(
+ $bigmsg,
+ qr/$description\.\.\./s,
+ "Got STDOUT message expected upon running $step"
+);
+my $errbigmsg = join q{}, @errlines;
+like(
+ $errbigmsg,
+ qr/step $step failed:/s,
+ "Got STDERR message expected upon running $step"
+);
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+052-fatal_step.t - test bad step failure case in Parrot::Configure
+
+=head1 SYNOPSIS
+
+ % prove t/configure/052-fatal_step.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file examine what happens when you set the C<--fatal-step>
+option for multiple configuration steps and one of those steps returns an
+undefined value.
+
+=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/052-fatal_step.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: t/configure/056-fatal_step.t
===================================================================
--- t/configure/056-fatal_step.t (revision 0)
+++ t/configure/056-fatal_step.t (revision 0)
@@ -0,0 +1,120 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 056-fatal_step.t
+
+use strict;
+use warnings;
+
+use Test::More tests => 14;
+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{--fatal-step=1,init::manifest} ],
+ 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::zeta};
+my $description = 'Determining if your computer does zeta';
+
+$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 );
+my ( $errtie, @errlines );
+{
+ $tie = tie *STDOUT, "Parrot::IO::Capture::Mini"
+ or croak "Unable to tie";
+ $errtie = tie *STDERR, "Parrot::IO::Capture::Mini"
+ or croak "Unable to tie";
+ $rv = $conf->runsteps;
+ @lines = $tie->READLINE;
+ @errlines = $errtie->READLINE;
+ $tie = undef;
+ $errtie = undef;
+}
+untie *STDOUT;
+untie *STDERR;
+ok(! defined $rv, 'runsteps() returned undef');
+my $bigmsg = join q{}, @lines;
+like(
+ $bigmsg,
+ qr/$description\.\.\./s,
+ "Got STDOUT message expected upon running $step"
+);
+my $errbigmsg = join q{}, @errlines;
+like(
+ $errbigmsg,
+ qr/step $step failed:/s,
+ "Got STDERR message expected upon running $step"
+);
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+056-fatal_step.t - test bad step failure case in Parrot::Configure
+
+=head1 SYNOPSIS
+
+ % prove t/configure/056-fatal_step.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file examine what happens when you set the C<--fatal-step>
+option for multiple configuration steps (some via step sequence number) and
+one of those steps returns an undefined value.
+
+=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/056-fatal_step.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: t/configure/053-fatal_step.t
===================================================================
--- t/configure/053-fatal_step.t (revision 0)
+++ t/configure/053-fatal_step.t (revision 0)
@@ -0,0 +1,95 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 053-fatal_step.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 => [ qw( --fatal-step=foo::zeta ) ],
+ 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{foo::zeta};
+my $description = 'Determining if your computer does zeta';
+
+$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;
+eval { $rv = $conf->runsteps; };
+like($@, qr/^Argument to 'fatal-step' option/,
+ "Got expected error message when value to --fatal-step option was
misspecified");
+
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+053-fatal_step.t - test bad step failure case in Parrot::Configure
+
+=head1 SYNOPSIS
+
+ % prove t/configure/053-fatal_step.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file examine what happens when you misspecify the value for
+the C<--fatal-step> option.
+
+=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/053-fatal_step.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: t/configure/057-fatal_step.t
===================================================================
--- t/configure/057-fatal_step.t (revision 0)
+++ t/configure/057-fatal_step.t (revision 0)
@@ -0,0 +1,95 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 057-fatal_step.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 $fatal_step_sequence_number = 1079;
+my $args = process_options(
+ {
+ argv => [ qq{--fatal-step=$fatal_step_sequence_number} ],
+ 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::zeta};
+my $description = 'Determining if your computer does zeta';
+
+$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;
+eval { $rv = $conf->runsteps; };
+like($@, qr/^No configuration step corresponding to
$fatal_step_sequence_number/,
+ "Got expected error message when value to --fatal-step option was
misspecified");
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+057-fatal_step.t - test bad step failure case in Parrot::Configure
+
+=head1 SYNOPSIS
+
+ % prove t/configure/057-fatal_step.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file examine what happens when you misspecify the value for
+the C<--fatal-step> option.
+
+=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/057-fatal_step.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native