[svn:parrot] r47218 - in branches/tt1452_configure_debug: config/auto t/steps/auto

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Mon May 31 13:22:33 UTC 2010


Author: jkeenan
Date: Mon May 31 13:22:32 2010
New Revision: 47218
URL: https://trac.parrot.org/parrot/changeset/47218

Log:
Update config step and test file to reflect change in handling of verbose debugging output.

Modified:
   branches/tt1452_configure_debug/config/auto/icu.pm
   branches/tt1452_configure_debug/t/steps/auto/icu-01.t

Modified: branches/tt1452_configure_debug/config/auto/icu.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/icu.pm	Mon May 31 12:35:01 2010	(r47217)
+++ branches/tt1452_configure_debug/config/auto/icu.pm	Mon May 31 13:22:32 2010	(r47218)
@@ -46,9 +46,8 @@
 sub runstep {
     my ( $self, $conf ) = @_;
 
-    my ( $verbose, $icushared_opt, $icuheaders_opt,
+    my ( $icushared_opt, $icuheaders_opt,
         $icuconfig_opt, $without_opt ) = $conf->options->get( qw|
-            verbose
             icushared
             icuheaders
             icu-config
@@ -101,13 +100,14 @@
                         ( ! defined($icuheaders) );
 
     my $without = 0;
-    ($icuconfig, $autodetect, $without) =
-        $self->_handle_autodetect( {
+    ($icuconfig, $autodetect, $without) = $self->_handle_autodetect(
+        $conf,
+        {
             icuconfig   => $icuconfig,
             autodetect  => $autodetect,
             without     => $without,
-            verbose     => $verbose,
-    } );
+        }
+    );
     # Inside _handle_autodetect(), $without can be set to 1 by
     # _handle_search_for_icu_config().  In that case, we're abandoning our
     # attempt to configure with ICU and so may return here.
@@ -125,7 +125,6 @@
                 without         => $without,
                 autodetect      => $autodetect,
                 icuconfig       => $icuconfig,
-                verbose         => $verbose,
                 icushared       => $icushared,
                 icuheaders      => $icuheaders,
             },
@@ -136,7 +135,7 @@
         return 1;
     }
 
-    _verbose_report($verbose, $icuconfig, $icushared, $icuheaders);
+    _verbose_report($conf, $icuconfig, $icushared, $icuheaders);
 
     $icuheaders = $self->_handle_icuconfig_errors( {
         icushared   => $icushared,
@@ -168,7 +167,6 @@
         $conf,
         {
             ccflags_status  => $ccflags_status,
-            verbose         => $verbose,
             icuheaders      => $icuheaders,
         },
     );
@@ -221,8 +219,7 @@
 }
 
 sub _handle_search_for_icu_config {
-    my $self = shift;
-    my $arg = shift;
+    my ($self, $conf, $arg) = @_;
     if ( $arg->{ret} ) {
         undef $arg->{icuconfig};
         $arg->{autodetect} = 0;
@@ -230,40 +227,38 @@
     }
     else {
         $arg->{icuconfig} = $self->{icuconfig_default};
-        if ($arg->{verbose}) {
-            print "icu-config found... good!\n";
-        }
+        $conf->debug("icu-config found... good!\n");
     }
     return ( $arg->{icuconfig}, $arg->{autodetect}, $arg->{without} );
 }
 
 sub _handle_autodetect {
-    my $self = shift;
-    my $arg = shift;
+    my ($self, $conf, $arg) = @_;
     if ( $arg->{autodetect} ) {
         if ( ! $arg->{icuconfig} ) {
 
             my ( undef, undef, $ret ) =
                 capture_output( $self->{icuconfig_default}, "--exists" );
 
-            print "Discovered $self->{icuconfig_default} --exists returns $ret\n"
-                if $arg->{verbose};
+            $conf->debug("Discovered $self->{icuconfig_default} --exists returns $ret\n");
 
             ($arg->{icuconfig}, $arg->{autodetect}, $arg->{without}) =
-                $self->_handle_search_for_icu_config( {
-                    icuconfig   => $arg->{icuconfig},
-                    autodetect  => $arg->{autodetect},
-                    without     => $arg->{without},
-                    verbose     => $arg->{verbose},
-                    ret         => $ret,
-            } );
+                $self->_handle_search_for_icu_config(
+                    $conf,
+                    {
+                        icuconfig   => $arg->{icuconfig},
+                        autodetect  => $arg->{autodetect},
+                        without     => $arg->{without},
+                        ret         => $ret,
+                    }
+                );
         }
     } # end $autodetect true
     else {
-        if ($arg->{verbose}) {
-            print "Specified an ICU config parameter,\n";
-            print "ICU autodetection disabled.\n";
-        }
+        $conf->debug(
+            "Specified an ICU config parameter,\n",
+            "ICU autodetection disabled.\n",
+        );
     } # end $autodetect false
     return ( $arg->{icuconfig}, $arg->{autodetect}, $arg->{without} );
 }
@@ -284,28 +279,22 @@
         $arg->{icuconfig}
     ) {
         # ldflags
-        print "Trying $arg->{icuconfig} with '--ldflags'\n"
-            if $arg->{verbose};
+        $conf->debug("Trying $arg->{icuconfig} with '--ldflags'\n");
         $icushared = capture_output("$arg->{icuconfig} --ldflags");
         chomp $icushared;
-        print "icushared:  captured $icushared\n"
-            if $arg->{verbose};
+        $conf->debug("icushared:  captured $icushared\n");
         ($icushared, $arg->{without}) =
             $self->_handle_icushared($icushared, $arg->{without});
-        print "For icushared, found $icushared and $arg->{without}\n"
-            if $arg->{verbose};
+        $conf->debug("For icushared, found $icushared and $arg->{without}\n");
 
         # location of header files
-        print "Trying $arg->{icuconfig} with '--prefix'\n"
-            if $arg->{verbose};
+        $conf->debug("Trying $arg->{icuconfig} with '--prefix'\n");
         $icuheaders = capture_output("$arg->{icuconfig} --prefix");
         chomp($icuheaders);
-        print "icuheaders:  captured $icuheaders\n"
-            if $arg->{verbose};
+        $conf->debug("icuheaders:  captured $icuheaders\n");
         ($icuheaders, $arg->{without}) =
             $self->_handle_icuheaders($conf, $icuheaders, $arg->{without});
-        print "For icuheaders, found $icuheaders and $arg->{without}\n"
-            if $arg->{verbose};
+        $conf->debug("For icuheaders, found $icuheaders and $arg->{without}\n");
     }
 
     return ($arg->{without}, $icushared, $icuheaders);
