1
0
Fork 0
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:
Nobuyoshi Nakada 2020-01-18 20:46:55 +09:00
parent b5a2e734da
commit 496f295f91
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -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}"