summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-14 07:16:29 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-14 07:16:29 +0000
commit4633ad5d0fdf060d7764812d81df9751c9fb9a4f (patch)
treeb2b90ac499b38fb8599a0c88e36f6be207adb477 /lib
parente9f68d7f69704558af0e0721f53c53687d5b187e (diff)
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
Diffstat (limited to 'lib')
-rw-r--r--lib/test/unit.rb19
1 files changed, 9 insertions, 10 deletions
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