mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_jit.rb: split the test concern
Actually unload_units is working on MinGW, but putiseq is behaving badly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d4381d2ceb
commit
ef3abac064
1 changed files with 17 additions and 14 deletions
|
@ -163,14 +163,18 @@ class TestJIT < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_compile_insn_putspecialobject_putiseq
|
def test_compile_insn_putspecialobject_putiseq
|
||||||
assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: 'hello', success_count: 2, insns: %i[putspecialobject putiseq])
|
if /mingw/ =~ RUBY_PLATFORM
|
||||||
|
skip "this is currently failing on MinGW [Bug #14948]"
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: 'hellohello', success_count: 2, insns: %i[putspecialobject putiseq])
|
||||||
begin;
|
begin;
|
||||||
print proc {
|
print 2.times.map {
|
||||||
def method_definition
|
def method_definition
|
||||||
'hello'
|
'hello'
|
||||||
end
|
end
|
||||||
method_definition
|
method_definition
|
||||||
}.call
|
}.join
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -534,37 +538,36 @@ class TestJIT < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_unload_units
|
def test_unload_units
|
||||||
if /mingw/ =~ RUBY_PLATFORM
|
|
||||||
skip "this is currently failing on MinGW [Bug #14948]"
|
|
||||||
end
|
|
||||||
|
|
||||||
Dir.mktmpdir("jit_test_unload_units_") do |dir|
|
Dir.mktmpdir("jit_test_unload_units_") do |dir|
|
||||||
# MIN_CACHE_SIZE is 10
|
# MIN_CACHE_SIZE is 10
|
||||||
out, err = eval_with_jit({"TMPDIR"=>dir}, "#{<<~"begin;"}\n#{<<~'end;'}", verbose: 1, min_calls: 1, max_cache: 10)
|
out, err = eval_with_jit({"TMPDIR"=>dir}, "#{<<~"begin;"}\n#{<<~'end;'}", verbose: 1, min_calls: 1, max_cache: 10)
|
||||||
begin;
|
begin;
|
||||||
10.times do |i|
|
i = 0
|
||||||
|
while i < 11
|
||||||
eval(<<-EOS)
|
eval(<<-EOS)
|
||||||
def mjit#{i}
|
def mjit#{i}
|
||||||
print #{i}
|
print #{i}
|
||||||
end
|
end
|
||||||
mjit#{i}
|
mjit#{i}
|
||||||
EOS
|
EOS
|
||||||
|
i += 1
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
assert_equal('0123456789', out)
|
assert_equal('012345678910', out)
|
||||||
compactions, errs = err.lines.partition do |l|
|
compactions, errs = err.lines.partition do |l|
|
||||||
l.match?(/\AJIT compaction \(\d+\.\dms\): Compacted \d+ methods ->/)
|
l.match?(/\AJIT compaction \(\d+\.\dms\): Compacted \d+ methods ->/)
|
||||||
end
|
end
|
||||||
assert_match(/\A#{JIT_SUCCESS_PREFIX}: block in <main>@-e:/, errs[0])
|
10.times do |i|
|
||||||
9.times do |i|
|
assert_match(/\A#{JIT_SUCCESS_PREFIX}: mjit#{i}@\(eval\):/, errs[i])
|
||||||
assert_match(/\A#{JIT_SUCCESS_PREFIX}: mjit#{i}@\(eval\):/, errs[i + 1])
|
|
||||||
end
|
end
|
||||||
assert_equal("Too many JIT code -- 1 units unloaded\n", errs[10])
|
assert_equal("Too many JIT code -- 1 units unloaded\n", errs[10])
|
||||||
assert_match(/\A#{JIT_SUCCESS_PREFIX}: mjit9@\(eval\):/, errs[11])
|
assert_match(/\A#{JIT_SUCCESS_PREFIX}: mjit10@\(eval\):/, errs[11])
|
||||||
|
|
||||||
# On --jit-wait, when the number of JIT-ed code reaches --jit-max-cache,
|
# On --jit-wait, when the number of JIT-ed code reaches --jit-max-cache,
|
||||||
# it should trigger compaction.
|
# it should trigger compaction.
|
||||||
assert_equal(2, compactions.size)
|
unless RUBY_PLATFORM.match?(/mswin|mingw/) # compaction is not supported on Windows yet
|
||||||
|
assert_equal(2, compactions.size)
|
||||||
|
end
|
||||||
|
|
||||||
# verify .o files are deleted on unload_units
|
# verify .o files are deleted on unload_units
|
||||||
assert_send([Dir, :empty?, dir])
|
assert_send([Dir, :empty?, dir])
|
||||||
|
|
Loading…
Add table
Reference in a new issue