Navigation Menu

Skip to content

Commit

Permalink
Support interrupt again
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Aug 11, 2012
1 parent ef4553c commit e0432ac
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions lib/groonga/tester.rb
Expand Up @@ -482,16 +482,17 @@ def run_test_suites(test_suites)
@tester.n_workers.times do |i|
worker = workers[i]
worker_threads << Thread.new do
succeeded = worker.run(queue)
workers.delete(worker)
if worker.interruptted?
workers.each do |other_worker|
other_worker.interrupt
end
end
succeeded = false unless worker.run(queue)
end
end

begin
worker_threads.each(&:join)
rescue Interrupt
workers.each do |worker|
worker.interrupt
end
end
worker_threads.each(&:join)

succeeded
end
Expand Down Expand Up @@ -572,17 +573,13 @@ def run_groonga_script
create_temporary_directory do |directory_path|
db_path = File.join(directory_path, "db")
context = Executor::Context.new
begin
context.temporary_directory_path = directory_path
context.db_path = db_path
context.base_directory = @tester.base_directory
context.groonga_suggest_create_dataset =
@tester.groonga_suggest_create_dataset
run_groonga(context) do |executor|
executor.execute(test_script_path)
end
rescue Interrupt
@worker.interrupted
context.temporary_directory_path = directory_path
context.db_path = db_path
context.base_directory = @tester.base_directory
context.groonga_suggest_create_dataset =
@tester.groonga_suggest_create_dataset
run_groonga(context) do |executor|
executor.execute(test_script_path)
end
context.result
end
Expand Down

0 comments on commit e0432ac

Please sign in to comment.