Revision: 1055
Author: tim.bunce
Date: Tue Feb 16 02:19:33 2010
Log: Avoid tripping over $! bug
http://rt.perl.org/rt3/Ticket/Display.html?id=72850
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1055
Modified:
/trunk/t/50-errno.t
=======================================
--- /trunk/t/50-errno.t Sun Jul 12 11:04:41 2009
+++ /trunk/t/50-errno.t Tue Feb 16 02:19:33 2010
@@ -10,10 +10,13 @@
use Devel::NYTProf;
use Devel::NYTProf::Test qw(example_xsub example_sub);
+# We set errno to some particular non-zero value to see if NYTProf changes
it
+# (on many unix-like systems 3 is ESRCH 'No such process')
+my $dflterrno = 3;
# simple assignment and immediate check of $!
-$! = 9999;
-is 0+$!, 9999, '$! should not be altered by NYTProf';
+$! = $dflterrno;
+is 0+$!, $dflterrno, '$! should not be altered by NYTProf';
my $size1 = -s $nytprof_out;
cmp_ok $size1, '>=', 0, "$nytprof_out should exist";
@@ -23,23 +26,23 @@
cmp_ok $size1, '>', 0, "$nytprof_out should not be empty";
}
-$! = 9999;
+$! = $dflterrno;
example_sub();
-is 0+$!, 9999, "\$! should not be altered by assigning fids to previously
unprofiled modules ($!)";
-
-$! = 9999;
+is 0+$!, $dflterrno, "\$! should not be altered by assigning fids to
previously unprofiled modules ($!)";
+
+$! = $dflterrno;
example_xsub();
-is 0+$!, 9999, "\$! should not be altered by assigning fids to previously
unprofiled modules ($!)";
-
-$! = 9999;
+is 0+$!, $dflterrno, "\$! should not be altered by assigning fids to
previously unprofiled modules ($!)";
SKIP: {
skip 'On VMS buffer does not flush', 1 if($^O eq 'VMS');
+
+ $! = $dflterrno;
while (-s $nytprof_out == $size1) {
# execute lots of statements to force some i/o even if zipping
busy();
}
- is 0+$!, 9999, '$! should not be altered by NYTProf i/o';
+ is 0+$!, $dflterrno, '$! should not be altered by NYTProf i/o';
}
ok not eval { example_xsub(0, "die"); 1; };
--
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.
Group hosted at: http://groups.google.com/group/develnytprof-dev
Project hosted at: http://perl-devel-nytprof.googlecode.com
CPAN distribution: http://search.cpan.org/dist/Devel-NYTProf
To post, email: [email protected]
To unsubscribe, email: [email protected]