Author: jkeenan
Date: Tue Nov  6 04:15:14 2007
New Revision: 22735

Added:
   trunk/t/configure/136-auto_inline-01.t   (contents, props changed)
   trunk/t/configure/136-auto_inline-02.t   (contents, props changed)
   trunk/t/configure/136-auto_inline-03.t   (contents, props changed)
   trunk/t/configure/136-auto_inline-04.t   (contents, props changed)
   trunk/t/configure/136-auto_inline-05.t   (contents, props changed)
   trunk/t/configure/136-auto_inline-06.t   (contents, props changed)
Removed:
   trunk/t/configure/136-auto_inline.t
Modified:
   trunk/MANIFEST
   trunk/config/auto/inline.pm
   trunk/t/configure/111-auto_gcc-01.t

Log:
config/auto/inline.pm:  Applying patch sumitted in
https://rt.perl.org/rt3/Ticket/Display.html?id=43297.  Unit tests and
slight refactoring to make class more testable.


Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST      (original)
+++ trunk/MANIFEST      Tue Nov  6 04:15:14 2007
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Mon Nov  5 23:56:36 2007 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Tue Nov  6 11:58:21 2007 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -3082,7 +3082,12 @@
 t/configure/133-gen_cpu.t                                   []
 t/configure/134-auto_funcptr.t                              []
 t/configure/135-auto_cgoto-01.t                             []
-t/configure/136-auto_inline.t                               []
+t/configure/136-auto_inline-01.t                            []
+t/configure/136-auto_inline-02.t                            []
+t/configure/136-auto_inline-03.t                            []
+t/configure/136-auto_inline-04.t                            []
+t/configure/136-auto_inline-05.t                            []
+t/configure/136-auto_inline-06.t                            []
 t/configure/137-auto_gc.t                                   []
 t/configure/138-auto_memalign-01.t                          []
 t/configure/139-auto_signal-01.t                            []

