Skip to content

Commit 348450a

Browse files
committed
Remove upper bound check from timing spec
Under load, all impls may sleep too long for this spec, so we remove the upper bound check as in ruby/spec#1212.
1 parent f90901d commit 348450a

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

spec/ruby/core/kernel/sleep_spec.rb

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,15 @@ def o.divmod(*); [0, 0.001]; end
5151
t.value.should == 5
5252
end
5353

54-
platform_is_not :darwin do
55-
it "sleeps with nanosecond precision" do
56-
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
57-
100.times do
58-
sleep(0.0001)
59-
end
60-
end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
61-
62-
actual_duration = end_time - start_time
63-
(actual_duration > 0.01).should == true # 100 * 0.0001 => 0.01
64-
(actual_duration < 0.03).should == true
54+
it "sleeps with nanosecond precision" do
55+
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
56+
100.times do
57+
sleep(0.0001)
6558
end
59+
end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
60+
61+
actual_duration = end_time - start_time
62+
actual_duration.should > 0.01 # 100 * 0.0001 => 0.01
6663
end
6764

6865
ruby_version_is ""..."3.3" do

0 commit comments

Comments
 (0)