Author: jkeenan
Date: Sun Jul 27 06:43:51 2008
New Revision: 29794
Modified:
branches/parallel/t/steps/auto_arch-01.t
branches/parallel/t/steps/init_defaults-01.t
branches/parallel/t/steps/init_headers-01.t
branches/parallel/t/steps/init_hints-01.t
branches/parallel/t/steps/init_install-01.t
branches/parallel/t/steps/init_manifest-01.t
branches/parallel/t/steps/init_miniparrot-01.t
branches/parallel/t/steps/inter_progs-01.t
Log:
[configure] Fine-tuning of tests for configuration steps. Clarify POD.
Provide inline comments functioning as subheads where tests previously found
in multiple files have been moved into a single file. Use
Parrot::Configure::Test::test_step_constructor_and_description() to eliminate
repeated code. Delete outdated comments.
Modified: branches/parallel/t/steps/auto_arch-01.t
==============================================================================
--- branches/parallel/t/steps/auto_arch-01.t (original)
+++ branches/parallel/t/steps/auto_arch-01.t Sun Jul 27 06:43:51 2008
@@ -14,7 +14,6 @@
use Parrot::Configure::Options qw( process_options );
use Parrot::Configure::Test qw(
test_step_thru_runstep
- rerun_defaults_for_testing
test_step_constructor_and_description
);
use IO::CaptureOutput qw| capture |;
Modified: branches/parallel/t/steps/init_defaults-01.t
==============================================================================
--- branches/parallel/t/steps/init_defaults-01.t (original)
+++ branches/parallel/t/steps/init_defaults-01.t Sun Jul 27 06:43:51 2008
@@ -5,7 +5,7 @@
use strict;
use warnings;
-use Test::More tests => 36;
+use Test::More tests => 39;
use Carp;
use Cwd;
use File::Copy;
@@ -16,19 +16,16 @@
use Parrot::Configure::Step;
use Parrot::Configure::Options qw( process_options );
use base qw(Parrot::Configure::Step);
+use Parrot::Configure::Test qw(
+ test_step_constructor_and_description
+);
+
+########## no debugging; profile; m 32 ##########
my $pkg = q{init::defaults};
my $args = process_options(
{
argv => [ q{--debugging=0}, q{--profile}, q{--m=32} ],
-
- # These 3 options are non-default and inside
- # init::defaults::runsteps() they create what, from a
- # testing coverage perspective, create branches or
- # conditions. The regular run of Configure.pl during
- # coverage analysis will cover the default
- # branches/conditions. Hence, we supply the
- # non-default options here to increase coverage.
mode => q{configure},
}
);
@@ -39,29 +36,20 @@
my $serialized = $conf->pcfreeze();
$conf->options->set( %{$args} );
-
-my $task = $conf->steps->[-1];
-my $step_name = $task->step;
-
-my $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 $step = test_step_constructor_and_description($conf);
my $ret = $step->runstep($conf);
-ok( defined $ret, "$step_name runstep() returned defined value" );
-
-# RT#44451: Write a SKIP block which will test the one OS-specific branch in
-# init::defaults.
+ok( defined $ret, "runstep() returned defined value" );
$conf->replenish($serialized);
-# DEVELOPING non-existence is faked by working in a tempdir which lacks it
+########## mock absence of 'DEVELOPING' ##########
my $cwd = cwd();
{
my $tdir = tempdir( CLEANUP => 1 );
ok( chdir $tdir, "Changed to temporary directory for testing" );
- ok( copy( "$cwd/VERSION", "$tdir/VERSION" ), "Able to copy VERSION for
testing" );
+ ok( copy( "$cwd/VERSION", "$tdir/VERSION" ),
+ "Able to copy VERSION for testing" );
my $pkg = q{init::defaults};
my $args = process_options(
@@ -71,16 +59,10 @@
}
);
$conf->options->set( %{$args} );
-
- my $task = $conf->steps->[-1];
- my $step_name = $task->step;
-
- my $step = $step_name->new();
- ok( defined $step, "$step_name constructor returned defined value" );
- isa_ok( $step, $step_name );
+ my $step = test_step_constructor_and_description($conf);
my $ret = $step->runstep($conf);
- ok( defined $ret, "$step_name runstep() returned defined value" );
+ ok( defined $ret, "runstep() returned defined value" );
unlink "$tdir/VERSION"
or croak "Unable to unlink file from tempdir after testing";
@@ -89,6 +71,8 @@
$conf->replenish($serialized);
+########## m 32 ##########
+
$args = process_options(
{
argv => [ q{--m=32} ],
@@ -97,13 +81,7 @@
);
$conf->options->set( %{$args} );
-
-$task = $conf->steps->[-1];
-$step_name = $task->step;
-
-$step = $step_name->new();
-ok( defined $step, "$step_name constructor returned defined value" );
-isa_ok( $step, $step_name );
+$step = test_step_constructor_and_description($conf);
$conf->data->set( archname => 'x86_64' );
$conf->data->set( cc => 'cc' );
@@ -132,6 +110,8 @@
$conf->replenish($serialized);
+########## regular ##########
+
$args = process_options(
{
argv => [ ],
@@ -140,14 +120,7 @@
);
$conf->options->set( %{$args} );
-
-$task = $conf->steps->[-1];
-$step_name = $task->step;
-
-$step = $step_name->new();
-ok( defined $step, "$step_name constructor returned defined value" );
-isa_ok( $step, $step_name );
-
+$step = test_step_constructor_and_description($conf);
$conf->data->set( archname => 'x86_64' );
$conf->data->set( cc => 'cc' );
@@ -173,6 +146,7 @@
"Got expected value for 'ldflags'");
is($conf->data->get( 'linkflags' ), '-bundle -L/usr/local/lib64',
"Got expected value for 'linkflags'");
+
pass("Completed all tests in $0");
################### DOCUMENTATION ###################
@@ -189,7 +163,7 @@
The files in this directory test functionality used by F<Configure.pl>.
-The tests in this file test subroutines exported by config::init::defaults.
+The tests in this file test init::defaults.
=head1 AUTHOR
Modified: branches/parallel/t/steps/init_headers-01.t
==============================================================================
--- branches/parallel/t/steps/init_headers-01.t (original)
+++ branches/parallel/t/steps/init_headers-01.t Sun Jul 27 06:43:51 2008
@@ -65,7 +65,7 @@
=head1 NAME
-init_headers-01.t - test config::init::headers
+init_headers-01.t - test init::headers
=head1 SYNOPSIS
@@ -75,7 +75,7 @@
The files in this directory test functionality used by F<Configure.pl>.
-The tests in this file test subroutines exported by config::init::headers.
+The tests in this file test init::headers.
=head1 AUTHOR
Modified: branches/parallel/t/steps/init_hints-01.t
==============================================================================
--- branches/parallel/t/steps/init_hints-01.t (original)
+++ branches/parallel/t/steps/init_hints-01.t Sun Jul 27 06:43:51 2008
@@ -5,7 +5,7 @@
use strict;
use warnings;
-use Test::More tests => 23;
+use Test::More tests => 26;
use Carp;
use Cwd;
use File::Path ();
@@ -16,9 +16,14 @@
use_ok('config::init::hints');
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
-use Parrot::Configure::Test qw( test_step_thru_runstep);
+use Parrot::Configure::Test qw(
+ test_step_thru_runstep
+ test_step_constructor_and_description
+);
use IO::CaptureOutput qw | capture |;
+########## verbose ##########
+
my $args = process_options(
{
argv => [q{--verbose}],
@@ -30,7 +35,6 @@
test_step_thru_runstep( $conf, q{init::defaults}, $args );
-my ( $task, $step_name, $step, $ret );
my $pkg = q{init::hints};
$conf->add_steps($pkg);
@@ -38,14 +42,7 @@
my $serialized = $conf->pcfreeze();
$conf->options->set( %{$args} );
-
-$task = $conf->steps->[-1];
-$step_name = $task->step;
-
-$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 $step = test_step_constructor_and_description($conf);
# need to capture the --verbose output, because the fact that it does not end
# in a newline confuses Test::Harness
@@ -54,11 +51,13 @@
my $stdout;
capture ( sub {$rv = $step->runstep($conf)}, \$stdout);
ok( $stdout, "verbose output: hints were captured" );
- ok( defined $rv, "$step_name runstep() returned defined value" );
+ ok( defined $rv, "runstep() returned defined value" );
}
$conf->replenish($serialized);
+########## verbose; local hints directory ##########
+
$args = process_options(
{
argv => [q{--verbose}],
@@ -67,13 +66,7 @@
);
$conf->options->set( %{$args} );
-
-$task = $conf->steps->[-1];
-$step_name = $task->step;
-
-$step = $step_name->new();
-ok( defined $step, "$step_name constructor returned defined value" );
-isa_ok( $step, $step_name );
+$step = test_step_constructor_and_description($conf);
my $cwd = cwd();
{
@@ -94,21 +87,20 @@
close $FH or croak "Unable to close temp file after writing";
unshift( @INC, $tdir );
- # need to capture the --verbose output,
- # because the fact that it does not end
- # in a newline confuses Test::Harness
{
my $rv;
my $stdout;
capture ( sub {$rv = $step->runstep($conf)}, \$stdout);
ok( $stdout, "verbose output: hints were captured" );
- ok( defined $rv, "$step_name runstep() returned defined value" );
+ ok( defined $rv, "runstep() returned defined value" );
}
unlink $localhints or croak "Unable to delete $localhints";
}
$conf->replenish($serialized);
+########## verbose; local hints directory; no runstep() in local hints
##########
+
$args = process_options(
{
argv => [q{--verbose}],
@@ -117,13 +109,7 @@
);
$conf->options->set( %{$args} );
-
-$task = $conf->steps->[-1];
-$step_name = $task->step;
-
-$step = $step_name->new();
-ok( defined $step, "$step_name constructor returned defined value" );
-isa_ok( $step, $step_name );
+$step = test_step_constructor_and_description($conf);
$cwd = cwd();
{
@@ -141,21 +127,20 @@
close $FH or croak "Unable to close temp file after writing";
unshift( @INC, $tdir );
- # need to capture the --verbose output,
- # because the fact that it does not end
- # in a newline confuses Test::Harness
{
my $rv;
my $stdout;
capture ( sub {$rv = $step->runstep($conf)}, \$stdout);
ok( $stdout, "verbose output: hints were captured" );
- ok( defined $rv, "$step_name runstep() returned defined va lue" );
+ ok( defined $rv, "runstep() returned defined value" );
}
unlink $localhints or croak "Unable to delete $localhints";
}
$conf->replenish($serialized);
+########## verbose; imaginary OS ##########
+
$args = process_options(
{
argv => [ q{--verbose} ],
@@ -164,17 +149,9 @@
);
$conf->options->set( %{$args} );
-
-$task = $conf->steps->[-1];
-$step_name = $task->step;
-
-$step = $step_name->new();
-ok( defined $step, "$step_name constructor returned defined value" );
-isa_ok( $step, $step_name );
-
-
+$step = test_step_constructor_and_description($conf);
{
- my ($stdout, $stderr);
+ my ($stdout, $stderr, $ret);
$conf->data->set_p5( OSNAME => q{imaginaryOS} );
my $osname = lc( $conf->data->get_p5( 'OSNAME' ) );
my $hints_file = catfile('config', 'init', 'hints', "$osname.pm");
@@ -189,13 +166,14 @@
"Got expected verbose output when no hints file found"
);
}
+
pass("Completed all tests in $0");
################### DOCUMENTATION ###################
=head1 NAME
-init_hints-01.t - test config::init::hints
+init_hints-01.t - test init::hints
=head1 SYNOPSIS
@@ -205,7 +183,7 @@
The files in this directory test functionality used by F<Configure.pl>.
-The tests in this file test subroutines exported by config::init::hints.
+The tests in this file test init::hints.
=head1 AUTHOR
Modified: branches/parallel/t/steps/init_install-01.t
==============================================================================
--- branches/parallel/t/steps/init_install-01.t (original)
+++ branches/parallel/t/steps/init_install-01.t Sun Jul 27 06:43:51 2008
@@ -12,7 +12,10 @@
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
use_ok('config::init::install');
-use Parrot::Configure::Test qw( test_step_thru_runstep);
+use Parrot::Configure::Test qw(
+ test_step_thru_runstep
+ test_step_constructor_and_description
+);
my $cwd = cwd();
{
@@ -75,20 +78,12 @@
);
my $pkg = q{init::install};
- my ( $task, $step_name, $step, $ret );
-
$conf->add_steps($pkg);
$conf->options->set( %{$args} );
+ my $step = test_step_constructor_and_description($conf);
- $task = $conf->steps->[-1];
- $step_name = $task->step;
-
- $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" );
+ my $ret = $step->runstep($conf);
+ ok( defined $ret, "runstep() returned defined value" );
is( $conf->data->get('prefix'),
$tdir_orig, "--prefix option confirmed; trailing slash stripped" );
@@ -113,7 +108,7 @@
=head1 NAME
-init_install-01.t - test config::init::install
+init_install-01.t - test init::install
=head1 SYNOPSIS
@@ -123,7 +118,7 @@
The files in this directory test functionality used by F<Configure.pl>.
-The tests in this file test subroutines exported by config::init::install.
+The tests in this file test init::install.
=head1 AUTHOR
Modified: branches/parallel/t/steps/init_manifest-01.t
==============================================================================
--- branches/parallel/t/steps/init_manifest-01.t (original)
+++ branches/parallel/t/steps/init_manifest-01.t Sun Jul 27 06:43:51 2008
@@ -16,6 +16,8 @@
use Parrot::Configure::Options qw( process_options );
use IO::CaptureOutput qw | capture |;
+########## no manifest check ##########
+
my $pkg = q{init::manifest};
my $args = process_options(
{
@@ -48,6 +50,8 @@
$conf->replenish($serialized);
+########## mock missing files ##########
+
$args = process_options(
{
argv => [],
@@ -63,8 +67,6 @@
ok( defined $step, "$step_name constructor returned defined value" );
isa_ok( $step, $step_name );
-# Lets see if we can trick ExtUtils::Manifest into thinking there are missing
-# files.
my $cwd = cwd();
{
my $tdir = tempdir( CLEANUP => 1 );
Modified: branches/parallel/t/steps/init_miniparrot-01.t
==============================================================================
--- branches/parallel/t/steps/init_miniparrot-01.t (original)
+++ branches/parallel/t/steps/init_miniparrot-01.t Sun Jul 27 06:43:51 2008
@@ -46,7 +46,7 @@
=head1 NAME
-init_miniparrot-01.t - test config::init::miniparrot
+init_miniparrot-01.t - test init::miniparrot
=head1 SYNOPSIS
@@ -56,7 +56,7 @@
The files in this directory test functionality used by F<Configure.pl>.
-The tests in this file test subroutines exported by config::init::miniparrot.
+The tests in this file test init::miniparrot.
=head1 AUTHOR
Modified: branches/parallel/t/steps/inter_progs-01.t
==============================================================================
--- branches/parallel/t/steps/inter_progs-01.t (original)
+++ branches/parallel/t/steps/inter_progs-01.t Sun Jul 27 06:43:51 2008
@@ -6,7 +6,7 @@
use strict;
use warnings;
-use Test::More tests => 41;
+use Test::More tests => 44;
use Carp;
use lib qw( lib t/configure/testlib );
use_ok('config::init::defaults');
@@ -15,7 +15,10 @@
use_ok('config::inter::progs');
use Parrot::Configure;
use Parrot::Configure::Options qw( process_options );
-use Parrot::Configure::Test qw( test_step_thru_runstep);
+use Parrot::Configure::Test qw(
+ test_step_thru_runstep
+ test_step_constructor_and_description
+);
use Tie::Filehandle::Preempt::Stdin;
use IO::CaptureOutput qw| capture |;
@@ -26,6 +29,8 @@
=cut
+########## ask ##########
+
my $args = process_options(
{
argv => [q{--ask}],
@@ -39,7 +44,6 @@
test_step_thru_runstep( $conf, q{init::install}, $args );
test_step_thru_runstep( $conf, q{init::hints}, $args );
-my ( $task, $step_name, $step, $ret );
my $pkg = q{inter::progs};
$conf->add_steps($pkg);
@@ -47,14 +51,7 @@
my $serialized = $conf->pcfreeze();
$conf->options->set( %{$args} );
-
-$task = $conf->steps->[-1];
-$step_name = $task->step;
-
-$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 $step = test_step_constructor_and_description($conf);
my @prompts;
foreach my $p (
@@ -92,13 +89,15 @@
capture( sub {
$conf = inter::progs::_set_debug_and_warn($conf, $debug);
}, \$stdout);
-ok( defined $conf, "Components of $step_name runstep() tested okay" );
+ok( defined $conf, "Components of runstep() tested okay" );
$object = undef;
untie *STDIN;
$conf->replenish($serialized);
+########## ask; debugging 0 ##########
+
$args = process_options(
{
argv => [ q{--ask}, q{--debugging=0} ],
@@ -107,14 +106,7 @@
);
$conf->options->set( %{$args} );
-
-$task = $conf->steps->[-1];
-$step_name = $task->step;
-
-$step = $step_name->new();
-ok( defined $step, "$step_name constructor returned defined value" );
-isa_ok( $step, $step_name );
-
+$step = test_step_constructor_and_description($conf);
@prompts = ();
foreach my $p (
@@ -151,13 +143,15 @@
capture( sub {
$conf = inter::progs::_set_debug_and_warn($conf, $debug);
}, \$stdout);
-ok( defined $conf, "Components of $step_name runstep() tested okay" );
+ok( defined $conf, "Components of runstep() tested okay" );
$object = undef;
untie *STDIN;
$conf->replenish($serialized);
+########## ask ##########
+
$args = process_options(
{
argv => [q{--ask}],
@@ -166,14 +160,7 @@
);
$conf->options->set( %{$args} );
-
-$task = $conf->steps->[-1];
-$step_name = $task->step;
-
-$step = $step_name->new();
-ok( defined $step, "$step_name constructor returned defined value" );
-isa_ok( $step, $step_name );
-
+$step = test_step_constructor_and_description($conf);
@prompts = ();
foreach my $p (
@@ -197,7 +184,6 @@
can_ok( 'Tie::Filehandle::Preempt::Stdin', ('READLINE') );
isa_ok( $object, 'Tie::Filehandle::Preempt::Stdin' );
-#my ($stdout, $debug, $debug_validity);
capture( sub {
my $verbose = inter::progs::_get_verbose($conf);
my $ask = inter::progs::_prepare_for_interactivity($conf);
@@ -211,13 +197,15 @@
capture( sub {
$conf = inter::progs::_set_debug_and_warn($conf, $debug);
}, \$stdout);
-ok( defined $conf, "Components of $step_name runstep() tested okay" );
+ok( defined $conf, "Components of runstep() tested okay" );
$object = undef;
untie *STDIN;
$conf->replenish($serialized);
+########## ask ##########
+
$args = process_options(
{
argv => [q{--ask}],
@@ -226,14 +214,7 @@
);
$conf->options->set( %{$args} );
-
-$task = $conf->steps->[-1];
-$step_name = $task->step;
-
-$step = $step_name->new();
-ok( defined $step, "$step_name constructor returned defined value" );
-isa_ok( $step, $step_name );
-
+$step = test_step_constructor_and_description($conf);
@prompts = ();
foreach my $p (
@@ -261,7 +242,7 @@
capture( sub {
$rv = $step->runstep($conf);
}, \$stdout);
-ok( ! defined $rv, "$step_name runstep returned undef as expected" );
+ok( ! defined $rv, "runstep returned undef as expected" );
$object = undef;
untie *STDIN;
@@ -272,7 +253,7 @@
=head1 NAME
-inter_progs-01.t - test config::inter::progs
+inter_progs-01.t - test inter::progs
=head1 SYNOPSIS
@@ -282,7 +263,7 @@
The files in this directory test functionality used by F<Configure.pl>.
-The tests in this file test subroutines exported by config::inter::progs.
+The tests in this file test inter::progs.
=head1 AUTHOR