From 4439b783366aa8d7dddbb39673f4074bb062f3d6 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Thu, 10 Dec 2020 21:36:42 -0800 Subject: Save a core file from bootstraptest --- bootstraptest/runner.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb index 334d7a62b4..bda02355bd 100755 --- a/bootstraptest/runner.rb +++ b/bootstraptest/runner.rb @@ -519,7 +519,18 @@ def in_temporary_working_directory(dir) end def cleanup_coredump - FileUtils.rm_f 'core' + if File.file?('core') + require 'time' + Dir.glob('/tmp/bootstraptest-core.*').each do |f| + if Time.now - File.mtime(f) > 7 * 24 * 60 * 60 # 7 days + warn "Deleting an old core file: #{f}" + FileUtils.rm(f) + end + end + core_path = "/tmp/bootstraptest-core.#{Time.now.utc.iso8601}" + warn "A core file is found. Saving it at: #{core_path.dump}" + FileUtils.mv('core', core_path) + end FileUtils.rm_f Dir.glob('core.*') FileUtils.rm_f @ruby+'.stackdump' if @ruby end -- cgit v1.2.3