summaryrefslogtreecommitdiff
path: root/spec/ruby/core/process
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-04-28 23:16:03 +0200
committerBenoit Daloze <eregontp@gmail.com>2019-04-28 23:17:42 +0200
commitbbb93608a385242da93bc5256a90a6376981d86f (patch)
treec96873475c53ba8312e50047a7c1658ced019397 /spec/ruby/core/process
parentdfc0eeb0cfb22efde6369f275d3a28c29144d9a6 (diff)
Move the check for CentOS CLOCK_MONOTONIC_RAW next to others
* Fixes "No behavior expectation was found in the example" * https://rubyci.org/logs/rubyci.s3.amazonaws.com/centos6/ruby-trunk/log/20190428T093004Z.fail.html.gz
Diffstat (limited to 'spec/ruby/core/process')
-rw-r--r--spec/ruby/core/process/clock_getres_spec.rb32
-rw-r--r--spec/ruby/core/process/fixtures/clocks.rb7
2 files changed, 21 insertions, 18 deletions
diff --git a/spec/ruby/core/process/clock_getres_spec.rb b/spec/ruby/core/process/clock_getres_spec.rb
index b6353fea64..0fc2a958b3 100644
--- a/spec/ruby/core/process/clock_getres_spec.rb
+++ b/spec/ruby/core/process/clock_getres_spec.rb
@@ -11,24 +11,20 @@ describe "Process.clock_getres" do
end
reported = Process.clock_getres(value, :nanosecond)
- # CentOS seems to report a negative resolution:
- # https://rubyci.org/logs/rubyci.s3.amazonaws.com/centos6/ruby-trunk/log/20190428T093004Z.fail.html.gz
- 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
- # 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
- end
+ # 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
+ # 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
end
end
end
diff --git a/spec/ruby/core/process/fixtures/clocks.rb b/spec/ruby/core/process/fixtures/clocks.rb
index c04ae7785f..f8ec0f0a20 100644
--- a/spec/ruby/core/process/fixtures/clocks.rb
+++ b/spec/ruby/core/process/fixtures/clocks.rb
@@ -40,6 +40,13 @@ module ProcessSpecs
}
end
+ # CentOS seems to report a negative resolution for CLOCK_MONOTONIC_RAW
+ platform_is :linux do
+ clocks = clocks.reject { |clock, value|
+ clock == :CLOCK_MONOTONIC_RAW and Process.clock_getres(value, :nanosecond) < 0
+ }
+ end
+
clocks
end
end