diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2019-11-30 13:29:00 -0800 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2019-11-30 13:29:01 -0800 |
commit | 5b1f7f26b4ff3b05e1c184ae87154a323b1be915 (patch) | |
tree | 0d3120f93f438f30ceae3a17b00ab5452da3bfe9 /spec/ruby | |
parent | 1243255c3a36433041012b6107a5ac48658a0895 (diff) | |
download | ruby-5b1f7f26b4ff3b05e1c184ae87154a323b1be915.tar.gz |
Skip if getrusage is not supported
1243255c3a36433041012b6107a5ac48658a0895 broke ci.rvm.jp tests like
http://ci.rvm.jp/results/trunk_clang_39@silicon-docker/2445098.
253232c028a5565dbeecc05fab5e81b35ab58bcc works only if getrusage is supported.
Diffstat (limited to 'spec/ruby')
-rw-r--r-- | spec/ruby/core/process/times_spec.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/ruby/core/process/times_spec.rb b/spec/ruby/core/process/times_spec.rb index f148954262..32a566609d 100644 --- a/spec/ruby/core/process/times_spec.rb +++ b/spec/ruby/core/process/times_spec.rb @@ -16,6 +16,11 @@ describe "Process.times" do ruby_version_is "2.5" do platform_is_not :windows do it "uses getrusage when available to improve precision beyond milliseconds" do + times = 100.times.map { Process.clock_gettime(:GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID) } + if times.count { |t| ((t * 1e6).to_i % 1000) > 0 } == 0 + skip "getrusage is not supported on this environment" + end + times = 100.times.map { Process.times } times.count { |t| ((t.utime * 1e6).to_i % 1000) > 0 }.should > 0 times.count { |t| ((t.stime * 1e6).to_i % 1000) > 0 }.should > 0 |