Merge pull request #2872 from MikeMcQuaid/fix-high-sierra-tests
Fix `brew tests` on High Sierra.
This commit is contained in:
commit
287ba7a6af
@ -11,7 +11,9 @@ raise "Homebrew must be run under Ruby 2!" unless RUBY_TWO
|
|||||||
require "pathname"
|
require "pathname"
|
||||||
HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent
|
HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent
|
||||||
require "English"
|
require "English"
|
||||||
$LOAD_PATH.unshift(HOMEBREW_LIBRARY_PATH.to_s)
|
unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s)
|
||||||
|
$LOAD_PATH.unshift(HOMEBREW_LIBRARY_PATH.to_s)
|
||||||
|
end
|
||||||
require "global"
|
require "global"
|
||||||
require "tap"
|
require "tap"
|
||||||
|
|
||||||
|
|||||||
@ -77,20 +77,37 @@ RSpec.shared_context "integration test" do
|
|||||||
"HOMEBREW_INTEGRATION_TEST" => command_id_from_args(args),
|
"HOMEBREW_INTEGRATION_TEST" => command_id_from_args(args),
|
||||||
"HOMEBREW_TEST_TMPDIR" => TEST_TMPDIR,
|
"HOMEBREW_TEST_TMPDIR" => TEST_TMPDIR,
|
||||||
"HOMEBREW_DEVELOPER" => ENV["HOMEBREW_DEVELOPER"],
|
"HOMEBREW_DEVELOPER" => ENV["HOMEBREW_DEVELOPER"],
|
||||||
|
"GEM_HOME" => nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ruby_args ||= begin
|
||||||
ruby_args = [
|
ruby_args = [
|
||||||
"-W0",
|
"-W0",
|
||||||
"-I", "#{HOMEBREW_LIBRARY_PATH}/test/support/lib",
|
"-I", "#{HOMEBREW_LIBRARY_PATH}/test/support/lib",
|
||||||
"-I", HOMEBREW_LIBRARY_PATH.to_s,
|
"-I", HOMEBREW_LIBRARY_PATH.to_s,
|
||||||
"-rconfig"
|
"-rconfig"
|
||||||
]
|
]
|
||||||
ruby_args << "-rsimplecov" if ENV["HOMEBREW_TESTS_COVERAGE"]
|
if ENV["HOMEBREW_TESTS_COVERAGE"]
|
||||||
|
simplecov_spec = Gem.loaded_specs["simplecov"]
|
||||||
|
specs = simplecov_spec.runtime_dependencies.flat_map(&:to_specs)
|
||||||
|
specs << simplecov_spec
|
||||||
|
libs = specs.flat_map do |spec|
|
||||||
|
full_gem_path = spec.full_gem_path
|
||||||
|
# full_require_paths isn't available in RubyGems < 2.2.
|
||||||
|
spec.require_paths.map do |lib|
|
||||||
|
next lib if lib.include?(full_gem_path)
|
||||||
|
"#{full_gem_path}/#{lib}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
libs.each { |lib| ruby_args << "-I" << lib }
|
||||||
|
ruby_args << "-rsimplecov"
|
||||||
|
end
|
||||||
ruby_args << "-rtest/support/helper/integration_mocks"
|
ruby_args << "-rtest/support/helper/integration_mocks"
|
||||||
ruby_args << (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path.to_s
|
ruby_args << (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path.to_s
|
||||||
|
end
|
||||||
|
|
||||||
Bundler.with_original_env do
|
Bundler.with_clean_env do
|
||||||
stdout, stderr, status = Open3.capture3(env, RUBY_PATH, *ruby_args, *args)
|
stdout, stderr, status = Open3.capture3(env, RUBY_PATH, *@ruby_args, *args)
|
||||||
$stdout.print stdout
|
$stdout.print stdout
|
||||||
$stderr.print stderr
|
$stderr.print stderr
|
||||||
status
|
status
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user