1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Clean up /tmp leftovers in ci.rvm.jp

This commit is contained in:
Takashi Kokubun 2020-03-28 15:19:06 -07:00
parent addf43d7d5
commit 92c25114ab
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD

View file

@ -38,22 +38,37 @@ class TestJIT < Test::Unit::TestCase
@untested_insns ||= (RubyVM::INSTRUCTION_NAMES.map(&:to_sym) - TEST_PENDING_INSNS) @untested_insns ||= (RubyVM::INSTRUCTION_NAMES.map(&:to_sym) - TEST_PENDING_INSNS)
end end
def setup def self.setup
unless JITSupport.supported? return if defined?(@setup_hooked)
skip 'JIT seems not supported on this platform' @setup_hooked = true
# ci.rvm.jp caches its build environment. Clean up temporary files left by SEGV.
if ENV['RUBY_DEBUG']&.include?('ci')
Dir.glob("#{ENV.fetch('TMPDIR', '/tmp')}/_ruby_mjit_p*u*.*").each do |file|
if File.mtime(file) < Time.now - 60 * 60 * 24
puts "test/ruby/test_jit.rb: removing #{file}"
File.unlink(file)
end
end
end end
# ruby -w -Itest/lib test/ruby/test_jit.rb # ruby -w -Itest/lib test/ruby/test_jit.rb
if $VERBOSE && !defined?(@@at_exit_hooked) if $VERBOSE
at_exit do at_exit do
unless TestJIT.untested_insns.empty? unless TestJIT.untested_insns.empty?
warn "you may want to add tests for following insns, when you have a chance: #{TestJIT.untested_insns.join(' ')}" warn "you may want to add tests for following insns, when you have a chance: #{TestJIT.untested_insns.join(' ')}"
end end
end end
@@at_exit_hooked = true
end end
end end
def setup
unless JITSupport.supported?
skip 'JIT seems not supported on this platform'
end
self.class.setup
end
def test_compile_insn_nop def test_compile_insn_nop
assert_compile_once('nil rescue true', result_inspect: 'nil', insns: %i[nop]) assert_compile_once('nil rescue true', result_inspect: 'nil', insns: %i[nop])
end end