[Groonga-commit] groonga/grntest [master] Support interrupt again

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Aug 11 18:32:53 JST 2012


Kouhei Sutou	2012-08-11 18:32:53 +0900 (Sat, 11 Aug 2012)

  New Revision: e0432acdcc7a1a23a61eb760ca4108fc74410bd8
  https://github.com/groonga/grntest/commit/e0432acdcc7a1a23a61eb760ca4108fc74410bd8

  Log:
    Support interrupt again

  Modified files:
    lib/groonga/tester.rb

  Modified: lib/groonga/tester.rb (+16 -19)
===================================================================
--- lib/groonga/tester.rb    2012-08-11 18:25:13 +0900 (84a4035)
+++ lib/groonga/tester.rb    2012-08-11 18:32:53 +0900 (f1d7137)
@@ -482,16 +482,17 @@ module Groonga
         @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
@@ -572,17 +573,13 @@ module Groonga
         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 =****@teste*****_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 =****@teste*****_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
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index