mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Workaround a CentOS bug in Process.clock_getres specs
This commit is contained in:
parent
14965c5f4b
commit
13abf5519a
1 changed files with 16 additions and 12 deletions
|
@ -11,20 +11,24 @@ describe "Process.clock_getres" do
|
||||||
end
|
end
|
||||||
reported = Process.clock_getres(value, :nanosecond)
|
reported = Process.clock_getres(value, :nanosecond)
|
||||||
|
|
||||||
# The clock should not be more accurate than reported (times should be
|
# CentOS seems to report a negative resolution:
|
||||||
# a multiple of reported precision.)
|
# https://rubyci.org/logs/rubyci.s3.amazonaws.com/centos6/ruby-trunk/log/20190428T093004Z.fail.html.gz
|
||||||
times.select { |t| t % reported > 0 }.should be_empty
|
unless name == :CLOCK_MONOTONIC_RAW and reported < 0
|
||||||
|
# The clock should not be more accurate than reported (times should be
|
||||||
|
# a multiple of reported precision.)
|
||||||
|
times.select { |t| t % reported > 0 }.should be_empty
|
||||||
|
|
||||||
# We're assuming precision is a multiple of ten - it may or may not
|
# We're assuming precision is a multiple of ten - it may or may not
|
||||||
# be an incompatibility if it isn't but we'd like to notice this,
|
# be an incompatibility if it isn't but we'd like to notice this,
|
||||||
# and the spec following these wouldn't work if it isn't.
|
# and the spec following these wouldn't work if it isn't.
|
||||||
reported.should > 0
|
reported.should > 0
|
||||||
(reported == 1 || reported % 10 == 0).should be_true
|
(reported == 1 || reported % 10 == 0).should be_true
|
||||||
|
|
||||||
# The clock should not be less accurate than reported (times should
|
# The clock should not be less accurate than reported (times should
|
||||||
# not all be a multiple of the next precision up, assuming precisions
|
# not all be a multiple of the next precision up, assuming precisions
|
||||||
# are multiples of ten.)
|
# are multiples of ten.)
|
||||||
times.select { |t| t % (reported * 10) == 0 }.size.should_not == times.size
|
times.select { |t| t % (reported * 10) == 0 }.size.should_not == times.size
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue