mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Windows support for parallelization and instrumenter
Add Windows support for `ActiveSupport::Testing::Parallelization` and `ActiveSupport::Notifications::Instrumenter`.
This commit is contained in:
parent
fc2684c9c0
commit
0712dfd6ae
3 changed files with 8 additions and 3 deletions
|
@ -55,6 +55,11 @@ module ActiveSupport
|
|||
attr_reader :name, :time, :transaction_id, :payload, :children
|
||||
attr_accessor :end
|
||||
|
||||
def self.clock_gettime_supported? # :nodoc:
|
||||
defined?(Process::CLOCK_PROCESS_CPUTIME_ID) &&
|
||||
!Gem.win_platform?
|
||||
end
|
||||
|
||||
def initialize(name, start, ending, transaction_id, payload)
|
||||
@name = name
|
||||
@payload = payload.dup
|
||||
|
@ -130,7 +135,7 @@ module ActiveSupport
|
|||
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
||||
end
|
||||
|
||||
if defined?(Process::CLOCK_PROCESS_CPUTIME_ID)
|
||||
if clock_gettime_supported?
|
||||
def now_cpu
|
||||
Process.clock_gettime(Process::CLOCK_PROCESS_CPUTIME_ID)
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "drb"
|
||||
require "drb/unix"
|
||||
require "drb/unix" unless Gem.win_platform?
|
||||
require "active_support/core_ext/module/attribute_accessors"
|
||||
|
||||
module ActiveSupport
|
||||
|
|
|
@ -4,7 +4,7 @@ require 'rails/test_help'
|
|||
|
||||
class ActiveSupport::TestCase
|
||||
# Run tests in parallel with specified workers
|
||||
<% if defined?(JRUBY_VERSION) -%>
|
||||
<% if defined?(JRUBY_VERSION) || Gem.win_platform? -%>
|
||||
parallelize(workers: 2, with: :threads)
|
||||
<%- else -%>
|
||||
parallelize(workers: 2)
|
||||
|
|
Loading…
Reference in a new issue