@@ -347,8 +336,8 @@
 }
 
 sub _verbose_report {
-    my ($verbose, $icuconfig, $icushared, $icuheaders) = @_;
-    if ($verbose) {
+    my ($conf, $icuconfig, $icushared, $icuheaders) = @_;
+    if ($conf->options->get('verbose')) {
         print "icuconfig: $icuconfig\n"  if defined $icuconfig;
         print "icushared='$icushared'\n" if defined $icushared;
         print "headers='$icuheaders'\n"  if defined $icuheaders;
@@ -394,9 +383,7 @@
     my $arg = shift;
     if ($arg->{ccflags_status}) {
         # Ok, we don't need anything more.
-        if ($arg->{verbose}) {
-            print "Your compiler found the icu headers... good!\n";
-        }
+        $conf->debug("Your compiler found the icu headers... good!\n");
     }
     else {
         my $icuheaders = $arg->{icuheaders};
@@ -409,9 +396,7 @@
             $icuflags = "-I $arg->{icuheaders}";
         }
 
-        if ($arg->{verbose}) {
-            print "Adding $icuflags to ccflags for icu headers.\n";
-        }
+        $conf->debug( "Adding $icuflags to ccflags for icu headers.\n");
         $conf->data->add( ' ', ccflags => $icuflags );
     }
 }

Modified: branches/tt1452_configure_debug/t/steps/auto/icu-01.t
==============================================================================
--- branches/tt1452_configure_debug/t/steps/auto/icu-01.t	Mon May 31 12:35:01 2010	(r47217)
+++ branches/tt1452_configure_debug/t/steps/auto/icu-01.t	Mon May 31 13:22:32 2010	(r47218)
@@ -72,53 +72,59 @@
 
 my ($autodetect, $without);
 
-($icuconfig, $autodetect, $without) =
-    $step->_handle_search_for_icu_config( {
+($icuconfig, $autodetect, $without) = $step->_handle_search_for_icu_config(
+    $conf,
+    {
         icuconfig   => q{},
         autodetect  => 1,
         without     => 0,
-        verbose     => 0,
         ret         => -1,
-} );
+    }
+);
 ok(! defined $icuconfig, "icu-config not found, as expected");
 is($autodetect, 0, "Autodetection cancelled, as expected");
 is($without, 1, "Continuing to configure without ICU");
 
-($icuconfig, $autodetect, $without) =
-    $step->_handle_search_for_icu_config( {
+($icuconfig, $autodetect, $without) = $step->_handle_search_for_icu_config(
+    $conf,
+    {
         icuconfig   => q{},
         autodetect  => 1,
         without     => 0,
-        verbose     => 0,
         ret         => 256,
-} );
+    }
+);
 ok(! defined $icuconfig, "icu-config not found, as expected");
 is($autodetect, 0, "Autodetection cancelled, as expected");
 is($without, 1, "Continuing to configure without ICU");
 
-($icuconfig, $autodetect, $without) =
-    $step->_handle_search_for_icu_config( {
+($icuconfig, $autodetect, $without) = $step->_handle_search_for_icu_config(
+    $conf,
+    {
         icuconfig   => q{},
         autodetect  => 1,
         without     => 0,
-        verbose     => 0,
         ret         => 0,
-} );
+    }
+);
 is($icuconfig, q{icu-config}, "icu-config found, as expected");
 is($autodetect, 1, "Autodetection continues, as expected");
 is($without, 0, "Continuing to try to configure with ICU");
 
 {
+    $conf->options->set( verbose => 1 );
     my ($stdout, $stderr);
     capture( sub {
             ($icuconfig, $autodetect, $without) =
-                $step->_handle_search_for_icu_config( {
+            $step->_handle_search_for_icu_config(
+                $conf,
+                {
                     icuconfig   => q{},
                     autodetect  => 1,
                     without     => 0,
-                    verbose     => 1,
                     ret         => 0,
-            } );
+                }
+            );
         },
         \$stdout,
         \$stderr,
@@ -128,30 +134,33 @@
     is($without, 0, "Continuing to try to configure with ICU");
     like($stdout, qr/icu-config found/,
         "Got expected verbose output");
+    $conf->options->set( verbose => undef );
 }
 
 ########## _handle_autodetect() ##########
 
-($icuconfig, $autodetect, $without) =
-    $step->_handle_autodetect( {
+($icuconfig, $autodetect, $without) = $step->_handle_autodetect(
+    $conf,
+    {
         icuconfig   => $phony,
         autodetect  => 1,
         without     => 0,
-        verbose     => 0,
-} );
+    }
+);
 is($icuconfig, $phony, "icu-config unchanged, as expected");
 is($autodetect, 1, "Autodetection still active, as expected");
 is($without, 0, "Continuing to try to configure with ICU");
 
 {
+    $conf->options->set( verbose => 1 );
     my ($stdout, $stderr);
     capture( sub {
-        ($icuconfig, $autodetect, $without) =
-            $step->_handle_autodetect( {
+        ($icuconfig, $autodetect, $without) = $step->_handle_autodetect(
+            $conf,
+            {
                 icuconfig   => $phony,
                 autodetect  => 0,
                 without     => 0,
-                verbose     => 1,
             } );
         },
         \$stdout,
@@ -162,6 +171,7 @@
     is($without, 0, "Continuing to try to configure with ICU");
     like($stdout, qr/ICU autodetection disabled/s,
         "Got expected verbose output");
+    $conf->options->set( verbose => undef );
 }
 
 ########## _handle_icushared() ##########
@@ -247,7 +257,6 @@
             without         => 1,
             autodetect      => 1,
             icuconfig       => 1,
-            verbose         => 0,
         }
     );
 is($without, 1, "Not trying to configure with ICU");
@@ -262,7 +271,6 @@
             without         => 0,
             autodetect      => 0,
             icuconfig       => 1,
-            verbose         => 0,
         }
     );
 is($without, 0, "Still trying to configure with ICU");
@@ -277,7 +285,6 @@
             without         => 0,
             autodetect      => 1,
             icuconfig       => q{},
-            verbose         => 0,
         }
     );
 is($without, 0, "Still trying to configure with ICU");
