[Groonga-commit] groonga/grntest [master] Make groonga HTTP server gdb ready

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Aug 12 13:56:56 JST 2012


Kouhei Sutou	2012-08-12 13:56:56 +0900 (Sun, 12 Aug 2012)

  New Revision: 3dacc14ce9eb1eb3811a02f2b6e9ea69e410b725
  https://github.com/groonga/grntest/commit/3dacc14ce9eb1eb3811a02f2b6e9ea69e410b725

  Log:
    Make groonga HTTP server gdb ready

  Modified files:
    lib/grntest/tester.rb

  Modified: lib/grntest/tester.rb (+22 -20)
===================================================================
--- lib/grntest/tester.rb    2012-08-12 12:26:25 +0900 (1626665)
+++ lib/grntest/tester.rb    2012-08-12 13:56:56 +0900 (125505b)
@@ -721,7 +721,6 @@ module Grntest
             command_line += [
               "--input-fd", input_fd.to_s,
               "--output-fd", output_fd.to_s,
-              "--working-directory", context.temporary_directory_path.to_s,
               "-n",
               context.relative_db_path.to_s,
             ]
@@ -772,6 +771,7 @@ EOC
         end
         command_line << groonga
         command_line << "--log-path=#{context.log_path}"
+        command_line << "--working-directory=#{context.temporary_directory_path}"
         command_line
       end
 
@@ -800,24 +800,28 @@ EOC
         pid_file = Tempfile.new("groonga.pid")
 
         command_line = groonga_http_command(host, port, pid_file, context)
-        system(*command_line)
+        pid = nil
         begin
-          executor = HTTPExecutor.new(host, port, context)
-          executor.ensure_groonga_ready
-          yield(executor)
-        ensure
+          pid = Process.spawn(*command_line)
           begin
-            case****@teste*****
-            when "groonga"
-              executor.send_command("shutdown")
-            when "groonga-httpd"
-              command_line.concat(["-s", "quit"])
-              system(*command_line)
+            executor = HTTPExecutor.new(host, port, context)
+            begin
+              executor.ensure_groonga_ready
+            rescue
+              if Process.waitpid(pid, Process::WNOHANG)
+                pid = nil
+                raise
+              end
+              raise unles****@teste*****
+              retry
             end
-          rescue SystemCallError
+            yield(executor)
+          ensure
+            executor.send_command("shutdown")
+            wait_groonga_http_shutdown(pid_file)
           end
-
-          wait_groonga_http_shutdown(pid_file)
+        ensure
+          Process.waitpid(pid) if pid
         end
       end
 
@@ -834,15 +838,13 @@ EOC
       def groonga_http_command(host, port, pid_file, context)
         case****@teste*****
         when "groonga"
-          command_line = [
-            @tester.groonga,
+          command_line = groonga_command_line(context)
+          command_line += [
             "--pid-path", pid_file.path,
             "--bind-address", host,
             "--port", port.to_s,
             "--protocol", "http",
-            "--log-path", context.log_path.to_s,
-            "--working-directory", context.temporary_directory_path.to_s,
-            "-d",
+            "-s",
             "-n",
             context.relative_db_path.to_s,
           ]
-------------- next part --------------
HTML����������������������������...
Download 



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