ZJIT: Add a test for --zjit-stats=<path> option

Fix up ruby/ruby#15414, 29c29c2b7e972359ab83038c5dc27a7e53ae65c7
This commit is contained in:
Nobuyoshi Nakada 2025-12-10 22:13:36 +09:00 committed by Nobuyoshi Nakada
parent 3a4d534b5b
commit f6ef4efaa4
Notes: git 2025-12-14 02:46:16 +00:00

View File

@ -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