diff options
| author | Takashi Kokubun <takashikkbn@gmail.com> | 2023-12-19 11:47:27 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-19 11:47:27 -0800 |
| commit | bd91c5127ff30f5a21547e73a493c06fbd6da7ae (patch) | |
| tree | 461f5cd88079ac5c1ad47d050ad2a504acc4ade4 /test/ruby | |
| parent | 084b44e79dd456c9ce09ac06c6faf538160ac6b0 (diff) | |
YJIT: Add stats option to RubyVM::YJIT.enable (#9297)
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_yjit.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb index de96a85ded..9d3ec2f6fb 100644 --- a/test/ruby/test_yjit.rb +++ b/test/ruby/test_yjit.rb @@ -67,6 +67,29 @@ class TestYJIT < Test::Unit::TestCase RUBY end + def test_yjit_enable_stats + args = [] + args << "--disable=yjit" if RubyVM::YJIT.enabled? + assert_separately(args, <<~RUBY, ignore_stderr: true) + assert_false RubyVM::YJIT.enabled? + assert_nil RubyVM::YJIT.runtime_stats + + RubyVM::YJIT.enable(stats: true) + + assert_true RubyVM::YJIT.enabled? + assert_true RubyVM::YJIT.runtime_stats[:all_stats] + RUBY + end + + def test_yjit_enable_stats_quiet + assert_in_out_err(['--yjit-disable', '-e', 'RubyVM::YJIT.enable(stats: true)']) do |_stdout, stderr, _status| + assert_not_empty stderr + end + assert_in_out_err(['--yjit-disable', '-e', 'RubyVM::YJIT.enable(stats: :quiet)']) do |_stdout, stderr, _status| + assert_empty stderr + end + end + def test_yjit_enable_with_call_threshold assert_separately(%w[--yjit-disable --yjit-call-threshold=1], <<~RUBY) def not_compiled = nil |
