[rubygems/rubygems] Fix assert_contains_make_command on make defined by environment variable.

The `parse_make_command_line` in `assert_contains_make_command` fails to get
the make targets correctly, when the make command is set with make options by
environment variable such as `export make='make -j2'` at
lib/rubygems/ext/builder.rb::make.

So, we include the make options (eg, -XX) as a part of the command to fix the
case. Note that this commit still doesn't fix the case of
`export make='make -j 2'`.

https://github.com/rubygems/rubygems/commit/7730ef3fa0
This commit is contained in:
Jun Aruga 2021-10-15 13:47:32 +02:00 коммит произвёл git
Родитель ec6352c108
Коммит d713b602ea
2 изменённых файлов: 9 добавлений и 5 удалений

Просмотреть файл

@ -246,7 +246,7 @@ class Gem::TestCase < Test::Unit::TestCase
end end
def parse_make_command_line(line) def parse_make_command_line(line)
command, *args = line.shellsplit args = line.sub(/^#{Regexp.escape make_command}/, "").shellsplit
targets = [] targets = []
macros = {} macros = {}
@ -263,7 +263,7 @@ class Gem::TestCase < Test::Unit::TestCase
targets << '' if targets.empty? targets << '' if targets.empty?
{ {
:command => command, :command => make_command,
:targets => targets, :targets => targets,
:macros => macros, :macros => macros,
} }

Просмотреть файл

@ -66,8 +66,11 @@ class TestGemExtExtConfBuilder < Gem::TestCase
end end
end end
def test_class_build_env_make def test_class_build_env_MAKE
env_make = ENV.delete 'MAKE' env_make = ENV.delete 'make'
ENV['make'] = nil
env_MAKE = ENV.delete 'MAKE'
ENV['MAKE'] = 'anothermake' ENV['MAKE'] = 'anothermake'
if java_platform? if java_platform?
@ -89,7 +92,8 @@ class TestGemExtExtConfBuilder < Gem::TestCase
assert_contains_make_command 'clean', output[4] assert_contains_make_command 'clean', output[4]
end end
ensure ensure
ENV['MAKE'] = env_make ENV['MAKE'] = env_MAKE
ENV['make'] = env_make
end end
def test_class_build_extconf_fail def test_class_build_extconf_fail