diff options
author | David Mitchell <davem@iabyn.com> | 2010-04-11 15:23:17 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2010-04-11 15:26:25 +0100 |
commit | d97c33b505dd45c052a8bf42014917701b4502a5 (patch) | |
tree | 2167944035ac32eb8b0336db0cbd451ee69aef38 /ext | |
parent | 27e904532594b7fb224bdf9a05bf3b5336b8a39e (diff) | |
download | perl-d97c33b505dd45c052a8bf42014917701b4502a5.tar.gz |
create SV leak test infrastructure
Add an sv_count() function to XS::APItest to allow access to PL_sv_count,
then add new test file t/op/svleak.t that allows you yo run a code
fragment a few times and test whether the number of allocated SVs has
increased
Diffstat (limited to 'ext')
-rw-r--r-- | ext/XS-APItest/APItest.pm | 5 | ||||
-rw-r--r-- | ext/XS-APItest/APItest.xs | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/ext/XS-APItest/APItest.pm b/ext/XS-APItest/APItest.pm index 11766f47ac..b1767931b9 100644 --- a/ext/XS-APItest/APItest.pm +++ b/ext/XS-APItest/APItest.pm @@ -24,6 +24,7 @@ our @EXPORT = qw( print_double print_int print_long sv_setsv_cow_hashkey_core sv_setsv_cow_hashkey_notcore rmagical_cast rmagical_flags DPeek utf16_to_utf8 utf16_to_utf8_reversed pmflag my_exit + sv_count ); our $VERSION = '0.17'; @@ -84,8 +85,8 @@ XS::APItest - Test the perl C API =head1 ABSTRACT -This module tests the perl C API. Currently tests that C<printf> -works correctly. +This module tests the perl C API. Also exposes various bit of the perl +internals for the use of core test scripts. =head1 DESCRIPTION diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs index ede69949a1..328ddea42f 100644 --- a/ext/XS-APItest/APItest.xs +++ b/ext/XS-APItest/APItest.xs @@ -936,3 +936,10 @@ void my_exit(int exitcode) PPCODE: my_exit(exitcode); + +I32 +sv_count() + CODE: + RETVAL = PL_sv_count; + OUTPUT: + RETVAL |