1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test/unit.rb: launch_worker to manage new worker

* lib/test/unit.rb (Test::Unit::Runner#launch_worker): add new worker
  to working set.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-07-14 07:16:29 +00:00
parent e9f68d7f69
commit 4633ad5d0f
2 changed files with 13 additions and 11 deletions

View file

@ -1,4 +1,7 @@
Sat Jul 14 16:16:22 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
Sat Jul 14 16:16:27 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/test/unit.rb (Test::Unit::Runner#launch_worker): add new worker
to working set.
* lib/test/unit.rb (Test::Unit::Runner#launch_worker): extract.

View file

@ -462,6 +462,9 @@ module Test
after_worker_quit w
after_worker_down w, *info if !info.empty? && !worker.quit_called
end
@workers << worker
@ios << worker.io
@workers_hash[worker.io] = worker
worker
end
@ -498,14 +501,14 @@ module Test
shutting_down = false
rep = [] # FIXME: more good naming
@workers = [] # Array of workers.
@workers_hash = {} # out-IO => worker
@ios = [] # Array of worker IOs
begin
# Array of workers.
@workers = @options[:parallel].times.map {launch_worker}
# Thread: watchdog
watchdog = start_watchdog
@workers_hash = Hash[@workers.map {|w| [w.io,w] }] # out-IO => worker
@ios = @workers.map{|w| w.io } # Array of worker IOs
@options[:parallel].times {launch_worker}
while _io = IO.select(@ios)[0]
break unless _io.each do |io|
@ -527,12 +530,8 @@ module Test
@workers_hash.delete worker.io
@workers.delete worker
@ios.delete worker.io
new_worker = launch_worker
worker.quit
@workers << new_worker
@ios << new_worker.io
@workers_hash[new_worker.io] = new_worker
worker = new_worker
worker = launch_worker
end
worker.run(@tasks.shift, type)
@test_count += 1