diff --git a/ChangeLog b/ChangeLog index 911241b4ca..e9df902c9e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ -Sat Jul 14 16:16:22 2012 Nobuyoshi Nakada +Sat Jul 14 16:16:27 2012 Nobuyoshi Nakada + + * 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. diff --git a/lib/test/unit.rb b/lib/test/unit.rb index 91abec71f0..8a8e5c2083 100644 --- a/lib/test/unit.rb +++ b/lib/test/unit.rb @@ -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