From f6ef4efaa46cdd5a3cd4aa6e3918f5eec9358557 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 10 Dec 2025 22:13:36 +0900 Subject: ZJIT: Add a test for `--zjit-stats=` option Fix up ruby/ruby#15414, 29c29c2b7e972359ab83038c5dc27a7e53ae65c7 --- test/ruby/test_zjit.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb index a2d4917886..805ecb98b2 100644 --- a/test/ruby/test_zjit.rb +++ b/test/ruby/test_zjit.rb @@ -49,6 +49,19 @@ class TestZJIT < Test::Unit::TestCase assert_success(out, err, status) refute_includes(err, stats_header) assert_equal("true\n", out) + + # With --zjit-stats=, stats should be printed to the path + Tempfile.create("zjit-stats-") {|tmp| + stats_file = tmp.path + tmp.puts("Lorem ipsum dolor sit amet, consectetur adipiscing elit, ...") + tmp.close + + out, err, status = eval_with_jit(script, stats: stats_file) + assert_success(out, err, status) + refute_includes(err, stats_header) + assert_equal("true\n", out) + assert_equal stats_header, File.open(stats_file) {|f| f.gets(chomp: true)}, "should be overwritten" + } end def test_enable_through_env -- cgit v1.2.3