Skip to content

Commit

Permalink
skip a test for CLOCK_MONOTONIC_RAW.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ko1 authored and eregon committed May 28, 2019
1 parent 927a347 commit ec48b92
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/process/clock_getres_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@
# 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
Expand Down

0 comments on commit ec48b92

Please sign in to comment.