summaryrefslogtreecommitdiff
path: root/test/ruby/test_jit.rb
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2020-03-28 15:19:06 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2020-03-28 15:19:09 -0700
commit92c25114ab954643dc80f3a1765b53e87ce38d4c (patch)
treeab2f6bd021b8eaaa732e969c34bf64728fa726e9 /test/ruby/test_jit.rb
parentaddf43d7d5415a5e69c6b10d55eea9cf07cd253e (diff)
Clean up /tmp leftovers in ci.rvm.jp
Diffstat (limited to 'test/ruby/test_jit.rb')
-rw-r--r--test/ruby/test_jit.rb25
1 files changed, 20 insertions, 5 deletions
diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb
index e3d8f9cee2..e06561ba67 100644
--- a/test/ruby/test_jit.rb
+++ b/test/ruby/test_jit.rb
@@ -38,22 +38,37 @@ class TestJIT < Test::Unit::TestCase
@untested_insns ||= (RubyVM::INSTRUCTION_NAMES.map(&:to_sym) - TEST_PENDING_INSNS)
end
- def setup
- unless JITSupport.supported?
- skip 'JIT seems not supported on this platform'
+ def self.setup
+ return if defined?(@setup_hooked)
+ @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
# ruby -w -Itest/lib test/ruby/test_jit.rb
- if $VERBOSE && !defined?(@@at_exit_hooked)
+ if $VERBOSE
at_exit do
unless TestJIT.untested_insns.empty?
warn "you may want to add tests for following insns, when you have a chance: #{TestJIT.untested_insns.join(' ')}"
end
end
- @@at_exit_hooked = true
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
assert_compile_once('nil rescue true', result_inspect: 'nil', insns: %i[nop])
end