[前][次][番号順一覧][スレッド一覧]

ruby-changes:60560

From: Takashi <ko1@a...>
Date: Sun, 29 Mar 2020 07:19:39 +0900 (JST)
Subject: [ruby-changes:60560] 92c25114ab (master): Clean up /tmp leftovers in ci.rvm.jp

https://git.ruby-lang.org/ruby.git/commit/?id=92c25114ab

From 92c25114ab954643dc80f3a1765b53e87ce38d4c Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Sat, 28 Mar 2020 15:19:06 -0700
Subject: Clean up /tmp leftovers in ci.rvm.jp


diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb
index e3d8f9c..e06561b 100644
--- a/test/ruby/test_jit.rb
+++ b/test/ruby/test_jit.rb
@@ -38,22 +38,37 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L38
     @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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]