summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2020-12-10 21:36:42 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2020-12-10 21:36:48 -0800
commit4439b783366aa8d7dddbb39673f4074bb062f3d6 (patch)
tree452f633223101b3e876e1cc6c06e1866853695c6 /bootstraptest
parenta6a68bae3ced278bb41a42d363a0eaee86fa31bd (diff)
Save a core file from bootstraptest
Diffstat (limited to 'bootstraptest')
-rwxr-xr-xbootstraptest/runner.rb13
1 files changed, 12 insertions, 1 deletions
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