Please evaluate the patch attached which submits 4 test files to test
config/init/optimize.pm. Full test coverage has been achieved in the
reconfigure/ branch, where these tests were developed.
As always, reports from OSes other than Darwin and Linux would be
appreciated. Thank you very much.
kid51
Index: MANIFEST
===================================================================
--- MANIFEST (revision 21084)
+++ MANIFEST (working copy)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Tue Sep 4 15:46:48 2007 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Wed Sep 5 02:51:25 2007 UT
#
# See tools/dev/install_files.pl for documentation on the
# format of this file.
@@ -2925,6 +2925,10 @@
t/configure/106-init_headers.t []
t/configure/107-inter_progs.01.t []
t/configure/107-inter_progs.02.t []
+t/configure/113-init_optimize.01.t []
+t/configure/113-init_optimize.02.t []
+t/configure/113-init_optimize.03.t []
+t/configure/113-init_optimize.04.t []
t/configure/testlib/Make_VERSION_File.pm []
t/configure/testlib/Tie/Filehandle/Preempt/Stdin.pm []
t/configure/testlib/init/alpha.pm []
Index: t/configure/113-init_optimize.01.t
===================================================================
--- t/configure/113-init_optimize.01.t (revision 0)
+++ t/configure/113-init_optimize.01.t (revision 0)
@@ -0,0 +1,85 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 113-init_optimize.01.t
+
+use strict;
+use warnings;
+use Test::More tests => 11;
+use Carp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
+use_ok('config::init::optimize');
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw( test_step_thru_runstep);
+
+=for hints_for_testing Check latest reports of Parrot configuration
+tools testing coverage to see where your time available for writing
+tests is spent. You may need to create some dummy optimizations to
+boost test coverage. Note the comment in POD: "Should this be part of
+config/inter/progs.pm?" Also note the reference to
+http://rt.perl.org/rt3//Ticket/Display.html?id=43151.
+
+=cut
+
+my $args = process_options( {
+ argv => [],
+ mode => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, @step_params, $step, $ret);
+my $pkg = q{init::optimize};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$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");
+
+$ret = $step->runstep($conf);
+ok(defined $ret, "$step_name runstep() returned defined value");
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+113-init_optimize.01.t - test config::init::optimize
+
+=head1 SYNOPSIS
+
+ % prove t/configure/113-init_optimize.01.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::init::optimize.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::init::optimize, 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/113-init_optimize.01.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: t/configure/113-init_optimize.02.t
===================================================================
--- t/configure/113-init_optimize.02.t (revision 0)
+++ t/configure/113-init_optimize.02.t (revision 0)
@@ -0,0 +1,77 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 113-init_optimize.02.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::init::optimize');
+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{--optimize} ],
+ mode => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, @step_params, $step, $ret);
+my $pkg = q{init::optimize};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$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");
+
+$ret = $step->runstep($conf);
+ok(defined $ret, "$step_name runstep() returned defined value");
+
+pass("Keep Devel::Cover happy");
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+113-init_optimize.02.t - test config::init::optimize
+
+=head1 SYNOPSIS
+
+ % prove t/configure/113-init_optimize.02.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::init::optimize.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::init::optimize, 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/113-init_optimize.02.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: t/configure/113-init_optimize.03.t
===================================================================
--- t/configure/113-init_optimize.03.t (revision 0)
+++ t/configure/113-init_optimize.03.t (revision 0)
@@ -0,0 +1,98 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 113-init_optimize.03.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::init::optimize');
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw( test_step_thru_runstep);
+use Parrot::IO::Capture::Mini;
+
+=for hints_for_testing Check latest reports of Parrot configuration
+tools testing coverage to see where your time available for writing
+tests is spent. You may need to create some dummy optimizations to
+boost test coverage. Note the comment in POD: "Should this be part of
+config/inter/progs.pm?" Also note the reference to
+http://rt.perl.org/rt3//Ticket/Display.html?id=43151.
+
+=cut
+
+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 ($task, $step_name, @step_params, $step, $ret);
+my $pkg = q{init::optimize};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$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");
+
+# need to capture the --verbose output,
+# because the fact that it does not end
+# in a newline confuses Test::Harness
+{
+ my $tie_out = tie *STDOUT, "Parrot::IO::Capture::Mini"
+ or croak "Unable to tie";
+ $ret = $step->runstep($conf);
+ ok(defined $ret, "$step_name runstep() returned defined value");
+ my @more_lines = $tie_out->READLINE;
+ ok(@more_lines, "verbose output: hints were captured");
+}
+untie *STDOUT;
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+113-init_optimize.03.t - test config::init::optimize
+
+=head1 SYNOPSIS
+
+ % prove t/configure/113-init_optimize.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::init::optimize in the case where C<--optimize> was not requested
+on the command-line but C<--verbose> was.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::init::optimize, 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/113-init_optimize.03.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: t/configure/113-init_optimize.04.t
===================================================================
--- t/configure/113-init_optimize.04.t (revision 0)
+++ t/configure/113-init_optimize.04.t (revision 0)
@@ -0,0 +1,79 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 113-init_optimize.04.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::init::optimize');
+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{--optimize=O2} ],
+ mode => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, @step_params, $step, $ret);
+my $pkg = q{init::optimize};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$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");
+
+$ret = $step->runstep($conf);
+ok(defined $ret, "$step_name runstep() returned defined value");
+
+pass("Keep Devel::Cover happy");
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+113-init_optimize.04.t - test config::init::optimize
+
+=head1 SYNOPSIS
+
+ % prove t/configure/113-init_optimize.04.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::init::optimize in the case where a specific optimization is
+passed as the value of C<--optimize>.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::init::optimize, 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/113-init_optimize.04.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native