summaryrefslogtreecommitdiff
path: root/ext/DynaLoader
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-12-10 06:19:14 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-12-10 06:19:14 -0800
commited57bf8d26295a956cc0a2b7959fd1088d7f8b2f (patch)
treef94798a597c2beac375b96b72618780605e78bbb /ext/DynaLoader
parent49bb71aec3ca9a185f018c6b8f85bad3580522af (diff)
downloadperl-ed57bf8d26295a956cc0a2b7959fd1088d7f8b2f.tar.gz
Stop DynaLoader.t from unload File::Glob
File::Glob now sets PL_opfreehook. That means that if we unload it we will leave PL_opfreehook pointing to an invalid address, resulting in a crash when ops are freed. I didn’t catch this because the tests are skipped on darwin. They don’t actually need to be, at least under recent versions, so I modi- fied the skip code.
Diffstat (limited to 'ext/DynaLoader')
-rw-r--r--ext/DynaLoader/t/DynaLoader.t10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/DynaLoader/t/DynaLoader.t b/ext/DynaLoader/t/DynaLoader.t
index 32b6a1b458..57f1e4809f 100644
--- a/ext/DynaLoader/t/DynaLoader.t
+++ b/ext/DynaLoader/t/DynaLoader.t
@@ -32,6 +32,11 @@ plan tests => 22 + keys(%modules) * 3;
# Try to load the module
use_ok( 'DynaLoader' );
+# Some tests need to be skipped on old Darwin versions.
+# Commit ce12ed1954 added the skip originally, without specifying which
+# darwin version needed it. I know OS X 10.6 (Snow Leopard; darwin 10)
+# supports it, so skip anything before that.
+my $old_darwin = $^O eq 'darwin' && ($Config{osvers} =~ /^(\d+)/)[0] < 10;
# Check functions
can_ok( 'DynaLoader' => 'bootstrap' ); # defined in Perl section
@@ -43,7 +48,7 @@ if ($Config{usedl}) {
can_ok( 'DynaLoader' => 'dl_load_file' ); # defined in XS section
can_ok( 'DynaLoader' => 'dl_undef_symbols' ); # defined in XS section
SKIP: {
- skip "unloading unsupported on $^O", 1 if ($^O eq 'VMS' || $^O eq 'darwin');
+ skip "unloading unsupported on $^O", 1 if ($old_darwin || $^O eq 'VMS');
can_ok( 'DynaLoader' => 'dl_unload_file' ); # defined in XS section
}
} else {
@@ -137,8 +142,9 @@ is( scalar @DynaLoader::dl_modules, scalar keys %modules, "checking number of it
my @loaded_modules = @DynaLoader::dl_modules;
for my $libref (reverse @DynaLoader::dl_librefs) {
SKIP: {
- skip "unloading unsupported on $^O", 2 if ($^O eq 'VMS' || $^O eq 'darwin');
+ skip "unloading unsupported on $^O", 2 if ($old_darwin || $^O eq 'VMS');
my $module = pop @loaded_modules;
+ skip "File::Glob sets PL_opfreehook", 2 if $module eq 'File::Glob';
my $r = eval { DynaLoader::dl_unload_file($libref) };
is( $@, '', "calling dl_unload_file() for $module" );
is( $r, 1, " - unload was successful" );