On Mon Jan 30 17:23:25 2012, ANDK wrote:
Show quoted text> As per subject.
>
> Sample fail report
>
>
http://www.cpantesters.org/cpan/report/19411844
>
> The commit fixed a refcounting bug, the test that now is failing also
> deals with refcounting. If the bugfix is valid, then the test has to
> change and vice verse.
The test needs to be adjusted. Within the map{} block, the refcount of $_ is temporarily
increased. The tests are getting the refcount from inside map blocks.
Attached is a patch that tweaks things a bit to get tests passing under 5.16. But if you want
a really robust test, you ought to test that the variables are freed when going out of scope, by
taking weak references to them and watching the weak references go stale (become undef).
diff -Nurp PerlIO-Util-0.72-JFmyPH-orig/t/06_tee.t PerlIO-Util-0.72-JFmyPH/t/06_tee.t
--- PerlIO-Util-0.72-JFmyPH-orig/t/06_tee.t 2012-04-11 10:45:27.000000000 -0700
+++ PerlIO-Util-0.72-JFmyPH/t/06_tee.t 2012-04-11 10:55:22.000000000 -0700
@@ -28,7 +28,8 @@ is tell($tee), length($x), 'tell == leng
ok close($tee), "close";
-is_deeply [ map{ Internals::SvREFCNT($_) } $x, $y, $z ], [1, 1, 1], "(refcnt aftere closed)";
+BEGIN{*rc = *Internals::SvREFCNT;}
+is_deeply [ rc($x), rc($y), rc($z) ], [1, 1, 1], "(refcnt aftere closed)";
open $tee, ">:scalar", \$x;
@@ -46,7 +47,7 @@ is $z, "bar", "to z";
ok close($tee), "close";
-is_deeply [ map{ Internals::SvREFCNT($_) } $x, $y, $z ], [1, 1, 1], "(refcnt aftere closed)";
+is_deeply [ rc($x), rc($y), rc($z) ], [1, 1, 1], "(refcnt aftere closed)";
# push filehandle