diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-04-28 12:37:29 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-04-28 12:37:29 +0200 |
commit | 5d24fba544352a32fdd4e06fa25dc0625c6860f1 (patch) | |
tree | db39c8a64ea5900aa27a609324fe5ca221d6892c /spec | |
parent | f40458e9dda3298df12f5b602f02afd4dfae334b (diff) | |
download | ruby-5d24fba544352a32fdd4e06fa25dc0625c6860f1.tar.gz |
Skip the entire Process.clock_getres spec on FreeBSD
* Clocks don't match the reported precision.
* https://rubyci.org/logs/rubyci.s3.amazonaws.com/freebsd11zfs/ruby-trunk/log/20190428T093003Z.fail.html.gz
Diffstat (limited to 'spec')
-rw-r--r-- | spec/ruby/core/process/clock_getres_spec.rb | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/spec/ruby/core/process/clock_getres_spec.rb b/spec/ruby/core/process/clock_getres_spec.rb index 0239f8a665..dc78fc4c88 100644 --- a/spec/ruby/core/process/clock_getres_spec.rb +++ b/spec/ruby/core/process/clock_getres_spec.rb @@ -2,30 +2,30 @@ require_relative '../../spec_helper' require_relative 'fixtures/clocks' describe "Process.clock_getres" do - ProcessSpecs.clock_constants.each do |name, value| - it "matches the clock in practice for Process::#{name}" do - times = [] - 10_000.times do - times << Process.clock_gettime(value, :nanosecond) - end - reported = Process.clock_getres(value, :nanosecond) + platform_is_not :freebsd do # clock_getres() seems incorrect on FreeBSD + ProcessSpecs.clock_constants.each do |name, value| + it "matches the clock in practice for Process::#{name}" do + times = [] + 10_000.times do + times << Process.clock_gettime(value, :nanosecond) + end + reported = Process.clock_getres(value, :nanosecond) - platform_is_not :bsd do # 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 - end - # 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, - # and the spec following these wouldn't work if it isn't. - reported.should > 0 - (reported == 1 || reported % 10 == 0).should be_true + # 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, + # and the spec following these wouldn't work if it isn't. + reported.should > 0 + (reported == 1 || reported % 10 == 0).should be_true - # 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 + # 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 + end end end |