jstorimer-deep-test 1.4.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. data/.gitignore +1 -0
  2. data/README.rdoc +41 -70
  3. data/Rakefile +47 -119
  4. data/TODO +2 -2
  5. data/VERSION +1 -1
  6. data/infrastructure/dynamic_teardown.rb +22 -0
  7. data/{test → infrastructure}/fake_deadlock_error.rb +0 -0
  8. data/infrastructure/load.rb +11 -0
  9. data/infrastructure/test_central_command.rb +15 -0
  10. data/infrastructure/test_exception.rb +7 -0
  11. data/{test → infrastructure}/test_factory.rb +0 -0
  12. data/infrastructure/test_logger.rb +11 -0
  13. data/infrastructure/test_operator.rb +15 -0
  14. data/infrastructure/test_result.rb +15 -0
  15. data/infrastructure/thread_agent.rb +21 -0
  16. data/infrastructure/timewarp/Rakefile +14 -0
  17. data/infrastructure/timewarp/lib/timewarp.rb +21 -0
  18. data/infrastructure/timewarp/test/timewarp_test.rb +45 -0
  19. data/lib/deep_test.rb +28 -40
  20. data/lib/deep_test/agent.rb +108 -0
  21. data/lib/deep_test/central_command.rb +165 -0
  22. data/lib/deep_test/cpu_info.rb +22 -0
  23. data/lib/deep_test/database/mysql_setup_listener.rb +11 -12
  24. data/lib/deep_test/database/setup_listener.rb +23 -23
  25. data/lib/deep_test/demon.rb +25 -0
  26. data/lib/deep_test/distributed/beachhead.rb +104 -0
  27. data/lib/deep_test/distributed/dispatch_controller.rb +17 -10
  28. data/lib/deep_test/distributed/establish_beachhead.rb +19 -0
  29. data/lib/deep_test/distributed/landing_fleet.rb +30 -0
  30. data/lib/deep_test/distributed/landing_ship.rb +60 -0
  31. data/lib/deep_test/distributed/remote_deployment.rb +56 -0
  32. data/lib/deep_test/distributed/rsync.rb +25 -12
  33. data/lib/deep_test/distributed/shell_environment.rb +50 -0
  34. data/lib/deep_test/distributed/ssh_client_connection_info.rb +14 -0
  35. data/lib/deep_test/failure_message.rb +19 -0
  36. data/lib/deep_test/lib_root.rb +4 -0
  37. data/lib/deep_test/listener_list.rb +1 -1
  38. data/lib/deep_test/local_deployment.rb +46 -0
  39. data/lib/deep_test/logger.rb +17 -2
  40. data/lib/deep_test/main.rb +41 -0
  41. data/lib/deep_test/marshallable_exception_wrapper.rb +4 -4
  42. data/lib/deep_test/metrics/data.rb +34 -0
  43. data/lib/deep_test/metrics/measurement.rb +39 -0
  44. data/lib/deep_test/{null_worker_listener.rb → null_listener.rb} +14 -14
  45. data/lib/deep_test/options.rb +41 -56
  46. data/lib/deep_test/proxy_io.rb +77 -0
  47. data/lib/deep_test/rake_tasks.rb +3 -1
  48. data/lib/deep_test/result_reader.rb +10 -6
  49. data/lib/deep_test/rspec_detector.rb +1 -1
  50. data/lib/deep_test/spec.rb +5 -1
  51. data/lib/deep_test/spec/extensions/example_methods.rb +7 -1
  52. data/lib/deep_test/spec/extensions/spec_task.rb +3 -2
  53. data/lib/deep_test/spec/runner.rb +32 -17
  54. data/lib/deep_test/spec/work_result.rb +2 -0
  55. data/lib/deep_test/test/run_test_suite.rb +5 -0
  56. data/lib/deep_test/test/runner.rb +2 -2
  57. data/lib/deep_test/test/supervised_test_suite.rb +9 -10
  58. data/lib/deep_test/test/work_result.rb +1 -0
  59. data/lib/deep_test/test_task.rb +1 -1
  60. data/lib/deep_test/ui/console.rb +9 -11
  61. data/lib/deep_test/warlock.rb +37 -25
  62. data/lib/telegraph.rb +29 -0
  63. data/lib/telegraph/ack_sequence.rb +14 -0
  64. data/lib/telegraph/logging.rb +20 -0
  65. data/lib/telegraph/message.rb +39 -0
  66. data/lib/telegraph/operator.rb +47 -0
  67. data/lib/telegraph/switchboard.rb +57 -0
  68. data/lib/telegraph/wire.rb +73 -0
  69. data/negative_acceptance_tests/dying_spec.rb +13 -0
  70. data/negative_acceptance_tests/dying_test.rb +13 -0
  71. data/negative_acceptance_tests/failing_spec.rb +9 -0
  72. data/{test/failing.rb → negative_acceptance_tests/failing_test.rb} +3 -1
  73. data/negative_acceptance_tests/kill_agent_one_on_start_work.rb +16 -0
  74. data/negative_acceptance_tests/passing_spec.rb +10 -0
  75. data/negative_acceptance_tests/passing_test.rb +12 -0
  76. data/negative_acceptance_tests/tasks.rake +87 -0
  77. data/negative_acceptance_tests/tests.rb +60 -0
  78. data/sample_rails_project/deep_test.rb +4 -0
  79. data/sample_rails_project/lib/{foreign_host_worker_simulation_listener.rb → foreign_host_agent_simulation_listener.rb} +6 -4
  80. data/sample_rails_project/lib/tasks/deep_test.rake +13 -4
  81. data/spec/deep_test/options_spec.rb +80 -59
  82. data/spec/deep_test/spec/extensions/example_methods_spec.rb +5 -4
  83. data/spec/deep_test/spec/extensions/spec_task_spec.rb +4 -6
  84. data/spec/deep_test/spec/runner_spec.rb +59 -32
  85. data/spec/spec_helper.rb +14 -6
  86. data/test/deep_test/agent_test.rb +175 -0
  87. data/test/deep_test/central_command_test.rb +147 -0
  88. data/test/deep_test/cpu_info_test.rb +33 -0
  89. data/test/deep_test/database/mysql_setup_listener_test.rb +13 -9
  90. data/test/deep_test/demon_test.rb +23 -0
  91. data/test/deep_test/distributed/beachhead_test.rb +67 -0
  92. data/test/deep_test/distributed/dispatch_controller_test.rb +130 -177
  93. data/test/deep_test/distributed/filename_resolver_test.rb +38 -34
  94. data/test/deep_test/distributed/landing_fleet_test.rb +55 -0
  95. data/test/deep_test/distributed/landing_ship_test.rb +48 -0
  96. data/test/deep_test/distributed/remote_deployment_test.rb +134 -0
  97. data/test/deep_test/distributed/rsync_test.rb +42 -62
  98. data/test/deep_test/distributed/shell_environment_fixtures/set_bar_to_foo +1 -0
  99. data/test/deep_test/distributed/shell_environment_fixtures/set_foo_to_bar +1 -0
  100. data/test/deep_test/distributed/shell_environment_fixtures/set_foo_to_baz +1 -0
  101. data/test/deep_test/distributed/shell_environment_test.rb +108 -0
  102. data/test/deep_test/distributed/ssh_client_connection_info_test.rb +34 -0
  103. data/test/deep_test/listener_list_test.rb +17 -15
  104. data/test/deep_test/local_deployment_test.rb +19 -0
  105. data/test/deep_test/logger_test.rb +34 -7
  106. data/test/deep_test/main_test.rb +12 -0
  107. data/test/deep_test/marshallable_exception_wrapper_test.rb +31 -29
  108. data/test/deep_test/metrics/data_test.rb +22 -0
  109. data/test/deep_test/metrics/measurement_test.rb +18 -0
  110. data/test/deep_test/proxy_io_test.rb +104 -0
  111. data/test/deep_test/result_reader_test.rb +95 -95
  112. data/test/deep_test/test/extensions/error_test.rb +38 -36
  113. data/test/deep_test/test/runner_test.rb +7 -3
  114. data/test/deep_test/test/supervised_test_suite_test.rb +89 -61
  115. data/test/deep_test/test/work_result_test.rb +80 -76
  116. data/test/deep_test/test/work_unit_test.rb +53 -51
  117. data/test/deep_test/test_task_test.rb +10 -38
  118. data/test/deep_test/ui/console_test.rb +8 -4
  119. data/test/deep_test/warlock_test.rb +33 -31
  120. data/test/test_helper.rb +20 -5
  121. data/test/test_task_test.rb +60 -57
  122. metadata +94 -84
  123. data/bin/deep_test +0 -15
  124. data/jstorimer-deep-test-0.1.0.gem +0 -0
  125. data/jstorimer-deep-test.gemspec +0 -1425
  126. data/lib/deep_test/distributed/drb_client_connection_info.rb +0 -15
  127. data/lib/deep_test/distributed/master_test_server.rb +0 -52
  128. data/lib/deep_test/distributed/multi_test_server_proxy.rb +0 -44
  129. data/lib/deep_test/distributed/null_work_unit.rb +0 -12
  130. data/lib/deep_test/distributed/remote_worker_client.rb +0 -54
  131. data/lib/deep_test/distributed/remote_worker_server.rb +0 -82
  132. data/lib/deep_test/distributed/show_status.rhtml +0 -41
  133. data/lib/deep_test/distributed/test_server.rb +0 -78
  134. data/lib/deep_test/distributed/test_server_status.rb +0 -9
  135. data/lib/deep_test/distributed/test_server_workers.rb +0 -24
  136. data/lib/deep_test/distributed/throughput_runner.rb +0 -42
  137. data/lib/deep_test/distributed/throughput_statistics.rb +0 -26
  138. data/lib/deep_test/distributed/throughput_worker_client.rb +0 -19
  139. data/lib/deep_test/extensions/drb_extension.rb +0 -34
  140. data/lib/deep_test/local_workers.rb +0 -55
  141. data/lib/deep_test/metrics/gatherer.rb +0 -67
  142. data/lib/deep_test/metrics/queue_lock_wait_time_measurement.rb +0 -133
  143. data/lib/deep_test/option.rb +0 -60
  144. data/lib/deep_test/process_orchestrator.rb +0 -49
  145. data/lib/deep_test/server.rb +0 -75
  146. data/lib/deep_test/spec/extensions/reporter.rb +0 -29
  147. data/lib/deep_test/worker.rb +0 -57
  148. data/script/internal/run_test_suite.rb +0 -7
  149. data/script/public/master_test_server.rb +0 -24
  150. data/script/public/test_server.rb +0 -18
  151. data/script/public/test_throughput.rb +0 -29
  152. data/spec/deep_test/option_spec.rb +0 -33
  153. data/spec/thread_worker.rb +0 -25
  154. data/test/deep_test/distributed/drb_client_connection_info_test.rb +0 -42
  155. data/test/deep_test/distributed/master_test_server_test.rb +0 -32
  156. data/test/deep_test/distributed/multi_test_server_proxy_test.rb +0 -96
  157. data/test/deep_test/distributed/remote_worker_client_test.rb +0 -180
  158. data/test/deep_test/distributed/remote_worker_server_test.rb +0 -99
  159. data/test/deep_test/distributed/test_server_test.rb +0 -94
  160. data/test/deep_test/distributed/test_server_workers_test.rb +0 -26
  161. data/test/deep_test/distributed/throughput_runner_test.rb +0 -68
  162. data/test/deep_test/distributed/throughput_worker_client_test.rb +0 -28
  163. data/test/deep_test/local_workers_test.rb +0 -22
  164. data/test/deep_test/metrics/gatherer_test.rb +0 -66
  165. data/test/deep_test/process_orchestrator_test.rb +0 -11
  166. data/test/deep_test/server_test.rb +0 -58
  167. data/test/deep_test/worker_test.rb +0 -94
  168. data/test/failing.rake +0 -11
  169. data/test/simple_test_blackboard.rb +0 -45
  170. data/test/simple_test_blackboard_test.rb +0 -33
