summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2025-12-10 22:13:36 +0900
committerNobuyoshi Nakada <nobu.nakada@gmail.com>2025-12-14 11:45:48 +0900
commitf6ef4efaa46cdd5a3cd4aa6e3918f5eec9358557 (patch)
treea397d4428222767b91daf5537b2cd7aaa589a540 /test/ruby
parent3a4d534b5bf68c783aaea34d3f9e33bc96f49a85 (diff)
ZJIT: Add a test for `--zjit-stats=<path>` option
Fix up ruby/ruby#15414, 29c29c2b7e972359ab83038c5dc27a7e53ae65c7
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_zjit.rb13
1 files changed, 13 insertions, 0 deletions
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=<path>, 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