summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2020-12-03 21:01:24 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2020-12-03 21:01:25 -0800
commit067f45ecd379ea44f294084c8f342c69f735c018 (patch)
tree181baea2677d2f6f4945a1b25b68cbf46d1cb8c5 /tool
parent0734a6cd59e6fb1d59180ee73113709ec238b045 (diff)
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.
Diffstat (limited to 'tool')
-rw-r--r--tool/lib/test/unit.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/tool/lib/test/unit.rb b/tool/lib/test/unit.rb
index c51ebfda5f..8b29219b09 100644
--- a/tool/lib/test/unit.rb
+++ b/tool/lib/test/unit.rb
@@ -8,7 +8,9 @@ require 'test/unit/assertions'
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
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