[前][次][番号順一覧][スレッド一覧]

ruby-changes:55593

From: Benoit <ko1@a...>
Date: Sun, 28 Apr 2019 22:25:31 +0900 (JST)
Subject: [ruby-changes:55593] Benoit Daloze:d906dd87b0 (trunk): Skip CLOCK_UPTIME_RAW_APPROX since it seems less precise than advertised on macOS

https://git.ruby-lang.org/ruby.git/commit/?id=d906dd87b0

From d906dd87b049e84fc9a17b89a74fdd52d40c5fbb Mon Sep 17 00:00:00 2001
From: Benoit Daloze <eregontp@g...>
Date: Sun, 28 Apr 2019 15:23:12 +0200
Subject: Skip CLOCK_UPTIME_RAW_APPROX since it seems less precise than
 advertised on macOS

* See https://travis-ci.org/ruby/ruby/jobs/525595997

diff --git a/spec/ruby/core/process/clock_getres_spec.rb b/spec/ruby/core/process/clock_getres_spec.rb
index c745902..b6353fe 100644
--- a/spec/ruby/core/process/clock_getres_spec.rb
+++ b/spec/ruby/core/process/clock_getres_spec.rb
@@ -27,7 +27,7 @@ describe "Process.clock_getres" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/process/clock_getres_spec.rb#L27
           # 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
+          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 e3f5319..c04ae77 100644
--- a/spec/ruby/core/process/fixtures/clocks.rb
+++ b/spec/ruby/core/process/fixtures/clocks.rb
@@ -26,6 +26,13 @@ module ProcessSpecs https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/process/fixtures/clocks.rb#L26
       }
     end
 
+    # These clocks in practice on macOS seem to be less precise than advertised by clock_getres
+    platform_is :darwin do
+      clocks = clocks.reject { |clock, value|
+        [:CLOCK_UPTIME_RAW_APPROX].include?(clock)
+      }
+    end
+
     # These clocks in practice on ARM on Linux do not seem to match their reported resolution.
     platform_is :armv7l, :aarch64 do
       clocks = clocks.reject { |clock, value|
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]