diff options
| author | Takashi Kokubun <takashikkbn@gmail.com> | 2023-10-17 17:47:13 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-18 00:47:13 +0000 |
| commit | 7a3a98e2be69fd3fa68e6ee1afa43c3160f22254 (patch) | |
| tree | 65cb9f0b3293f685183d7045d8b4738606952ea5 | |
| parent | 36ee5d8ca824836e10ef18191d789a8b34f87fee (diff) | |
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>
| -rw-r--r-- | test/ruby/test_yjit.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb index d820b052b1..4066664600 100644 --- a/test/ruby/test_yjit.rb +++ b/test/ruby/test_yjit.rb @@ -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 |
