On Wed, Mar 09, 2011 at 09:38:30AM -0800, Pascal Stumpf wrote: > The sleep.t test lets perl6 sleep for three seconds, but allows for a > range of 2-10 seconds when checking the 'real' sleep time. This is way > too tolerant and would have almost hidden a nasty bug in parrot's sleep > function on OpenBSD when parrot is threaded.
Which part are you claiming is too tolerant -- the "2" or the "10"? As far as I know, there's no guarantee with C<sleep> that execution will resume immediately (or even shortly) after the specified number of seconds has elapsed. So, technically speaking with respect to the specification, I suppose that one could claim that sleeping for any amount of time greater than the amount requested is valid, and we should eliminate the tests for resumption after 10 seconds. (Yes, this would make the test even more "tolerant" than it is now. But AFAIK requiring that C<sleep 3> should not take longer than ten seconds, as the current test does, isn't really conformant with the Perl 6 specification. A system that takes 11 seconds to resume execution after C<sleep 3> isn't really in error.) As far as the "2" test goes, we might want to switch the test to use C<now> instead of C<time>, since C<now> offers sub-second values, and then verify that sleep does consume at least 3.0 seconds before returning. While researching this ticket, I notice that S29 has a C<sleep> function defined (line 246); this seems to be in contradicition with S03 which defines a prefix:<sleep> operator. This contradiction likely needs resolving. Pm