ruby-changes:59744
From: Nobuyoshi <ko1@a...>
Date: Sun, 19 Jan 2020 12:19:48 +0900 (JST)
Subject: [ruby-changes:59744] 496f295f91 (master): Test bundled gems with timeout
https://git.ruby-lang.org/ruby.git/commit/?id=496f295f91 From 496f295f91bc7cd1d15ff05fd593b5a3cf56d726 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sat, 18 Jan 2020 20:46:55 +0900 Subject: Test bundled gems with timeout diff --git a/tool/test-bundled-gems.rb b/tool/test-bundled-gems.rb index e97e6c1..c7b7ade 100644 --- a/tool/test-bundled-gems.rb +++ b/tool/test-bundled-gems.rb @@ -1,4 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/tool/test-bundled-gems.rb#L1 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| https://github.com/ruby/ruby/blob/trunk/tool/test-bundled-gems.rb#L14 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}" -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/