summaryrefslogtreecommitdiff
path: root/spec/ruby/core/process/clock_getres_spec.rb
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2019-05-20 14:39:46 +0900
committerKoichi Sasada <ko1@atdot.net>2019-05-20 14:43:04 +0900
commitab0f2deab11a3203f9af3af1a27dfea1f4a882f3 (patch)
treefb3bf951a5bb1358c8afd7ad71718b4e58b24455 /spec/ruby/core/process/clock_getres_spec.rb
parent7ef548c0acf2f8b62db234e39a0f1030902a305c (diff)
skip a test for CLOCK_MONOTONIC_RAW.
On my Linux guest machine on Hyper-V, I got an error. Process.clock_gettime(CLOCK_MONOTONIC_RAW, :nanosecond) returns like: ... 875573945119100 875573945119600 ... even if `Process.clock_getres(value, :nanosecond)` returns 1. So I simply skip this test for CLOCK_MONOTONIC_RAW.
Diffstat (limited to 'spec/ruby/core/process/clock_getres_spec.rb')
-rw-r--r--spec/ruby/core/process/clock_getres_spec.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/spec/ruby/core/process/clock_getres_spec.rb b/spec/ruby/core/process/clock_getres_spec.rb
index 0fc2a958b3..d95272f6c7 100644
--- a/spec/ruby/core/process/clock_getres_spec.rb
+++ b/spec/ruby/core/process/clock_getres_spec.rb
@@ -24,7 +24,12 @@ describe "Process.clock_getres" do
# The clock should not be less accurate than reported (times should
# not all be a multiple of the next precision up, assuming precisions
# are multiples of ten.)
- times.select { |t| t % (reported * 10) == 0 }.size.should_not == times.size
+
+ if name != :CLOCK_MONOTONIC_RAW
+ # On a Hyper-V Linux guest machine, CLOCK_MONOTONIC_RAW can violate
+ # this assertion. So skipping this test for CLOCK_MONOTONIC_RAW.
+ times.select { |t| t % (reported * 10) == 0 }.size.should_not == times.size
+ end
end
end
end