summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2026-01-20 15:35:50 -0500
committerAlan Wu <XrXr@users.noreply.github.com>2026-01-20 16:37:51 -0500
commit1bc51114114aae12f533e60e02a0dc606fb5d793 (patch)
treed70a0a9aab11370817d0a081fc7d79d29d529996 /test
parent9ad8dd00b1be782b7a053315bc4c00ff642c5fba (diff)
ZJIT: Add a smoke test for --zjit-trace-exits
Better than nothing!
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_zjit.rb25
1 files changed, 24 insertions, 1 deletions
diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb
index 2cfe9dd7e3..1cc43be971 100644
--- a/test/ruby/test_zjit.rb
+++ b/test/ruby/test_zjit.rb
@@ -4471,6 +4471,28 @@ class TestZJIT < Test::Unit::TestCase
}
end
+ def test_exit_tracing
+ # This is a very basic smoke test. The StackProf format
+ # this option generates is external to us.
+ Dir.mktmpdir("zjit_test_exit_tracing") do |tmp_dir|
+ assert_compiles('true', <<~RUBY, extra_args: ['-C', tmp_dir, '--zjit-trace-exits'])
+ def test(object) = object.itself
+
+ # induce an exit just for good measure
+ array = []
+ test(array)
+ test(array)
+ def array.itself = :not_itself
+ test(array)
+
+ RubyVM::ZJIT.exit_locations.is_a?(Hash)
+ RUBY
+ dump_files = Dir.glob('zjit_exits_*.dump', base: tmp_dir)
+ assert_equal(1, dump_files.length)
+ refute(File.empty?(File.join(tmp_dir, dump_files.first)))
+ end
+ end
+
private
# Assert that every method call in `test_script` can be compiled by ZJIT
@@ -4531,10 +4553,11 @@ class TestZJIT < Test::Unit::TestCase
stats: false,
debug: true,
allowed_iseqs: nil,
+ extra_args: nil,
timeout: 1000,
pipe_fd: nil
)
- args = ["--disable-gems"]
+ args = ["--disable-gems", *extra_args]
if zjit
args << "--zjit-call-threshold=#{call_threshold}"
args << "--zjit-num-profiles=#{num_profiles}"