From ceab460fcae4136404d3d85e4ac62620394a25a8 Mon Sep 17 00:00:00 2001 From: k0kubun Date: Fri, 27 Jul 2018 09:27:58 +0000 Subject: mjit.c: keep all .o files and lazily delete them on termination. This will be needed to create a large so file later. The large number of .o files will be probably compacted before the large so file is created. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_jit.rb | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'test/ruby') diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb index 92a7bd56d8..039a2ff35f 100644 --- a/test/ruby/test_jit.rb +++ b/test/ruby/test_jit.rb @@ -530,26 +530,31 @@ class TestJIT < Test::Unit::TestCase end def test_unload_units - # MIN_CACHE_SIZE is 10 - out, err = eval_with_jit("#{<<~"begin;"}\n#{<<~'end;'}", verbose: 1, min_calls: 1, max_cache: 10) - begin; - 10.times do |i| - eval(<<-EOS) - def mjit#{i} - print #{i} - end - mjit#{i} - EOS + Dir.mktmpdir("jit_test_clean_so_") do |dir| + # MIN_CACHE_SIZE is 10 + out, err = eval_with_jit({"TMPDIR"=>dir}, "#{<<~"begin;"}\n#{<<~'end;'}", verbose: 1, min_calls: 1, max_cache: 10) + begin; + 10.times do |i| + eval(<<-EOS) + def mjit#{i} + print #{i} + end + mjit#{i} + EOS + end + end; + assert_equal('0123456789', out) + errs = err.lines + assert_match(/\A#{JIT_SUCCESS_PREFIX}: block in
@-e:/, errs[0]) + 9.times do |i| + assert_match(/\A#{JIT_SUCCESS_PREFIX}: mjit#{i}@\(eval\):/, errs[i + 1]) end - end; - assert_equal('0123456789', out) - errs = err.lines - assert_match(/\A#{JIT_SUCCESS_PREFIX}: block in
@-e:/, errs[0]) - 9.times do |i| - assert_match(/\A#{JIT_SUCCESS_PREFIX}: mjit#{i}@\(eval\):/, errs[i + 1]) + assert_equal("Too many JIT code -- 1 units unloaded\n", errs[10]) + assert_match(/\A#{JIT_SUCCESS_PREFIX}: mjit9@\(eval\):/, errs[11]) + + # verify .o files are deleted on unload_units + assert_send([Dir, :empty?, dir]) end - assert_equal("Too many JIT code -- 1 units unloaded\n", errs[10]) - assert_match(/\A#{JIT_SUCCESS_PREFIX}: mjit9@\(eval\):/, errs[11]) end def test_local_stack_on_exception -- cgit v1.2.3