diff options
author | Chuck D. Phillips <cdp@hpescdp.fc.hp.com> | 1997-05-15 11:35:41 -0600 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1997-05-16 10:15:00 +1200 |
commit | df8c8771ccb7761fbad9e6985c60a1d65491a7ab (patch) | |
tree | 0deea8699c46a0d648d73cdd59549e27c82a7212 /t | |
parent | 270f084f72d3854a3d222dae2eafa2c6318f6bfc (diff) | |
download | perl-df8c8771ccb7761fbad9e6985c60a1d65491a7ab.tar.gz |
Fix sleep test: sleep(N) is defined to allow sleeping N-1
> But I found minor problem here. In some situation, BSD/OS sleep does
> not sleep two seconds (at least in my configuration) and it says
> op/sleep.t failure. If I ran the test suite again, it passed and show
> me 100% OK result.
I just read over t/op/sleep.t. Frankly, I'm suprised I haven't seen
it fail on HPUX also. On HPUX, SIGALRM is delivered only _on_ the
second. Thus, sleep(1) waits until the next even second, sleep(2)
waits until the next even second after that, etc.
The side effect of this is that sleep(1) causes a delay of 0-1 second,
sleep(2) causes a delay of 1-2 seconds, etc. This *should* cause
intermittant failure of the sleep test as currently written. I don't
have access to a BSD system, but something similar could be happening
there.
You could argue that this is a bug in the OS sleep(). However, it
means that a loop like...
while (foo()) {
bar();
sleep();
}
...will cycle once-per-second (as long as bar() executes in < 1
second) instead of cycling once-per-(second + bar()-delay). This
could be construed as a feature.
p5p-msgid: 199705151735.KAA01143@palrel1.hp.com
Diffstat (limited to 't')
-rwxr-xr-x | t/op/sleep.t | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/t/op/sleep.t b/t/op/sleep.t index 07cdb826d1..5f6c4c0bbb 100755 --- a/t/op/sleep.t +++ b/t/op/sleep.t @@ -4,5 +4,5 @@ print "1..1\n"; -$x = sleep 2; +$x = sleep 3; if ($x >= 2 && $x <= 10) {print "ok 1\n";} else {print "not ok 1 $x\n";} |