[svn:parrot] r41427 - in branches/auto_frames_refactor: config/auto t/steps/auto

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Wed Sep 23 02:16:33 UTC 2009


Author: jkeenan
Date: Wed Sep 23 02:16:32 2009
New Revision: 41427
URL: https://trac.parrot.org/parrot/changeset/41427

Log:
Refactor so that (1) we only test $can_build_call_frames for truth once; (2)
we make visible within one sub all four ways in which 'has_exec_protect' can
be set.

Modified:
   branches/auto_frames_refactor/config/auto/frames.pm
   branches/auto_frames_refactor/t/steps/auto/frames-01.t

Modified: branches/auto_frames_refactor/config/auto/frames.pm
==============================================================================
--- branches/auto_frames_refactor/config/auto/frames.pm	Wed Sep 23 01:37:03 2009	(r41426)
+++ branches/auto_frames_refactor/config/auto/frames.pm	Wed Sep 23 02:16:32 2009	(r41427)
@@ -37,14 +37,6 @@
         $conf->data->set(
             cc_build_call_frames  => '-DCAN_BUILD_CALL_FRAMES',
         );
-    }
-    else {
-        $conf->data->set(
-            cc_build_call_frames  => '',
-        );
-    }
-
-    if ( $can_build_call_frames ) {
         # test for executable malloced memory
         my $osname = $conf->data->get( 'osname' );
         if ( -e "config/auto/frames/test_exec_${osname}_c.in" ) {
@@ -57,7 +49,12 @@
                 my $exec_protect_test = (
                     $conf->cc_run(0) !~ /ok/ && $conf->cc_run(1) =~ /ok/
                 );
-                _handle_exec_protect($conf, $exec_protect_test);
+                if ($exec_protect_test) {
+                    $conf->data->set( has_exec_protect => 1 );
+                }
+                else {
+                    $conf->data->set( has_exec_protect => 0 );
+                }
             }
             $conf->cc_clean();
         }
@@ -65,6 +62,11 @@
             $conf->data->set( has_exec_protect => 0 );
         }
     }
+    else {
+        $conf->data->set(
+            cc_build_call_frames  => '',
+        );
+    }
 
     $self->set_result($can_build_call_frames?'yes':'no');
     return 1;
@@ -87,16 +89,6 @@
     return $can_build_call_frames;
 }
 
-sub _handle_exec_protect {
-    my ($conf, $exec_protect_test) = @_;
-    if ($exec_protect_test) {
-        $conf->data->set( has_exec_protect => 1 );
-    }
-    else {
-        $conf->data->set( has_exec_protect => 0 );
-    }
-}
-
 1;
 
 # Local Variables:

Modified: branches/auto_frames_refactor/t/steps/auto/frames-01.t
==============================================================================
--- branches/auto_frames_refactor/t/steps/auto/frames-01.t	Wed Sep 23 01:37:03 2009	(r41426)
+++ branches/auto_frames_refactor/t/steps/auto/frames-01.t	Wed Sep 23 02:16:32 2009	(r41427)
@@ -5,7 +5,7 @@
 
 use strict;
 use warnings;
-use Test::More tests => 19;
+use Test::More tests => 17;
 use lib qw( lib t/configure/testlib );
 use_ok('config::init::defaults');
 use_ok('config::auto::frames');
@@ -93,19 +93,6 @@
 ok( ! $can_build_call_frames,
     "_call_frames_buildable() returned false value, as expected (i386/linux/4)" );
 
-$conf->data->set( has_exec_protect => undef );
-my $exec_protect_test;
-
-$exec_protect_test = 1;
-auto::frames::_handle_exec_protect($conf, $exec_protect_test);
-ok( $conf->data->get( 'has_exec_protect' ),
-    "has_exec_protect set, as expected" );
-
-$exec_protect_test = 0;
-auto::frames::_handle_exec_protect($conf, $exec_protect_test);
-ok( ! $conf->data->get( 'has_exec_protect' ),
-    "has_exec_protect not set, as expected" );
-
 ################### DOCUMENTATION ###################
 
 =head1 NAME


More information about the parrot-commits mailing list