[svn:parrot] r47233 - in branches/tt1452_configure_debug: config/inter t/steps/inter

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Mon May 31 17:58:53 UTC 2010


Author: jkeenan
Date: Mon May 31 17:58:52 2010
New Revision: 47233
URL: https://trac.parrot.org/parrot/changeset/47233

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

Modified:
   branches/tt1452_configure_debug/config/inter/libparrot.pm
   branches/tt1452_configure_debug/t/steps/inter/libparrot-01.t

Modified: branches/tt1452_configure_debug/config/inter/libparrot.pm
==============================================================================
--- branches/tt1452_configure_debug/config/inter/libparrot.pm	Mon May 31 17:21:49 2010	(r47232)
+++ branches/tt1452_configure_debug/config/inter/libparrot.pm	Mon May 31 17:58:52 2010	(r47233)
@@ -46,27 +46,29 @@
     # Parrot can't necessarily handle a pre-existing installed shared
     # libparrot.so. At this point, we don't know the actual name
     # of the shared parrot library. So we try some candidates.
-    my @libs = ('libparrot.so');
-    my @libpaths = ('/usr/local/lib', '/usr/lib', $conf->data->get('libdir'));
-    if ($^O eq 'MSWin32') {
-        push @libpaths, (split /;/, $ENV{PATH});
-        @libs = ('libparrot.dll', 'libparrot.lib', 'libparrot.dll.a');
-    }
-    if ($^O eq 'cygwin') {
-        @libs = ('libparrot.dll.a');
-    }
-    if ($^O eq 'darwin'){
-        @libs = qw/libparrot.dylib libparrot.a/;
-    }
-    if (defined $ENV{LD_LIBRARY_PATH}) {
-        push @libpaths, (split /:/, $ENV{LD_LIBRARY_PATH});
-    }
-    if (defined $ENV{LD_RUN_PATH}) {
-        push @libpaths, (split /:/, $ENV{LD_RUN_PATH});
-    }
-    if (defined $ENV{DYLD_LIBRARY_PATH}) {
-        push @libpaths, (split /:/, $ENV{DYLD_LIBRARY_PATH});
-    }
+#    my @libs = ('libparrot.so');
+#    my @libpaths = ('/usr/local/lib', '/usr/lib', $conf->data->get('libdir'));
+#    if ($^O eq 'MSWin32') {
+#        push @libpaths, (split /;/, $ENV{PATH});
+#        @libs = ('libparrot.dll', 'libparrot.lib', 'libparrot.dll.a');
+#    }
+#    if ($^O eq 'cygwin') {
+#        @libs = ('libparrot.dll.a');
+#    }
+#    if ($^O eq 'darwin'){
+#        @libs = qw/libparrot.dylib libparrot.a/;
+#    }
+#    if (defined $ENV{LD_LIBRARY_PATH}) {
+#        push @libpaths, (split /:/, $ENV{LD_LIBRARY_PATH});
+#    }
+#    if (defined $ENV{LD_RUN_PATH}) {
+#        push @libpaths, (split /:/, $ENV{LD_RUN_PATH});
+#    }
+#    if (defined $ENV{DYLD_LIBRARY_PATH}) {
+#        push @libpaths, (split /:/, $ENV{DYLD_LIBRARY_PATH});
+#    }
+    my @libs = get_libs();
+    my @libpaths = get_libpaths($conf);
     foreach my $f (@libs) {
         foreach my $d (@libpaths) {
             my $oldversion = File::Spec->catfile($d, $f);
@@ -164,6 +166,38 @@
     return 1;
 }
 
+sub get_libs {
+    my @libs = ('libparrot.so');
+    if ($^O eq 'MSWin32') {
+        @libs = ('libparrot.dll', 'libparrot.lib', 'libparrot.dll.a');
+    }
+    if ($^O eq 'cygwin') {
+        @libs = ('libparrot.dll.a');
+    }
+    if ($^O eq 'darwin'){
+        @libs = qw/libparrot.dylib libparrot.a/;
+    }
+    return @libs;
+}
+
+sub get_libpaths {
+    my $conf = shift;
+    my @libpaths = ('/usr/local/lib', '/usr/lib', $conf->data->get('libdir'));
+    if ($^O eq 'MSWin32') {
+        push @libpaths, (split /;/, $ENV{PATH});
+    }
+    if (defined $ENV{LD_LIBRARY_PATH}) {
+        push @libpaths, (split /:/, $ENV{LD_LIBRARY_PATH});
+    }
+    if (defined $ENV{LD_RUN_PATH}) {
+        push @libpaths, (split /:/, $ENV{LD_RUN_PATH});
+    }
+    if (defined $ENV{DYLD_LIBRARY_PATH}) {
+        push @libpaths, (split /:/, $ENV{DYLD_LIBRARY_PATH});
+    }
+    return @libpaths
+}
+
 1;
 
 # Local Variables:

Modified: branches/tt1452_configure_debug/t/steps/inter/libparrot-01.t
==============================================================================
--- branches/tt1452_configure_debug/t/steps/inter/libparrot-01.t	Mon May 31 17:21:49 2010	(r47232)
+++ branches/tt1452_configure_debug/t/steps/inter/libparrot-01.t	Mon May 31 17:58:52 2010	(r47233)
@@ -5,7 +5,7 @@
 
 use strict;
 use warnings;
-use Test::More tests => 48;
+use Test::More tests => 74;
 use Carp;
 use lib qw( lib t/configure/testlib );
 use_ok('config::inter::libparrot');
@@ -258,6 +258,101 @@
 $conf->data->set('has_dynamic_linking' => $has_dynamic_linking_orig);
 @prompts = ();
 
+##### get_libs() #####
+
+my %seen;
+{
+    local $^O = 'foobar';
+    %seen = map { $_ => 1 } inter::libparrot::get_libs();
+    is( scalar keys %seen, 1, "Got expected number of libs: generic" );
+    ok( $seen{'libparrot.so'}, "Got expected lib" );
+}
+
+{
+    local $^O = 'MSWin32';
+    %seen = map { $_ => 1 } inter::libparrot::get_libs();
+    is( scalar keys %seen, 3, "Got expected number of libs: Win32" );
+    is_deeply(
+        \%seen,
+        {
+            'libparrot.dll' => 1,
+            'libparrot.lib' => 1,
+            'libparrot.dll.a' => 1,
+        },
+        "Got expected libs"
+    );
+}
+
+{
+    local $^O = 'cygwin';
+    %seen = map { $_ => 1 } inter::libparrot::get_libs();
+    is( scalar keys %seen, 1, "Got expected number of libs: cygwin" );
+    is_deeply(
+        \%seen,
+        {
+            'libparrot.dll.a' => 1,
+        },
+        "Got expected libs"
+    );
+}
+
+{
+    local $^O = 'darwin';
+    %seen = map { $_ => 1 } inter::libparrot::get_libs();
+    is( scalar keys %seen, 2, "Got expected number of libs: darwin" );
+    is_deeply(
+        \%seen,
+        {
+            'libparrot.dylib' => 1,
+            'libparrot.a' => 1,
+        },
+        "Got expected libs"
+    );
+}
+
+##### get_libpaths() #####
+
+%seen = map { $_ => 1 } inter::libparrot::get_libpaths($conf);
+ok( $seen{'/usr/local/lib'}, "Got expected lib: generic" );
+ok( $seen{'/usr/lib'}, "Got expected lib: generic" );
+
+{
+    local $^O  = 'MSWin32';
+    local $ENV{PATH} = 'alpha;beta';
+    %seen = map { $_ => 1 } inter::libparrot::get_libpaths($conf);
+    ok( $seen{'/usr/local/lib'}, "Got expected lib: MSWin32" );
+    ok( $seen{'/usr/lib'}, "Got expected lib: MSWin32" );
+    ok( $seen{'alpha'}, "Got expected lib: MSWin32" );
+    ok( $seen{'beta'}, "Got expected lib: MSWin32" );
+}
+
+{
+    local $ENV{LD_LIBRARY_PATH} = 'alpha:beta';
+    %seen = map { $_ => 1 } inter::libparrot::get_libpaths($conf);
+    ok( $seen{'/usr/local/lib'}, "Got expected lib: LD_LIBRARY_PATH" );
+    ok( $seen{'/usr/lib'}, "Got expected lib: LD_LIBRARY_PATH" );
+    ok( $seen{'alpha'}, "Got expected lib: LD_LIBRARY_PATH" );
+    ok( $seen{'beta'}, "Got expected lib: LD_LIBRARY_PATH" );
+}
+
+{
+    local $ENV{LD_RUN_PATH} = 'alpha:beta';
+    %seen = map { $_ => 1 } inter::libparrot::get_libpaths($conf);
+    ok( $seen{'/usr/local/lib'}, "Got expected lib: LD_RUN_PATH" );
+    ok( $seen{'/usr/lib'}, "Got expected lib: LD_RUN_PATH" );
+    ok( $seen{'alpha'}, "Got expected lib: LD_RUN_PATH" );
+    ok( $seen{'beta'}, "Got expected lib: LD_RUN_PATH" );
+}
+
+{
+    local $ENV{DYLD_LIBRARY_PATH} = 'alpha:beta';
+    %seen = map { $_ => 1 } inter::libparrot::get_libpaths($conf);
+    ok( $seen{'/usr/local/lib'}, "Got expected lib: DYLD_LIBRARY_PATH" );
+    ok( $seen{'/usr/lib'}, "Got expected lib: DYLD_LIBRARY_PATH" );
+    ok( $seen{'alpha'}, "Got expected lib: DYLD_LIBRARY_PATH" );
+    ok( $seen{'beta'}, "Got expected lib: DYLD_LIBRARY_PATH" );
+}
+
 pass("Completed all tests in $0");
 
 ################### DOCUMENTATION ###################


More information about the parrot-commits mailing list