Class: Test::Unit::TestSuiteThreadRunner
- Inherits:
-
TestSuiteRunner
- Object
- TestSuiteRunner
- Test::Unit::TestSuiteThreadRunner
- Defined in:
- lib/test/unit/test-suite-thread-runner.rb
Class Method Summary collapse
Methods inherited from TestSuiteRunner
#initialize, n_workers, n_workers=, #run
Constructor Details
This class inherits a constructor from Test::Unit::TestSuiteRunner
Class Method Details
.run_all_tests ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/test/unit/test-suite-thread-runner.rb', line 19 def run_all_tests n_workers = TestSuiteRunner.n_workers workers = [] sub_exceptions = [] n_workers.times do |i| workers << Thread.new(i) do |worker_id| begin loop do task = @task_queue.pop break if task.nil? catch do |stop_tag| task.call(stop_tag) end end rescue Exception => exception sub_exceptions << exception end end end yield n_workers.times do @task_queue << nil end workers.each(&:join) sub_exceptions.each do |exception| raise exception end end |
.task_queue ⇒ Object
15 16 17 |
# File 'lib/test/unit/test-suite-thread-runner.rb', line 15 def task_queue @task_queue end |