1
0
Fork 0
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:
k0kubun 2018-08-02 15:35:05 +00:00
parent d4381d2ceb
commit ef3abac064

View file

@ -163,14 +163,18 @@ class TestJIT < Test::Unit::TestCase
end
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;
print proc {
print 2.times.map {
def method_definition
'hello'
end
method_definition
}.call
}.join
end;
end
@ -534,37 +538,36 @@ class TestJIT < Test::Unit::TestCase
end
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|
# 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|
i = 0
while i < 11
eval(<<-EOS)
def mjit#{i}
print #{i}
end
mjit#{i}
EOS
i += 1
end
end;
assert_equal('0123456789', out)
assert_equal('012345678910', out)
compactions, errs = err.lines.partition do |l|
l.match?(/\AJIT compaction \(\d+\.\dms\): Compacted \d+ methods ->/)
end
assert_match(/\A#{JIT_SUCCESS_PREFIX}: block in <main>@-e:/, errs[0])
9.times do |i|
assert_match(/\A#{JIT_SUCCESS_PREFIX}: mjit#{i}@\(eval\):/, errs[i + 1])
10.times do |i|
assert_match(/\A#{JIT_SUCCESS_PREFIX}: mjit#{i}@\(eval\):/, errs[i])
end
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,
# it should trigger compaction.
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
assert_send([Dir, :empty?, dir])