[svn:parrot] r47184 - in branches/tt1452_configure_debug: config/init/hints t/steps/init/hints
jkeenan at svn.parrot.org
jkeenan at svn.parrot.org
Mon May 31 02:48:47 UTC 2010
Author: jkeenan
Date: Mon May 31 02:48:46 2010
New Revision: 47184
URL: https://trac.parrot.org/parrot/changeset/47184
Log:
Continue to modify handling and testing of verbose/debugging output.
Modified:
branches/tt1452_configure_debug/config/init/hints/darwin.pm
branches/tt1452_configure_debug/config/init/hints/linux.pm
branches/tt1452_configure_debug/t/steps/init/hints/darwin-01.t
branches/tt1452_configure_debug/t/steps/init/hints/linux-01.t
Modified: branches/tt1452_configure_debug/config/init/hints/darwin.pm
==============================================================================
--- branches/tt1452_configure_debug/config/init/hints/darwin.pm Mon May 31 02:13:44 2010 (r47183)
+++ branches/tt1452_configure_debug/config/init/hints/darwin.pm Mon May 31 02:48:46 2010 (r47184)
@@ -25,7 +25,6 @@
my $share_ext = $conf->option_or_data('share_ext');
my $version = $conf->option_or_data('VERSION');
- my $verbose = $conf->options->get('verbose');
# The hash referenced by $flagsref is the list of options that have -arch
# flags added to them implicitly through config/init/defaults.pm when
@@ -35,7 +34,7 @@
# friends. So, it's time to remove all -arch flags set in $conf->data and
# force a single, native architecture to being the default build.
- my $flagsref = _strip_arch_flags($conf, $verbose);
+ my $flagsref = _strip_arch_flags($conf);
# And now, after possibly losing a few undesired compiler and linker
# flags, on to the main Darwin config.
@@ -98,11 +97,11 @@
#################### INTERNAL SUBROUTINES ####################
sub _precheck {
- my ($flag, $stored, $verbose) = @_;
- if ($verbose) {
- print "Checking $flag...\n";
- print "Pre-check: " . ($stored || '(nil)') . "\n";
- }
+ my ($conf, $flag, $stored) = @_;
+ $conf->debug(
+ "Checking $flag...\n",
+ "Pre-check: " . ($stored || '(nil)') . "\n",
+ );
}
sub _strip_arch_flags_engine {
@@ -116,27 +115,26 @@
}
sub _postcheck {
- my ($flagsref, $flag, $verbose) = @_;
- if ($verbose) {
- print "Post-check: ", ( $flagsref->{$flag} or '(nil)' ), "\n";
- }
+ my ($conf, $flagsref, $flag) = @_;
+ my $f = $flagsref->{$flag} || '(nil)';
+ $conf->debug("Post-check: $f\n");
}
sub _strip_arch_flags {
- my ($conf, $verbose) = @_;
+ my ($conf) = @_;
my $flagsref = { map { $_ => '' } @{ $defaults{problem_flags} } };
- print "\nStripping -arch flags due to Apple multi-architecture build problems:\n" if $verbose;
+ $conf->debug("\nStripping -arch flags due to Apple multi-architecture build problems:\n");
for my $flag ( keys %{ $flagsref } ) {
my $stored = $conf->data->get($flag) || '';
- _precheck($flag, $stored, $verbose);
+ _precheck($conf, $flag, $stored);
$flagsref = _strip_arch_flags_engine(
$defaults{architectures}, $stored, $flagsref, $flag
);
- _postcheck($flagsref, $flag, $verbose);
+ _postcheck($conf, $flagsref, $flag);
}
return $flagsref;
}
@@ -167,12 +165,11 @@
sub _probe_for_fink {
my $conf = shift;
- my $verbose = $conf->options->get( 'verbose' );
# Per fink(8), this is location for Fink configuration file, presumably
# regardless of where Fink itself is installed.
my $fink_conf = $defaults{fink_conf};
unless (-f $fink_conf) {
- print "Fink configuration file not located\n" if $verbose;
+ $conf->debug("Fink configuration file not located\n");
return;
}
my $fink_conf_str = Parrot::BuildUtil::slurp_file($fink_conf);
@@ -185,8 +182,7 @@
last;
}
unless (defined $fink_base_dir) {
- print "Fink configuration file defective: no 'Basepath'\n"
- if $verbose;
+ $conf->debug("Fink configuration file defective: no 'Basepath'\n");
return;
}
my $fink_lib_dir = qq{$fink_base_dir/lib};
@@ -196,8 +192,7 @@
push @unlocateables, $dir unless (-d $dir);
}
if (@unlocateables) {
- print "Could not locate Fink directories: @unlocateables\n"
- if $verbose;
+ $conf->debug("Could not locate Fink directories: @unlocateables\n");
return;
}
else {
@@ -221,8 +216,7 @@
push @unlocateables, $dir unless (-d $dir);
}
if (@unlocateables) {
- print "Could not locate Macports directories: @unlocateables\n"
- if $verbose;
+ $conf->debug("Could not locate Macports directories: @unlocateables\n");
return;
}
else {
@@ -248,14 +242,14 @@
if ($library eq 'macports') {
$addl_flags_ref = _probe_for_macports($conf);
}
- my $rv = _add_to_flags( $addl_flags_ref, $flagsref, $title, $verbose );
+ my $rv = _add_to_flags( $conf, $addl_flags_ref, $flagsref, $title );
return $rv;
}
return;
}
sub _add_to_flags {
- my ( $addl_flags_ref, $flagsref, $title, $verbose ) = @_;
+ my ( $conf, $addl_flags_ref, $flagsref, $title ) = @_;
if ( defined $addl_flags_ref ) {
foreach my $addl ( keys %{ $addl_flags_ref } ) {
my %seen;
@@ -266,10 +260,10 @@
$flagsref->{$addl} .= " $addl_flags_ref->{$addl}"
unless $seen{ $addl_flags_ref->{$addl} };
}
- print "Probe for $title successful\n" if $verbose;
+ $conf->debug("Probe for $title successful\n");
}
else {
- print "Probe for $title unsuccessful\n" if $verbose;
+ $conf->debug("Probe for $title unsuccessful\n");
}
return 1;
}
Modified: branches/tt1452_configure_debug/config/init/hints/linux.pm
==============================================================================
--- branches/tt1452_configure_debug/config/init/hints/linux.pm Mon May 31 02:13:44 2010 (r47183)
+++ branches/tt1452_configure_debug/config/init/hints/linux.pm Mon May 31 02:48:46 2010 (r47184)
@@ -15,10 +15,8 @@
my $linkflags = $conf->option_or_data('linkflags');
my $share_ext = $conf->option_or_data('share_ext');
my $version = $conf->option_or_data('VERSION');
- my $verbose;
- $verbose = $conf->options->get('verbose');
- print "\n" if $verbose;
+ $conf->debug("\n");
# should find g++ in most cases
my $link = $conf->data->get('link') || 'c++';
@@ -39,7 +37,7 @@
$ld_share_flags = ' -shared -g -pipe -fexceptions -fPIC';
$cc_shared .= ' -fPIC';
- $ccflags = _handle_icc_ccflags($ccflags, $verbose);
+ $ccflags = _handle_icc_ccflags($conf, $ccflags);
}
elsif ( $cc =~ /suncc/ ) {
@@ -96,7 +94,7 @@
}
sub _handle_icc_ccflags {
- my ($ccflags, $verbose) = @_;
+ my ($conf, $ccflags) = @_;
# enable correct floating point behavior
# which is *not* the default behavior. ahem.
@@ -106,7 +104,7 @@
# for negative zero without this.
$ccflags .= ' -fp-model source';
- $verbose and print " ccflags: $ccflags\n";
+ $conf->debug(" ccflags: $ccflags\n");
return $ccflags;
}
Modified: branches/tt1452_configure_debug/t/steps/init/hints/darwin-01.t
==============================================================================
--- branches/tt1452_configure_debug/t/steps/init/hints/darwin-01.t Mon May 31 02:13:44 2010 (r47183)
+++ branches/tt1452_configure_debug/t/steps/init/hints/darwin-01.t Mon May 31 02:48:46 2010 (r47184)
@@ -40,10 +40,11 @@
my $stored = $conf->data->get($problematic_flag);
{
+ $conf->options->set( verbose => undef );
my ($stdout, $stderr);
capture(
sub { init::hints::darwin::_precheck(
- $problematic_flag, $stored, 0
+ $conf, $problematic_flag, $stored
) },
\$stdout,
\$stderr,
@@ -52,10 +53,11 @@
}
{
+ $conf->options->set( verbose => 1 );
my ($stdout, $stderr);
capture(
sub { init::hints::darwin::_precheck(
- $problematic_flag, $stored, 1
+ $conf, $problematic_flag, $stored
) },
\$stdout,
\$stderr,
@@ -68,10 +70,11 @@
}
{
+ $conf->options->set( verbose => 1 );
my ($stdout, $stderr);
capture(
sub { init::hints::darwin::_precheck(
- $problematic_flag, q{}, 1
+ $conf, $problematic_flag, q{}
) },
\$stdout,
\$stderr,
@@ -81,6 +84,7 @@
"_precheck(): Got expected verbose output" );
like($stdout, qr/Pre-check:\s+\(nil\)/,
"_precheck(): Got expected verbose output" );
+ $conf->options->set( verbose => undef );
}
##### _strip_arch_flags_engine #####
@@ -107,22 +111,24 @@
##### _postcheck #####
{
+ $conf->options->set( verbose => undef );
my $flag = 'ccflags';
my $flagsref = { 'ccflags' => 'my ccflag' };
my ($stdout, $stderr);
capture(
sub { init::hints::darwin::_postcheck(
- $flagsref, $flag, 0
+ $conf, $flagsref, $flag
) },
\$stdout,
\$stderr,
);
ok( ! $stdout, "_postcheck(): Non-verbose mode produced no output" );
+ $conf->options->set( verbose => 1 );
capture(
sub { init::hints::darwin::_postcheck(
- $flagsref, $flag, 1
+ $conf, $flagsref, $flag
) },
\$stdout,
\$stderr,
@@ -131,10 +137,11 @@
like($stdout, qr/Post-check:\s+$flagsref->{$flag}/,
"_postcheck(): Got expected verbose output" );
+ $conf->options->set( verbose => 1 );
$flagsref = { 'ccflags' => undef };
capture(
sub { init::hints::darwin::_postcheck(
- $flagsref, $flag, 1
+ $conf, $flagsref, $flag
) },
\$stdout,
\$stderr,
@@ -164,10 +171,11 @@
"_strip_arch_flags(): '-arch' flags and extra whitespace removed",
);
+ $conf->options->set( verbose => 1 );
my ($stdout, $stderr);
capture(
sub {
- $flagsref = init::hints::darwin::_strip_arch_flags($conf, 1);
+ $flagsref = init::hints::darwin::_strip_arch_flags($conf);
},
\$stdout,
\$stderr,
@@ -351,17 +359,17 @@
$addl_flags_ref = undef;
$flagsref = undef;
$title = 'Fink';
- $verbose = 0;
+ $conf->options->set( 'verbose' => undef );
ok( init::hints::darwin::_add_to_flags(
- $addl_flags_ref, $flagsref, $title, $verbose
+ $conf, $addl_flags_ref, $flagsref, $title
), "_add_to_flags(): returned true value when no probes found" );
- $verbose = 1;
+ $conf->options->set( 'verbose' => 1 );
{
my ($stdout, $stderr);
capture(
sub { init::hints::darwin::_add_to_flags(
- $addl_flags_ref, $flagsref, $title, $verbose
+ $conf, $addl_flags_ref, $flagsref, $title
); },
\$stdout,
\$stderr,
@@ -381,9 +389,9 @@
$flagsref->{ccflags} = " -pipe -fno-common -Wno-long-double ";
$flagsref->{linkflags} = undef;
$title = 'Fink';
- $verbose = 0;
+ $conf->options->set( 'verbose' => undef );
my $rv = init::hints::darwin::_add_to_flags(
- $addl_flags_ref, $flagsref, $title, $verbose
+ $conf, $addl_flags_ref, $flagsref, $title
);
is( $flagsref->{linkflags}, " $addl_flags_ref->{linkflags}",
"_add_to_flags(): flag added where not previously populated" );
Modified: branches/tt1452_configure_debug/t/steps/init/hints/linux-01.t
==============================================================================
--- branches/tt1452_configure_debug/t/steps/init/hints/linux-01.t Mon May 31 02:13:44 2010 (r47183)
+++ branches/tt1452_configure_debug/t/steps/init/hints/linux-01.t Mon May 31 02:48:46 2010 (r47184)
@@ -37,17 +37,16 @@
##### _handle_icc_ccflags() #####
my $ccflags = '';
-my $verbose = 0;
-$ccflags = init::hints::linux::_handle_icc_ccflags($ccflags, $verbose);
+$ccflags = init::hints::linux::_handle_icc_ccflags($conf, $ccflags);
like( $ccflags, qr/\s-we147/, "On icc, 'cc_flags' set as expected" );
$ccflags = '';
-$verbose = 1;
{
+ $conf->options->set( verbose => 1 );
my ($stdout, $stderr);
capture(
sub { $ccflags =
- init::hints::linux::_handle_icc_ccflags($ccflags, $verbose); },
+ init::hints::linux::_handle_icc_ccflags($conf, $ccflags); },
\$stdout,
\$stderr,
);
More information about the parrot-commits
mailing list