mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Test bundled gems with timeout
This commit is contained in:
parent
b5a2e734da
commit
496f295f91
1 changed files with 12 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
require 'rbconfig'
|
require 'rbconfig'
|
||||||
|
require 'timeout'
|
||||||
|
|
||||||
allowed_failures = ENV['TEST_BUNDLED_GEMS_ALLOW_FAILURES'] || ''
|
allowed_failures = ENV['TEST_BUNDLED_GEMS_ALLOW_FAILURES'] || ''
|
||||||
allowed_failures = allowed_failures.split(',').reject(&:empty?)
|
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}"
|
test_command = "#{ruby} -C #{gem_dir}/src/#{gem} -Ilib #{rake}"
|
||||||
puts test_command
|
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?
|
unless $?.success?
|
||||||
puts "Tests failed with exit code #{$?.exitstatus}"
|
puts "Tests failed with exit code #{$?.exitstatus}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue