зеркало из https://github.com/github/ruby.git
* lib/test/unit.rb: Put error message into STDERR if failed to lanch
worker (job) process. [ruby-dev:44802] [Bug #5577] * lib/test/unit/parallel.rb: If failed to increment_io, exit with code 2. [ruby-dev:44802] [Bug #5577] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
605f4baef7
Коммит
42b1df08fc
|
@ -1,3 +1,11 @@
|
||||||
|
Sun Mar 11 17:10:04 2012 Shota Fukumori <sorah@tubusu.net>
|
||||||
|
|
||||||
|
* lib/test/unit.rb: Put error message into STDERR if failed to lanch
|
||||||
|
worker (job) process. [ruby-dev:44802] [Bug #5577]
|
||||||
|
|
||||||
|
* lib/test/unit/parallel.rb: If failed to increment_io, exit with code
|
||||||
|
2. [ruby-dev:44802] [Bug #5577]
|
||||||
|
|
||||||
Sun Mar 11 15:46:45 2012 Shota Fukumori <sorah@tubusu.net>
|
Sun Mar 11 15:46:45 2012 Shota Fukumori <sorah@tubusu.net>
|
||||||
|
|
||||||
* io.c: fix rdoc of `IO.binwrite` to show same as `IO.write` except
|
* io.c: fix rdoc of `IO.binwrite` to show same as `IO.write` except
|
||||||
|
|
|
@ -429,7 +429,12 @@ module Test
|
||||||
|
|
||||||
# Array of workers.
|
# Array of workers.
|
||||||
launch_worker = Proc.new {
|
launch_worker = Proc.new {
|
||||||
worker = Worker.launch(@options[:ruby],@args)
|
begin
|
||||||
|
worker = Worker.launch(@options[:ruby],@args)
|
||||||
|
rescue => e
|
||||||
|
warn "ERROR: Failed to launch job process - #{e.class}: #{e.message}"
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
worker.hook(:dead) do |w,info|
|
worker.hook(:dead) do |w,info|
|
||||||
after_worker_quit w
|
after_worker_quit w
|
||||||
after_worker_down w, *info if !info.empty? && !worker.quit_called
|
after_worker_down w, *info if !info.empty? && !worker.quit_called
|
||||||
|
@ -536,25 +541,29 @@ module Test
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@workers.each do |worker|
|
|
||||||
begin
|
if @workers
|
||||||
timeout(1) do
|
|
||||||
worker.quit
|
|
||||||
end
|
|
||||||
rescue Errno::EPIPE
|
|
||||||
rescue Timeout::Error
|
|
||||||
end
|
|
||||||
worker.close
|
|
||||||
end
|
|
||||||
begin
|
|
||||||
timeout(0.2*@workers.size) do
|
|
||||||
Process.waitall
|
|
||||||
end
|
|
||||||
rescue Timeout::Error
|
|
||||||
@workers.each do |worker|
|
@workers.each do |worker|
|
||||||
begin
|
begin
|
||||||
Process.kill(:KILL,worker.pid)
|
timeout(1) do
|
||||||
rescue Errno::ESRCH; end
|
worker.quit
|
||||||
|
end
|
||||||
|
rescue Errno::EPIPE
|
||||||
|
rescue Timeout::Error
|
||||||
|
end
|
||||||
|
worker.close
|
||||||
|
end
|
||||||
|
|
||||||
|
begin
|
||||||
|
timeout(0.2*@workers.size) do
|
||||||
|
Process.waitall
|
||||||
|
end
|
||||||
|
rescue Timeout::Error
|
||||||
|
@workers.each do |worker|
|
||||||
|
begin
|
||||||
|
Process.kill(:KILL,worker.pid)
|
||||||
|
rescue Errno::ESRCH; end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -565,7 +574,7 @@ module Test
|
||||||
@errors += rep.map{|x| x[:result][0] }.inject(:+)
|
@errors += rep.map{|x| x[:result][0] }.inject(:+)
|
||||||
@failures += rep.map{|x| x[:result][1] }.inject(:+)
|
@failures += rep.map{|x| x[:result][1] }.inject(:+)
|
||||||
@skips += rep.map{|x| x[:result][2] }.inject(:+)
|
@skips += rep.map{|x| x[:result][2] }.inject(:+)
|
||||||
else
|
elsif @workers
|
||||||
puts ""
|
puts ""
|
||||||
puts "Retrying..."
|
puts "Retrying..."
|
||||||
puts ""
|
puts ""
|
||||||
|
|
|
@ -88,8 +88,14 @@ module Test
|
||||||
|
|
||||||
@old_loadpath = []
|
@old_loadpath = []
|
||||||
begin
|
begin
|
||||||
@stdout = increment_io(STDOUT)
|
begin
|
||||||
@stdin = increment_io(STDIN)
|
@stdout = increment_io(STDOUT)
|
||||||
|
@stdin = increment_io(STDIN)
|
||||||
|
rescue
|
||||||
|
exit 2
|
||||||
|
end
|
||||||
|
exit 2 unless @stdout && @stdin
|
||||||
|
|
||||||
@stdout.sync = true
|
@stdout.sync = true
|
||||||
@stdout.puts "ready!"
|
@stdout.puts "ready!"
|
||||||
while buf = @stdin.gets
|
while buf = @stdin.gets
|
||||||
|
@ -130,12 +136,12 @@ module Test
|
||||||
rescue Errno::EPIPE
|
rescue Errno::EPIPE
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
begin
|
begin
|
||||||
@stdout.puts "bye #{[Marshal.dump(e)].pack("m0")}"
|
@stdout.puts "bye #{[Marshal.dump(e)].pack("m0")}" if @stdout
|
||||||
rescue Errno::EPIPE;end
|
rescue Errno::EPIPE;end
|
||||||
exit
|
exit
|
||||||
ensure
|
ensure
|
||||||
@stdin.close
|
@stdin.close if @stdin
|
||||||
@stdout.close
|
@stdout.close if @stdout
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Загрузка…
Ссылка в новой задаче