@@ -1,15 +0,0 @@
1
- module DeepTest
2
- module Distributed
3
- class DRbClientConnectionInfo
4
- attr_reader :address
5
-
6
- def initialize
7
- info = Thread.current['DRb']
8
- raise "No DRb client found" unless info && info['client']
9
- peeraddr = info['client'].peeraddr
10
- DeepTest.logger.debug("DRbClientConnection info: #{peeraddr.inspect}")
11
- @address = peeraddr[3]
12
- end
13
- end
14
- end
15
- end
@@ -1,52 +0,0 @@
1
- module DeepTest
2
- module Distributed
3
- class MasterTestServer
4
- include ERB::Util
5
-
6
- STATUS_PORT = 4020 unless defined?(STATUS_PORT)
7
-
8
- attr_reader :servers
9
-
10
- def initialize(servers)
11
- @servers = servers
12
- end
13
-
14
- def show_status(req, res)
15
- template = File.read(File.dirname(__FILE__) + "/show_status.rhtml")
16
- res.body = ERB.new(template).result(binding)
17
- end
18
-
19
- def test_server_statuses
20
- @servers.map do |s|
21
- status = begin
22
- s.status
23
- rescue Exception => e
24
- e
25
- end
26
-
27
- [s.__drburi, status]
28
- end
29
- end
30
-
31
- def self.start(uri, server_uris)
32
- master = start_drb(uri, server_uris)
33
- start_http(master)
34
- DeepTest.logger.info "MasterTestServer listening at #{DRb.uri}"
35
- DRb.thread.join
36
- end
37
-
38
- def self.start_drb(uri, server_uris)
39
- servers = server_uris.map {|server_uri| DRbObject.new_with_uri server_uri}
40
- master = DeepTest::Distributed::MasterTestServer.new(servers)
41
- DRb.start_service(uri, master)
42
- master
43
- end
44
-
45
- def self.start_http(master)
46
- s = WEBrick::HTTPServer.new :Port => STATUS_PORT
47
- s.mount_proc("/", &master.method(:show_status))
48
- Thread.new {s.start}
49
- end
50
- end
51
- end
52
- end
@@ -1,44 +0,0 @@
1
- module DeepTest
2
- module Distributed
3
- class MultiTestServerProxy
4
- def initialize(options, slaves)
5
- DeepTest.logger.debug "MultiTestServerProxy#initialize #{slaves.length} slaves"
6
- @slave_controller = DispatchController.new(options, slaves)
7
- end
8
-
9
- def spawn_worker_server(options)
10
- DeepTest.logger.debug "dispatch spawn_worker_server for #{options.origin_hostname}"
11
- WorkerServerProxy.new options,
12
- @slave_controller.dispatch(:spawn_worker_server,
13
- options)
14
- end
15
-
16
- def sync(options)
17
- DeepTest.logger.debug "dispatch sync for #{options.origin_hostname}"
18
- @slave_controller.dispatch(:sync, options)
19
- end
20
-
21
- class WorkerServerProxy
22
- def initialize(options, slaves)
23
- DeepTest.logger.debug "WorkerServerProxy#initialize #{slaves.inspect}"
24
- @slave_controller = DispatchController.new(options, slaves)
25
- end
26
-
27
- def load_files(files)
28
- DeepTest.logger.debug "dispatch load_files"
29
- @slave_controller.dispatch(:load_files, files)
30
- end
31
-
32
- def start_all
33
- DeepTest.logger.debug "dispatch start_all"
34
- @slave_controller.dispatch(:start_all)
35
- end
36
-
37
- def stop_all
38
- DeepTest.logger.debug "dispatch stop_all"
39
- @slave_controller.dispatch_with_options(:stop_all, :ignore_connection_error => true)
40
- end
41
- end
42
- end
43
- end
44
- end
@@ -1,12 +0,0 @@
1
- module DeepTest
2
- module Distributed
3
- #
4
- # Work Unit used to measure throughput of workers.
5
- #
6
- class NullWorkUnit
7
- def run
8
- :null_work_unit_result
9
- end
10
- end
11
- end
12
- end
@@ -1,54 +0,0 @@
1
- module DeepTest
2
- module Distributed
3
- class RemoteWorkerClient
4
- def initialize(options, test_server, failover_workers)
5
- @failover_workers = failover_workers
6
- @options = options
7
- @test_server = test_server
8
- end
9
-
10
- def load_files(filelist)
11
- @options.new_listener_list.before_sync
12
-
13
- t = Thread.new do
14
- @test_server.sync(@options)
15
- @worker_server = @test_server.spawn_worker_server(@options)
16
- @worker_server.load_files filelist
17
- end
18
-
19
- filelist.each {|f| load f}
20
-
21
- begin
22
- t.join
23
- rescue => e
24
- # The failover here doesn't invoke load_files on the failover_workers
25
- # because they will be LocalWorkers, which fork from the current
26
- # process. The fact that we depend in this here is damp...
27
- #
28
- fail_over("load_files", e)
29
- end
30
- end
31
-
32
- def start_all
33
- @worker_server.start_all
34
- rescue => e
35
- raise if failed_over?
36
- fail_over("start_all", e)
37
- retry
38
- end
39
-
40
- def stop_all
41
- @worker_server.stop_all
42
- end
43
-
44
- def fail_over(method, exception)
45
- @options.ui_instance.distributed_failover_to_local(method, exception)
46
- @worker_server = @failover_workers
47
- end
48
-
49
- def failed_over?
50
- @worker_server == @failover_workers
51
- end
52
- end
53
- end
54
- end
@@ -1,82 +0,0 @@
1
- module DeepTest
2
- module Distributed
3
- class RemoteWorkerServer
4
- include DRb::DRbUndumped
5
-
6
- MERCY_KILLING_GRACE_PERIOD = 10 * 60 unless defined?(MERCY_KILLING_GRACE_PERIOD)
7
-
8
- def initialize(base_path, workers)
9
- @base_path = base_path
10
- @workers = workers
11
- end
12
-
13
- def launch_mercy_killer(grace_period)
14
- Thread.new do
15
- sleep grace_period
16
- exit(0) unless workers_started?
17
- end
18
- end
19
-
20
- def load_files(files)
21
- Dir.chdir @base_path
22
- resolver = FilenameResolver.new(@base_path)
23
- files.each do |file|
24
- load resolver.resolve(file)
25
- end
26
- end
27
-
28
- def start_all
29
- @workers_started = true
30
- @workers.start_all
31
- end
32
-
33
- def stop_all
34
- Thread.new do
35
- @workers.stop_all
36
- end
37
- end
38
-
39
- def workers_started?
40
- @workers_started
41
- end
42
-
43
- def self.warlock
44
- @warlock ||= DeepTest::Warlock.new
45
- end
46
-
47
- def self.running_server_count
48
- @warlock.demon_count if @warlock
49
- end
50
-
51
- def self.stop_all
52
- @warlock.stop_all if @warlock
53
- end
54
-
55
- def self.start(address, base_path, workers, grace_period = MERCY_KILLING_GRACE_PERIOD)
56
- innie, outie = IO.pipe
57
-
58
- warlock.start("RemoteWorkerServer") do
59
- innie.close
60
-
61
- server = new(base_path, workers)
62
-
63
- DRb.start_service("drubyall://#{address}:0", server)
64
- DeepTest.logger.info "RemoteWorkerServer started at #{DRb.uri}"
65
-
66
- outie.write DRb.uri
67
- outie.close
68
-
69
- server.launch_mercy_killer(grace_period)
70
-
71
- DRb.thread.join
72
- end
73
-
74
- outie.close
75
- uri = innie.gets
76
- innie.close
77
- DRbObject.new_with_uri(uri)
78
- end
79
-
80
- end
81
- end
82
- end
@@ -1,41 +0,0 @@
1
- <html>
2
- <head>
3
- <title>DeepTest Test Server Status</title>
4
- <style>
5
- .ok {
6
- background-color: #AAFFAA;
7
- }
8
-
9
- .error {
10
- background-color: #FFAAAA;
11
- }
12
-
13
- </style>
14
- </head>
15
- <body>
16
- <h1>DeepTest Test Server Status</h1>
17
- <table>
18
- <tr>
19
- <th>Mirror Server</th>
20
- <th>Bound To</th>
21
- <th>Workers / Client</th>
22
- <th>Clients</th>
23
- </tr>
24
- <% test_server_statuses.each do |uri, status|
25
- if Exception === status %>
26
- <tr class="error">
27
- <td><%=h uri %></td>
28
- <td colspan="3"><%=h status.message %></td>
29
- </tr>
30
- <% else %>
31
- <tr class="ok">
32
- <td><%=h uri %></td>
33
- <td><%=h status.binding_uri %></td>
34
- <td><%=h status.number_of_workers %></td>
35
- <td><%=h status.remote_worker_server_count %></td>
36
- </tr>
37
- <% end
38
- end %>
39
- </table>
40
- </body>
41
- </html>
@@ -1,78 +0,0 @@
1
- module DeepTest
2
- module Distributed
3
- class TestServer
4
- DEFAULT_CONFIG = {
5
- :work_dir => "/tmp",
6
- :uri => "drubyall://:4022",
7
- :number_of_workers => 2
8
- } unless defined?(DEFAULT_CONFIG)
9
-
10
- def initialize(config)
11
- @config = config
12
- end
13
-
14
- def spawn_worker_server(options)
15
- DeepTest.logger.debug("mirror spawn_worker_server for #{options.origin_hostname}")
16
- RemoteWorkerServer.start(URI.parse(@config[:uri]).host,
17
- options.mirror_path(@config[:work_dir]),
18
- TestServerWorkers.new(options, @config, DRbClientConnectionInfo.new))
19
- end
20
-
21
- def status
22
- TestServerStatus.new(
23
- DRb.uri,
24
- @config[:number_of_workers],
25
- RemoteWorkerServer.running_server_count
26
- )
27
- end
28
-
29
- def sync(options)
30
- DeepTest.logger.debug "mirror sync for #{options.origin_hostname}"
31
- path = options.mirror_path(@config[:work_dir])
32
- DeepTest.logger.debug "Syncing #{options.sync_options[:source]} to #{path}"
33
- RSync.sync(DRbClientConnectionInfo.new, options, path)
34
- end
35
-
36
- def servers
37
- [DRbObject.new_with_uri(DRb.uri)]
38
- end
39
-
40
- def self.start(config)
41
- server = DeepTest::Distributed::TestServer.new(config)
42
- DRb.start_service(config[:uri], server)
43
- DeepTest.logger.info "TestServer listening at #{DRb.uri}"
44
- DRb.thread.join
45
- end
46
-
47
- def self.parse_args(args)
48
- options = DeepTest::Distributed::TestServer::DEFAULT_CONFIG.dup
49
- OptionParser.new do |opts|
50
- opts.banner = "Usage: deep_test test_server [options]"
51
-
52
- opts.on("--work_dir PATH", "Absolute path to keep mirror working copies at") do |v|
53
- options[:work_dir] = v
54
- end
55
-
56
- opts.on("--uri URI", "DRb URI to bind server to") do |v|
57
- options[:uri] = v
58
- end
59
-
60
- opts.on("--number_of_workers NUM", "Number of workers to start when running tests") do |v|
61
- options[:number_of_workers] = v.to_i
62
- end
63
-
64
- opts.on_tail("-h", "--help", "Show this message") do
65
- puts opts
66
- exit
67
- end
68
- end.parse(args)
69
- options
70
- end
71
-
72
- def self.connect(options)
73
- servers = DRbObject.new_with_uri(options.distributed_server).servers
74
- MultiTestServerProxy.new(options, servers)
75
- end
76
- end
77
- end
78
- end
@@ -1,9 +0,0 @@
1
- module DeepTest
2
- module Distributed
3
- TestServerStatus = Struct.new(
4
- :binding_uri,
5
- :number_of_workers,
6
- :remote_worker_server_count
7
- ) unless defined?(TestServerStatus)
8
- end
9
- end
@@ -1,24 +0,0 @@
1
- module DeepTest
2
- module Distributed
3
- class TestServerWorkers < LocalWorkers
4
- def initialize(options, test_server_config, connection_info)
5
- super(options)
6
- @test_server_config = test_server_config
7
- @connection_info = connection_info
8
- end
9
-
10
- def number_of_workers
11
- @test_server_config[:number_of_workers]
12
- end
13
-
14
- def server
15
- Server.remote_reference(@connection_info.address, @options.server_port)
16
- end
17
-
18
- def start_all
19
- super
20
- @warlock.exit_when_none_running
21
- end
22
- end
23
- end
24
- end
@@ -1,42 +0,0 @@
1
- module DeepTest
2
- module Distributed
3
- class ThroughputRunner
4
- def initialize(options, test_count, blackboard = nil, &block)
5
- @options = options
6
- @test_count = test_count
7
- @blackboard = blackboard
8
- @progress_block = block
9
- end
10
-
11
- def blackboard
12
- @blackboard ||= @options.server
13
- end
14
-
15
- def statistics
16
- ThroughputStatistics.new(@test_count, @start_time, @end_time)
17
- end
18
-
19
- def process_work_units
20
- @start_time = Time.now
21
-
22
- @test_count.times do
23
- blackboard.write_work NullWorkUnit.new
24
- end
25
-
26
- results_read = 0
27
- until results_read == @test_count
28
- Thread.pass
29
- result = blackboard.take_result
30
- if result
31
- results_read += 1
32
- @progress_block.call(result) if @progress_block
33
- end
34
- end
35
-
36
- @end_time = Time.now
37
-
38
- true
39
- end
40
- end
41
- end
42
- end