Modified: trunk/config/auto/inline.pm
==============================================================================
--- trunk/config/auto/inline.pm (original)
+++ trunk/config/auto/inline.pm Tue Nov  6 04:15:14 2007
@@ -33,42 +33,62 @@
 sub runstep {
     my ( $self, $conf ) = @_;
 
-    my $test;
-    my ( $inline, $verbose ) = $conf->options->get(qw(inline verbose));
-
+    my $inline = $conf->options->get(qw(inline));
     if ( defined $inline ) {
-        $test = $inline;
+        $conf->data->set( inline => $inline );
+        return 1;
     }
-    else {
-        cc_gen('config/auto/inline/test_1.in');
+
+    my $test = $self->_first_probe_for_inline();
+    unless ($test) {
+        $test = $self->_second_probe_for_inline($test);
+    }
+
+    $self->_evaluate_inline($conf, $test);
+    return 1;
+}
+
+sub _first_probe_for_inline {
+    my $self = shift;
+    my $test;
+    cc_gen('config/auto/inline/test_1.in');
+    eval { cc_build(); };
+    if ( !$@ ) {
+        $test = cc_run();
+        chomp $test if $test;
+    }
+    cc_clean();
+    return $test;
+}
+
+sub _second_probe_for_inline {
+    my $self = shift;
+    my $test = shift;
+    if ( !$test ) {
+        cc_gen('config/auto/inline/test_2.in');
         eval { cc_build(); };
         if ( !$@ ) {
             $test = cc_run();
             chomp $test if $test;
         }
         cc_clean();
-        if ( !$test ) {
-            cc_gen('config/auto/inline/test_2.in');
-            eval { cc_build(); };
-            if ( !$@ ) {
-                $test = cc_run();
-                chomp $test if $test;
-            }
-            cc_clean();
-        }
-        if ($test) {
-            print " ($test) " if $verbose;
-            $self->set_result('yes');
-        }
-        else {
-            print " no " if $verbose;
-            $self->set_result('no');
-            $test = '';
-        }
     }
+    return $test;
+}
 
+sub _evaluate_inline {
+    my ($self, $conf, $test) = @_;
+    my $verbose = $conf->options->get(qw(verbose));
+    if ($test) {
+        print " ($test) " if $verbose;
+        $self->set_result('yes');
+    }
+    else {
+        print " no " if $verbose;
+        $self->set_result('no');
+        $test = '';
+    }
     $conf->data->set( inline => $test );
-
     return 1;
 }
 

Modified: trunk/t/configure/111-auto_gcc-01.t
==============================================================================
--- trunk/t/configure/111-auto_gcc-01.t (original)
+++ trunk/t/configure/111-auto_gcc-01.t Tue Nov  6 04:15:14 2007
@@ -5,10 +5,11 @@
 
 use strict;
 use warnings;
-use Test::More tests => 12;
+use Test::More tests => 17;
 use Carp;
 use lib qw( lib t/configure/testlib );
 use_ok('config::init::defaults');
+use_ok('config::inter::progs');
 use_ok('config::auto::gcc');
 use Parrot::Configure;
 use Parrot::Configure::Options qw( process_options );
@@ -22,13 +23,14 @@
 my $conf = Parrot::Configure->new();
 
 test_step_thru_runstep($conf, q{init::defaults}, $args);
+test_step_thru_runstep( $conf, q{inter::progs},  $args );
 
 my ($task, $step_name, @step_params, $step, $ret);
 my $pkg = q{auto::gcc};
 
 $conf->add_steps($pkg);
 $conf->options->set(%{$args});
-$task = $conf->steps->[1];
+$task = $conf->steps->[2];
 $step_name   = $task->step;
 @step_params = @{ $task->params };
 
@@ -37,11 +39,7 @@
 isa_ok($step, $step_name);
 ok($step->description(), "$step_name has description");
 
-TODO: {
-    local $TODO =
-        q{On some systems, tries to link to libgdbm and fails};
-    ok($step->runstep($conf), "runstep returned true value");
-}
+ok($step->runstep($conf), "runstep returned true value");
 
 pass("Keep Devel::Cover happy");
 pass("Completed all tests in $0");

Added: trunk/t/configure/136-auto_inline-01.t
==============================================================================
--- (empty file)
+++ trunk/t/configure/136-auto_inline-01.t      Tue Nov  6 04:15:14 2007
@@ -0,0 +1,80 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 136-auto_inline-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::inline');
+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::inline};
+
+$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" );
+
+pass("Keep Devel::Cover happy");
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+136-auto_inline-01.t - test config::auto::inline
+
+=head1 SYNOPSIS
+
+    % prove t/configure/136-auto_inline-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::auto::inline.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::inline, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Added: trunk/t/configure/136-auto_inline-02.t
==============================================================================
--- (empty file)
+++ trunk/t/configure/136-auto_inline-02.t      Tue Nov  6 04:15:14 2007
@@ -0,0 +1,80 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 136-auto_inline-02.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::auto::inline');
+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{--inline} ],
+        mode => q{configure},
+    }
+);
+
+my $conf = Parrot::Configure->new;
+
+test_step_thru_runstep( $conf, q{init::defaults}, $args );
+
+my $pkg = q{auto::inline};
+
+$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" );
+
+# pass("Keep Devel::Cover happy");
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+136-auto_inline-02.t - test config::auto::inline
+
+=head1 SYNOPSIS
+
+    % prove t/configure/136-auto_inline-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::auto::inline.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::inline, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Added: trunk/t/configure/136-auto_inline-03.t
==============================================================================
--- (empty file)
+++ trunk/t/configure/136-auto_inline-03.t      Tue Nov  6 04:15:14 2007
@@ -0,0 +1,84 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 136-auto_inline-03.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::inline');
+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::inline};
+
+$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 $test = 1;
+ok($step->_evaluate_inline($conf, $test),
+    "_evaluate_inline() returned true value");
+is($step->result, q{yes}, "Got expected result");
+is($conf->data->get( 'inline' ), 1,
+    "'inline' attribute has expected value");;
+
+pass("Keep Devel::Cover happy");
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+136-auto_inline-03.t - test config::auto::inline
+
+=head1 SYNOPSIS
+
+    % prove t/configure/136-auto_inline-03.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::inline.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::inline, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Added: trunk/t/configure/136-auto_inline-04.t
==============================================================================
--- (empty file)
+++ trunk/t/configure/136-auto_inline-04.t      Tue Nov  6 04:15:14 2007
@@ -0,0 +1,84 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 136-auto_inline-04.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::inline');
+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::inline};
+
+$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 $test = 0;
+ok($step->_evaluate_inline($conf, $test),
+    "_evaluate_inline() returned true value");
+is($step->result, q{no}, "Got expected result");
+is($conf->data->get( 'inline' ), q{},
+    "'inline' attribute has expected value");;
+
+pass("Keep Devel::Cover happy");
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+136-auto_inline-04.t - test config::auto::inline
+
+=head1 SYNOPSIS
+
+    % prove t/configure/136-auto_inline-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::auto::inline.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::inline, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Added: trunk/t/configure/136-auto_inline-05.t
==============================================================================
--- (empty file)
+++ trunk/t/configure/136-auto_inline-05.t      Tue Nov  6 04:15:14 2007
@@ -0,0 +1,106 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 136-auto_inline-05.t
+
+use strict;
+use warnings;
+use Test::More tests => 19;
+use Carp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
+use_ok('config::auto::inline');
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw( test_step_thru_runstep);
+use Parrot::IO::Capture::Mini;
+
+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::inline};
+
+$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 $tie_out = tie *STDOUT, "Parrot::IO::Capture::Mini"
+        or croak "Unable to tie";
+    my $test = 1;
+    ok($step->_evaluate_inline($conf, $test),
+        "_evaluate_inline() returned true value");
+    my @more_lines = $tie_out->READLINE;
+    ok( @more_lines, "verbose output captured" );
+    is($step->result, q{yes}, "Got expected result");;
+    is($conf->data->get( 'inline' ), 1,
+        "'inline' attribute has expected value");
+}
+untie *STDOUT;
+
+{
+    my $tie_out = tie *STDOUT, "Parrot::IO::Capture::Mini"
+        or croak "Unable to tie";
+    my $test = 0;
+    ok($step->_evaluate_inline($conf, $test),
+        "_evaluate_inline() returned true value");
+    my @more_lines = $tie_out->READLINE;
+    ok( @more_lines, "verbose output captured" );
+    is($step->result, q{no}, "Got expected result");;
+    is($conf->data->get( 'inline' ), q{},
+        "'inline' attribute has expected value");
+}
+untie *STDOUT;
+
+pass("Keep Devel::Cover happy");
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+136-auto_inline-05.t - test config::auto::inline
+
+=head1 SYNOPSIS
+
+    % prove t/configure/136-auto_inline-05.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::inline.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::inline, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Added: trunk/t/configure/136-auto_inline-06.t
==============================================================================
--- (empty file)
+++ trunk/t/configure/136-auto_inline-06.t      Tue Nov  6 04:15:14 2007
@@ -0,0 +1,82 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 136-auto_inline-06.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::inline');
+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::inline};
+
+$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 $test = 0;
+$test = $step->_second_probe_for_inline($test);
+ok($step->_evaluate_inline($conf, $test),
+    "_evaluate_inline() returned true value");
+
+pass("Keep Devel::Cover happy");
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+136-auto_inline-06.t - test config::auto::inline
+
+=head1 SYNOPSIS
+
+    % prove t/configure/136-auto_inline-06.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::inline.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::inline, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Reply via email to