test/lib/test/unit.rb: do not propagate MAKEFLAGS to children

Propagating MAKEFLAGS to children running test/unit caused stuck
tests with GNU make when "-jN" is passed in both the make(1)
command-line and the "TESTS=" variable; because the forked child
process would see MAKEFLAGS and try to use jobserver on its own.

This is regression caused by r64399
(commit b53fadfd5f200dbd6fe9f4b2a91ebb68618e59bb,
"process.c: defaults to close_others false");
but that change also fixed a regression when close-on-exec
became the default in 2.0 :<

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
normal 2018-12-15 04:40:14 +00:00
parent 347ed2116c
commit 05da6568c2

View File

@ -136,8 +136,9 @@ module Test
def non_options(files, options)
@jobserver = nil
makeflags = ENV.delete("MAKEFLAGS")
if !options[:parallel] and
/(?:\A|\s)--jobserver-(?:auth|fds)=(\d+),(\d+)/ =~ ENV["MAKEFLAGS"]
/(?:\A|\s)--jobserver-(?:auth|fds)=(\d+),(\d+)/ =~ makeflags
begin
r = IO.for_fd($1.to_i(10), "rb", autoclose: false)
w = IO.for_fd($2.to_i(10), "wb", autoclose: false)