From: Vincent Pit Date: Sun, 8 Feb 2009 00:32:47 +0000 (+0100) Subject: Unload dynamically loaded libraries at END-time X-Git-Tag: v0.08~5 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FTest-Valgrind.git;a=commitdiff_plain;h=1990c796ff7ec945e5a48d1601b3fd7547c479d3 Unload dynamically loaded libraries at END-time This solves the leaks due to DynaLoader. --- diff --git a/lib/Test/Valgrind.pm b/lib/Test/Valgrind.pm index 31a6323..e70a912 100644 --- a/lib/Test/Valgrind.pm +++ b/lib/Test/Valgrind.pm @@ -231,6 +231,12 @@ sub import { } } +END { + if ($run and eval { require DynaLoader; 1 }) { + DynaLoader::dl_unload_file($_) for @DynaLoader::dl_librefs; + } +} + =head1 CAVEATS You can't use this module to test code given by the C<-e> command-line switch. diff --git a/t/30-bad.t b/t/30-bad.t index 7ceb62c..1170587 100644 --- a/t/30-bad.t +++ b/t/30-bad.t @@ -26,7 +26,7 @@ sub tester { $dbg = $@ ? 0 : $ret; } } - if ($desc =~ /still\s+reachable/) { + if ($desc =~ /definitely\s+lost/) { $passed = $a >= 9900 && $a < 10100; if ($dbg) { ok($passed, $desc);