YJIT: Use RbConfig.ruby instead of EnvUtil.rubybin (#8689)
Some people encounter an issue that test_yjit uses the installed Ruby instead of the currently-running Ruby. It's fixed when they remove the installed Ruby. However, test_yjit should run the currently-running Ruby for testing YJIT in subprocesses. EnvUtil is unfortunately used outside tests as well, so for compatibility reasons, this commit only changes the argument given to EnvUtil.invoke_ruby to always use RbConfig.ruby. Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
This commit is contained in:
parent
36ee5d8ca8
commit
7a3a98e2be
@ -75,7 +75,7 @@ class TestYJIT < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
def test_yjit_stats_and_v_no_error
|
||||
_stdout, stderr, _status = EnvUtil.invoke_ruby(%w(-v --yjit-stats), '', true, true)
|
||||
_stdout, stderr, _status = invoke_ruby(%w(-v --yjit-stats), '', true, true)
|
||||
refute_includes(stderr, "NoMethodError")
|
||||
end
|
||||
|
||||
@ -1504,9 +1504,7 @@ class TestYJIT < Test::Unit::TestCase
|
||||
stats = stats_r.read
|
||||
stats_r.close
|
||||
end
|
||||
out, err, status = EnvUtil.invoke_ruby(args,
|
||||
'', true, true, timeout: timeout, ios: {3 => stats_w}
|
||||
)
|
||||
out, err, status = invoke_ruby(args, '', true, true, timeout: timeout, ios: { 3 => stats_w })
|
||||
stats_w.close
|
||||
stats_reader.join(timeout)
|
||||
stats = Marshal.load(stats) if !stats.empty?
|
||||
@ -1517,4 +1515,10 @@ class TestYJIT < Test::Unit::TestCase
|
||||
stats_r&.close
|
||||
stats_w&.close
|
||||
end
|
||||
|
||||
# A wrapper of EnvUtil.invoke_ruby that uses RbConfig.ruby instead of EnvUtil.ruby
|
||||
# that might use a wrong Ruby depending on your environment.
|
||||
def invoke_ruby(*args, **kwargs)
|
||||
EnvUtil.invoke_ruby(*args, rubybin: RbConfig.ruby, **kwargs)
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user