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

ruby-changes:63888

From: Takashi <ko1@a...>
Date: Fri, 4 Dec 2020 14:03:11 +0900 (JST)
Subject: [ruby-changes:63888] 067f45ecd3 (master): Save a core file on a worker crash

https://git.ruby-lang.org/ruby.git/commit/?id=067f45ecd3

From 067f45ecd379ea44f294084c8f342c69f735c018 Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Thu, 3 Dec 2020 21:01:24 -0800
Subject: Save a core file on a worker crash

CI failures like
http://ci.rvm.jp/results/trunk-mjit@phosphorus-docker/3280458 doesn't
provide any useful information, and it doesn't leave a core file in a CI
environment because a test like `Process.kill(:TRAP, $$)` overwrites in
a next run very quickly.

Thus I'd like to keep core files in /tmp.

diff --git a/tool/lib/test/unit.rb b/tool/lib/test/unit.rb
index c51ebfd..8b29219 100644
--- a/tool/lib/test/unit.rb
+++ b/tool/lib/test/unit.rb
@@ -8,7 +8,9 @@ require 'test/unit/assertions' https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit.rb#L8
 require_relative '../envutil'
 require_relative '../colorize'
 require 'test/unit/testcase'
+require 'fileutils'
 require 'optparse'
+require 'time'
 
 # See Test::Unit
 module Test
@@ -345,6 +347,11 @@ module Test https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit.rb#L347
         warn "or, a bug of test/unit/parallel.rb. try again without -j"
         warn "option."
         warn ""
+        if File.exist?('core')
+          core_path = "/tmp/core.#{Time.now.utc.iso8601}"
+          warn "A core file is found. Saving it at: #{core_path.dump}"
+          FileUtils.mv('core', core_path)
+        end
         STDERR.flush
         exit c
       end
-- 
cgit v0.10.2


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

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