Revision history for Test-Valgrind
+0.05 2008-08-25 22:05 UTC
+ + Chg : Lower the default caller to 12.
+ + Tst : Add a real-life test that gets executed only if you have a C
+ compiler.
+
0.04 2008-05-13 16:25 UTC
+ Chg : Don't smoke this on 5.005 please.
+ Chg : Better way to find the valgrind executable.
Test::Valgrind - Test Perl code through valgrind.
VERSION
- Version 0.04
+ Version 0.05
SYNOPSIS
use Test::More;
perl -MTest::Valgrind leaky.pl
+ Due to the nature of perl's memory allocator, this module can't track
+ leaks of Perl objects. This includes non-mortalized scalars and memory
+ cycles. However, it can track leaks of chunks of memory allocated in XS
+ extensions with "Newx" and friends or "malloc". As such, it's
+ complementary to the other very good leak detectors listed in the "SEE
+ ALSO" section.
+
CONFIGURATION
You can pass parameters to "import" as a list of key / value pairs,
where valid keys are :
- "supp => $file"
+ * "supp => $file"
+
Also use suppressions from $file besides perl's.
- "no_supp => $bool"
+ * "no_supp => $bool"
+
If true, do not use any suppressions.
- "callers => $number"
+ * "callers => $number"
+
Specify the maximum stack depth studied when valgrind encounters an
- error. Raising this number improves granularity. Default is 50.
+ error. Raising this number improves granularity. Default is 12.
+
+ * "extra => [ @args ]"
- "extra => [ @args ]"
Add @args to valgrind parameters.
- "diag => $bool"
+ * "diag => $bool"
+
If true, print the raw output of valgrind as diagnostics (may be
quite verbose).
- "no_test => $bool"
+ * "no_test => $bool"
+
If true, do not actually output the plan and the tests results.
+ * "cb => sub { my ($val, $name) = @_; ...; return $passed }"
+
+ Specifies a subroutine to execute for each test instead of
+ "Test::More::is". It receives the number of bytes leaked in $_[0]
+ and the test name in $_[1], and is expected to return true if the
+ test passed and false otherwise. Defaults to
+
+ sub {
+ is($_[0], 0, $_[1]);
+ (defined $_[0] and $_[0] == 0) : 1 : 0
+ }
+
CAVEATS
You can't use this module to test code given by the "-e" command-line
switch.
Perl::Destruct::Level.
+SEE ALSO
+ Devel::Leak, Devel::LeakTrace, Devel::LeakTrace::Fast.
+
AUTHOR
Vincent Pit, "<perl at profvince.com>", <http://www.profvince.com>.