[Groonga-commit] groonga/grntest [master] Add --testee option to choose groonga or groonga-httpd as testee

Back to archive index

null+****@clear***** null+****@clear*****
2012年 7月 13日 (金) 19:16:50 JST


Kouhei Sutou	2012-06-15 12:16:49 +0900 (Fri, 15 Jun 2012)

  New Revision: 831023317f44698d3387a743415f97589a4b8fb5
  https://github.com/groonga/grntest/commit/831023317f44698d3387a743415f97589a4b8fb5

  Log:
    Add --testee option to choose groonga or groonga-httpd as testee

  Modified files:
    lib/groonga/tester.rb

  Modified: lib/groonga/tester.rb (+22 -6)
===================================================================
--- lib/groonga/tester.rb    2012-07-08 17:44:40 +0900 (32d13c4)
+++ lib/groonga/tester.rb    2012-06-15 12:16:49 +0900 (dcb5644)
@@ -73,6 +73,18 @@ module Groonga
           tester.protocol = protocol
         end
 
+        available_testees = ["groonga", "groonga-httpd"]
+        available_testee_labels = available_testees.join(", ")
+        parser.on("--testee=TESTEE", available_testees,
+                  "Test against TESTEE",
+                  "[#{available_testee_labels}]",
+                  "(#{tester.testee})") do |testee|
+          tester.testee = testee
+          if tester.testee == "groonga-httpd"
+            tester.protocol = "http"
+          end
+        end
+
         parser.on("--base-directory=DIRECTORY",
                   "Use DIRECTORY as a base directory of relative path",
                   "(#{tester.base_directory})") do |directory|
@@ -117,15 +129,17 @@ module Groonga
       end
     end
 
-    attr_accessor :groonga, :groonga_httpd, :groonga_suggest_create_dataset, :protocol
+    attr_accessor :groonga, :groonga_httpd, :groonga_suggest_create_dataset
+    attr_accessor :protocol, :testee
     attr_accessor :base_directory, :diff, :diff_options
     attr_accessor :gdb, :default_gdb
     attr_writer :keep_database
     def initialize
       @groonga = "groonga"
-      @groonga_httpd = nil
+      @groonga_httpd = "groonga-httpd"
       @groonga_suggest_create_dataset = "groonga-suggest-create-dataset"
       @protocol = :gqtp
+      @testee = "groonga"
       @base_directory = "."
       detect_suitable_diff
       initialize_debuggers
@@ -406,9 +420,10 @@ EOC
           yield(executor)
         ensure
           begin
-            if****@teste*****_httpd.nil?
+            case****@teste*****
+            when "groonga"
               executor.send_command("shutdown")
-            else
+            when "groonga-httpd"
               command_line.concat(["-s", "quit"])
               system(*command_line)
             end
@@ -430,7 +445,8 @@ EOC
       end
 
       def groonga_http_command(host, port, pid_file, context)
-        if****@teste*****_httpd.nil?
+        case****@teste*****
+        when "groonga"
           command_line = [
             @tester.groonga,
             "--pid-path", pid_file.path,
@@ -440,7 +456,7 @@ EOC
             "-d",
             "-n", context.db_path,
           ]
-        else
+        when "groonga-httpd"
           db_path = context.db_path
           config_file = create_config_file(host, port, db_path, pid_file)
           command_line = [
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Descargar 



Groonga-commit メーリングリストの案内
Back to archive index