@@ -292,48 +299,54 @@
     "Got expected die message");
 
 {
+    $conf->options->set( verbose => 1 );
     my $phony = q{/path/to/icu-config};
     my ($stdout, $stderr);
     capture(
-        sub { auto::icu::_verbose_report(1, $phony, undef, undef); },
+        sub { auto::icu::_verbose_report($conf, $phony, undef, undef); },
         \$stdout,
         \$stderr,
     );
     like( $stdout, qr/icuconfig:\s+$phony/s,
         "Got expected verbose output"
     );
+    $conf->options->set( verbose => undef );
 }
 
 {
+    $conf->options->set( verbose => 1 );
     my $phony = q{-lalpha};
     my ($stdout, $stderr);
     capture(
-        sub { auto::icu::_verbose_report(1, undef, $phony, undef); },
+        sub { auto::icu::_verbose_report($conf, undef, $phony, undef); },
         \$stdout,
         \$stderr,
     );
     like( $stdout, qr/icushared='$phony'/s,
         "Got expected verbose output"
     );
+    $conf->options->set( verbose => undef );
 }
 
 {
+    $conf->options->set( verbose => 1 );
     my $phony = q{alpha/include};
     my ($stdout, $stderr);
     capture(
-        sub { auto::icu::_verbose_report(1, undef, undef, $phony); },
+        sub { auto::icu::_verbose_report($conf, undef, undef, $phony); },
         \$stdout,
         \$stderr,
     );
     like( $stdout, qr/headers='$phony'/s,
         "Got expected verbose output"
     );
+    $conf->options->set( verbose => undef );
 }
 
 {
     my ($stdout, $stderr);
     capture(
-        sub { auto::icu::_verbose_report(0, 'alpha', 'beta', 'gamma'); },
+        sub { auto::icu::_verbose_report($conf, 'alpha', 'beta', 'gamma'); },
         \$stdout,
         \$stderr,
     );
@@ -343,6 +356,7 @@
 ########## _handle_icuconfig_errors() ##########
 
 {
+    $conf->options->set( verbose => undef );
     my ($stdout, $stderr);
     capture(
         sub {
@@ -368,13 +382,14 @@
 my $status = $conf->data->get( 'ccflags' );
 
 {
+    $conf->options->set(verbose => 1);
     my ($stdout, $stderr);
     capture(
         sub {
-           auto::icu::_handle_ccflags_status($conf,
+           auto::icu::_handle_ccflags_status(
+               $conf,
                {
                    ccflags_status  => 1,
-                   verbose         => 1,
                    icuheaders      => $icuheaders,
                },
            );
@@ -388,13 +403,14 @@
 $conf->data->set( ccflags => $status ); # re-set for next test
 
 {
+    $conf->options->set(verbose => 1);
     my ($stdout, $stderr);
     capture(
         sub {
-           auto::icu::_handle_ccflags_status($conf,
+           auto::icu::_handle_ccflags_status(
+               $conf,
                {
                    ccflags_status  => 0,
-                   verbose         => 1,
                    icuheaders      => $icuheaders,
                },
            );
@@ -427,13 +443,14 @@
 $conf->data->set( ccflags => $status ); # re-set for next test
 
 {
+    $conf->options->set( verbose => undef );
     my ($stdout, $stderr);
     capture(
         sub {
-           auto::icu::_handle_ccflags_status($conf,
+           auto::icu::_handle_ccflags_status(
+               $conf,
                {
                    ccflags_status  => 0,
-                   verbose         => 0,
                    icuheaders      => $icuheaders,
                },
            );
@@ -652,6 +669,7 @@
         $conf->options->set( %{$args} );
         $step = test_step_constructor_and_description($conf);
         {
+            $conf->options->set( verbose => 1 );
             my ($stdout, $stderr, $ret);
             my $icuconfig;
             my ($without, $icushared, $icuheaders);
@@ -664,7 +682,6 @@
                             without         => 0,
                             autodetect      => 1,
                             icuconfig       => $icuconfig,
-                            verbose         => 1,
                         }
                     );
                 },


More information about the parrot-commits mailing list