summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJohn E. Malmberg <wb8tyw@qsl.net>2007-08-21 17:44:58 -0500
committerCraig A. Berry <craigberry@mac.com>2007-08-24 21:08:33 +0000
commitffe7399b52f810b980234ebab70bc2f08d2f385c (patch)
treea6f59f8847f4094259b14928ea76c3980ec5f9f3 /ext
parent68a241fe37b258cd9c6f9e0293618e54be08f26b (diff)
downloadperl-ffe7399b52f810b980234ebab70bc2f08d2f385c.tar.gz
[patch@31739] ASTFLT in HiRes.t on VMS
From: "John E. Malmberg" <wb8tyw@qsl.net> Message-id: <46CBB13A.6090405@qsl.net> Skip test #17 because select() is not interruptible and we run afoul of Perl's signal deferrals. p4raw-id: //depot/perl@31752
Diffstat (limited to 'ext')
-rw-r--r--ext/Time/HiRes/t/HiRes.t92
1 files changed, 51 insertions, 41 deletions
diff --git a/ext/Time/HiRes/t/HiRes.t b/ext/Time/HiRes/t/HiRes.t
index d5504e877f..95046a43c0 100644
--- a/ext/Time/HiRes/t/HiRes.t
+++ b/ext/Time/HiRes/t/HiRes.t
@@ -261,47 +261,54 @@ unless ( defined &Time::HiRes::gettimeofday
sleep (0.5);
print "# sleep...", Time::HiRes::tv_interval($r), "\nok 16\n";
- $r = [Time::HiRes::gettimeofday()];
- $i = 5;
my $oldaction;
- if ($use_sigaction) {
- $oldaction = new POSIX::SigAction;
- printf "# sigaction tick, ALRM = %d\n", &POSIX::SIGALRM;
- # Perl's deferred signals may be too wimpy to break through
- # a restartable select(), so use POSIX::sigaction if available.
- POSIX::sigaction(&POSIX::SIGALRM, POSIX::SigAction->new("tick"),
- $oldaction)
- or die "Error setting SIGALRM handler with sigaction: $!\n";
- } else {
- print "# SIG tick\n";
- $SIG{ALRM} = "tick";
- }
- while ($i > 0)
- {
- alarm(0.3);
- select (undef, undef, undef, 3);
- my $ival = Time::HiRes::tv_interval ($r);
- print "# Select returned! $i $ival\n";
- print "# ", abs($ival/3 - 1), "\n";
- # Whether select() gets restarted after signals is
- # implementation dependent. If it is restarted, we
- # will get about 3.3 seconds: 3 from the select, 0.3
- # from the alarm. If this happens, let's just skip
- # this particular test. --jhi
- if (abs($ival/3.3 - 1) < $limit) {
- $ok = "Skip: your select() may get restarted by your SIGALRM (or just retry test)";
- undef $not;
- last;
+ # on VMS timers can not interrupt select.
+ if ($^O ne 'VMS') {
+ $r = [Time::HiRes::gettimeofday()];
+ $i = 5;
+ if ($use_sigaction) {
+ $oldaction = new POSIX::SigAction;
+ printf "# sigaction tick, ALRM = %d\n", &POSIX::SIGALRM;
+ # Perl's deferred signals may be too wimpy to break through
+ # a restartable select(), so use POSIX::sigaction if available.
+ POSIX::sigaction(&POSIX::SIGALRM, POSIX::SigAction->new("tick"),
+ $oldaction)
+ or die "Error setting SIGALRM handler with sigaction: $!\n";
+ } else {
+ print "# SIG tick\n";
+ $SIG{ALRM} = "tick";
}
- my $exp = 0.3 * (5 - $i);
- # This test is more sensitive, so impose a softer limit.
- if (abs($ival/$exp - 1) > 3*$limit) {
- my $ratio = abs($ival/$exp);
- $not = "while: $exp sleep took $ival ratio $ratio";
- last;
+
+ while ($i > 0)
+ {
+ alarm(0.3);
+ select (undef, undef, undef, 3);
+ my $ival = Time::HiRes::tv_interval ($r);
+ print "# Select returned! $i $ival\n";
+ print "# ", abs($ival/3 - 1), "\n";
+ # Whether select() gets restarted after signals is
+ # implementation dependent. If it is restarted, we
+ # will get about 3.3 seconds: 3 from the select, 0.3
+ # from the alarm. If this happens, let's just skip
+ # this particular test. --jhi
+ if (abs($ival/3.3 - 1) < $limit) {
+ $ok =
+ "Skip: your select() may get restarted by your SIGALRM (or just retry test)";
+ undef $not;
+ last;
+ }
+ my $exp = 0.3 * (5 - $i);
+ # This test is more sensitive, so impose a softer limit.
+ if (abs($ival/$exp - 1) > 3*$limit) {
+ my $ratio = abs($ival/$exp);
+ $not = "while: $exp sleep took $ival ratio $ratio";
+ last;
+ }
+ $ok = $i;
}
- $ok = $i;
+ } else {
+ $ok = "Skip: VMS select() does not get interrupted.";
}
sub tick
@@ -318,10 +325,13 @@ unless ( defined &Time::HiRes::gettimeofday
}
}
- if ($use_sigaction) {
- POSIX::sigaction(&POSIX::SIGALRM, $oldaction);
- } else {
- alarm(0); # can't cancel usig %SIG
+
+ if ($^O ne 'VMS') {
+ if ($use_sigaction) {
+ POSIX::sigaction(&POSIX::SIGALRM, $oldaction);
+ } else {
+ alarm(0); # can't cancel usig %SIG
+ }
}
print $not ? "not ok 17 # $not\n" : "ok 17 # $ok\n";