Merge pull request #34410 from gmcgibbon/test_support_windows

Windows support for parallelization and instrumenter
This commit is contained in:
Eileen M. Uchitelle 2018-11-19 09:35:55 -08:00 committed by GitHub
commit 9893998f4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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)