[Groonga-commit] groonga/groonga at 22bbffe [master] test: support running against installed Groonga

Back to archive index

Kouhei Sutou null+****@clear*****
Mon May 23 11:43:10 JST 2016


Kouhei Sutou	2016-05-23 11:43:10 +0900 (Mon, 23 May 2016)

  New Revision: 22bbffeeb6447bde6557c74cc6df1dd86f8c5fc2
  https://github.com/groonga/groonga/commit/22bbffeeb6447bde6557c74cc6df1dd86f8c5fc2

  Message:
    test: support running against installed Groonga

  Modified files:
    test/command_line/helper/command_runner.rb
    test/command_line/run-test.rb

  Modified: test/command_line/helper/command_runner.rb (+7 -3)
===================================================================
--- test/command_line/helper/command_runner.rb    2016-05-23 00:54:06 +0900 (d7dcfe2)
+++ test/command_line/helper/command_runner.rb    2016-05-23 11:43:10 +0900 (6d71137)
@@ -50,7 +50,7 @@ module CommandRunner
 
   def groonga(*groonga_command_line, &block)
     command_line = [
-      "groonga",
+      groonga_path,
       "--log-path", @log_path.to_s,
       "--query-log-path", @query_log_path.to_s,
     ]
@@ -62,7 +62,7 @@ module CommandRunner
 
   def grndb(command, *arguments)
     command_line = [
-      "grndb",
+      grndb_path,
       command,
       @database_path.to_s,
     ]
@@ -79,7 +79,11 @@ module CommandRunner
       return program_path if File.exist?(program_path)
     end
 
-    nil
+    name
+  end
+
+  def groonga_path
+    find_program("groonga")
   end
 
   def grndb_path

  Modified: test/command_line/run-test.rb (+20 -8)
===================================================================
--- test/command_line/run-test.rb    2016-05-23 00:54:06 +0900 (33ff44b)
+++ test/command_line/run-test.rb    2016-05-23 11:43:10 +0900 (bc54ce6)
@@ -9,16 +9,28 @@ source_top_dir_path = base_dir_path.parent.parent
 build_top_dir_path  = Pathname($0).expand_path.dirname.parent.parent
 build_base_dir_path = build_top_dir_path + "test/command_line"
 
-Dir.chdir(build_top_dir_path.to_s) do
-  system("make -j8 > /dev/null") or exit(false)
+groonga_install_prefix = nil
+if (ARGV[0] || "").start_with?("--groonga-install-prefix=")
+  groonga_install_prefix = ARGV.shift.gsub(/\A--groonga-install-prefix=/, "")
 end
 
-ENV["PATH"] = [
-  (build_top_dir_path + "src").to_s,
-  ENV["PATH"],
-].join(File::PATH_SEPARATOR)
-ENV["GRN_PLUGINS_DIR"]      = (build_top_dir_path + "plugins").to_s
-ENV["GRN_RUBY_SCRIPTS_DIR"] = (build_top_dir_path + "lib/mrb/scripts").to_s
+if groonga_install_prefix
+  ENV["PATH"] = [
+    [groonga_install_prefix, "bin"].join(File::ALT_SEPARATOR || File::SEPARATOR),
+    ENV["PATH"],
+  ].join(File::PATH_SEPARATOR)
+else
+  Dir.chdir(build_top_dir_path.to_s) do
+    system("make -j8 > /dev/null") or exit(false)
+  end
+
+  ENV["PATH"] = [
+    (build_top_dir_path + "src").to_s,
+    ENV["PATH"],
+  ].join(File::PATH_SEPARATOR)
+  ENV["GRN_PLUGINS_DIR"]      = (build_top_dir_path + "plugins").to_s
+  ENV["GRN_RUBY_SCRIPTS_DIR"] = (build_top_dir_path + "lib/mrb/scripts").to_s
+end
 
 $VERBOSE = true
 
-------------- next part --------------
HTML����������������������������...
下载 



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