summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-01-18 20:46:55 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-01-19 11:35:10 +0900
commit496f295f91bc7cd1d15ff05fd593b5a3cf56d726 (patch)
tree870d68a76ad134df85ffeb230dc2ef2d443220ec /tool
parentb5a2e734daf3bd761e85f139a34718e36a4ac426 (diff)
Test bundled gems with timeout
Diffstat (limited to 'tool')
-rw-r--r--tool/test-bundled-gems.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/tool/test-bundled-gems.rb b/tool/test-bundled-gems.rb
index e97e6c19a5..c7b7adedc3 100644
--- a/tool/test-bundled-gems.rb
+++ b/tool/test-bundled-gems.rb
@@ -1,4 +1,5 @@
require 'rbconfig'
+require 'timeout'
allowed_failures = ENV['TEST_BUNDLED_GEMS_ALLOW_FAILURES'] || ''
allowed_failures = allowed_failures.split(',').reject(&:empty?)
@@ -13,7 +14,17 @@ File.foreach("#{gem_dir}/bundled_gems") do |line|
test_command = "#{ruby} -C #{gem_dir}/src/#{gem} -Ilib #{rake}"
puts test_command
- system test_command
+ pid = Process.spawn(test_command, "#{/mingw|mswin/ =~ RUBY_PLATFORM ? 'new_' : ''}pgroup": true)
+ {nil => 60, INT: 30, TERM: 10, KILL: nil}.each do |sig, sec|
+ if sig
+ puts "Sending #{sig} signal"
+ Process.kill("-#{sig}", pid)
+ end
+ begin
+ break Timeout.timeout(sec) {Process.wait(pid)}
+ rescue Timeout::Error
+ end
+ end
unless $?.success?
puts "Tests failed with exit code #{$?.exitstatus}"