Kouhei Sutou
null+****@clear*****
Tue Apr 10 14:44:13 JST 2018
Kouhei Sutou 2018-04-10 14:44:13 +0900 (Tue, 10 Apr 2018) New Revision: 25bd382a9185b528cd32b4f18915fe0c38d36b43 https://github.com/groonga/groonga/commit/25bd382a9185b528cd32b4f18915fe0c38d36b43 Message: test: support running command line tests on out-of-source build Modified files: test/command_line/helper/sandbox.rb test/command_line/run-test.rb travis/Dockerfile.ubuntu-16.04 Modified: test/command_line/helper/sandbox.rb (+2 -1) =================================================================== --- test/command_line/helper/sandbox.rb 2018-04-10 14:39:37 +0900 (07d3f3be2) +++ test/command_line/helper/sandbox.rb 2018-04-10 14:44:13 +0900 (69b4716e2) @@ -7,7 +7,8 @@ module Sandbox end def setup_tmp_directory - @base_tmp_dir = Pathname(File.dirname(__FILE__)) + "tmp" + base_dir = ENV["BASE_DIR"] || __dir__ + @base_tmp_dir = Pathname(base_dir) + "tmp" memory_file_system = "/run/shm" if File.exist?(memory_file_system) FileUtils.mkdir_p(@base_tmp_dir.parent.to_s) Modified: test/command_line/run-test.rb (+21 -7) =================================================================== --- test/command_line/run-test.rb 2018-04-10 14:39:37 +0900 (a75bca55e) +++ test/command_line/run-test.rb 2018-04-10 14:44:13 +0900 (c425c73d0) @@ -4,10 +4,16 @@ require "rbconfig" require "pathname" require "fileutils" -base_dir_path = Pathname(__FILE__).expand_path.dirname -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" +source_base_dir_path = Pathname(__dir__).expand_path +source_top_dir_path = source_base_dir_path.parent.parent +if ENV["BUILD_DIR"] + build_base_dir_path = Pathname(ENV["BUILD_DIR"]).expand_path +else + build_base_dir_path = Pathname($0).expand_path.dirname +end +build_top_dir_path = build_base_dir_path.parent.parent + +ENV["BASE_DIR"] ||= build_base_dir_path.to_s groonga_install_prefix = nil if (ARGV[0] || "").start_with?("--groonga-install-prefix=") @@ -28,10 +34,18 @@ else (build_top_dir_path + "src").to_s, ENV["PATH"], ].join(File::PATH_SEPARATOR) + if build_top_dir_path != source_top_dir_path + Dir.glob(source_top_dir_path + "plugins/**/*.rb") do |source_rb| + relative_path = Pathname(source_rb).relative_path_from(source_top_dir_path) + build_rb = build_top_dir_path + relative_path + FileUtils.mkdir_p(build_rb.dirname) + FileUtils.cp(source_rb, build_rb) + end + end 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 + ENV["GRN_RUBY_SCRIPTS_DIR"] = (source_top_dir_path + "lib/mrb/scripts").to_s ENV["GRN_RUBY_LOAD_PATH"] = [ - (build_top_dir_path + "vendor/groonga-log-source/lib").to_s, + (source_top_dir_path + "vendor/groonga-log-source/lib").to_s, ENV["GRN_RUBY_LOAD_PATH"], ].compact.join(File::PATH_SEPARATOR) end @@ -42,4 +56,4 @@ require_relative "helper" ARGV.unshift("--max-diff-target-string-size=5000") -exit(Test::Unit::AutoRunner.run(true, (base_dir_path + "suite").to_s)) +exit(Test::Unit::AutoRunner.run(true, (source_base_dir_path + "suite").to_s)) Modified: travis/Dockerfile.ubuntu-16.04 (+2 -0) =================================================================== --- travis/Dockerfile.ubuntu-16.04 2018-04-10 14:39:37 +0900 (db405a281) +++ travis/Dockerfile.ubuntu-16.04 2018-04-10 14:44:13 +0900 (4a73ef269) @@ -81,6 +81,8 @@ CMD \ ../source/test/unit/run-test.sh && \ BUILD_DIR=test/mruby \ ../source/test/mruby/run-test.rb && \ + BUILD_DIR=test/command_line \ + ../source/test/command_line/run-test.rb && \ BUILD_DIR=test/command \ ../source/test/command/run-test.sh \ test/command/suite \ -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180410/1ba8fa79/attachment-0001.htm