Kouhei Sutou
null+****@clear*****
Tue Apr 10 12:29:05 JST 2018
Kouhei Sutou 2018-04-10 12:29:05 +0900 (Tue, 10 Apr 2018) New Revision: 11fd703dc4a4c04c6672830df77bd247b282d486 https://github.com/groonga/groonga/commit/11fd703dc4a4c04c6672830df77bd247b282d486 Message: test: support running mruby tests in out-of-source build Modified files: test/mruby/run-test.rb travis/Dockerfile.ubuntu-16.04 Modified: test/mruby/run-test.rb (+24 -7) =================================================================== --- test/mruby/run-test.rb 2018-04-10 11:33:04 +0900 (df59cd3ec) +++ test/mruby/run-test.rb 2018-04-10 12:29:05 +0900 (a9243fb4c) @@ -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/mruby" +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 Dir.chdir(build_top_dir_path.to_s) do system("make -j8 > /dev/null") or exit(false) @@ -20,6 +26,12 @@ if rroonga_built_revision_path.exist? end rroonga_dir_path = build_base_dir_path + "rroonga" +unless rroonga_dir_path.exist? + FileUtils.mkdir_p(rroonga_dir_path.parent) + system("git", "clone", + (source_base_dir_path + "rroonga").to_s, + rroonga_dir_path.to_s) +end rroonga_revision = Dir.chdir(rroonga_dir_path) do `git describe` end @@ -32,7 +44,7 @@ if rroonga_revision != rroonga_built_revision "Libs: -L#{lib_dir} -Wl,-rpath,#{lib_dir} -lgroonga" end content = content.gsub(/^Cflags: .*$/) do - "Cflags: -I#{build_top_dir_path}/include" + "Cflags: -I#{source_top_dir_path}/include" end groonga_pc.puts(content) end @@ -51,8 +63,13 @@ if rroonga_revision != rroonga_built_revision end end +if build_top_dir_path != source_top_dir_path + plugin_relative_path = "plugins/expression_rewriters" + FileUtils.cp(Dir.glob(source_top_dir_path + "#{plugin_relative_path}/*.rb"), + build_top_dir_path + plugins_relative_path) +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_ORDER_BY_ESTIMATED_SIZE_ENABLE"] = "yes" $LOAD_PATH.unshift((rroonga_dir_path + "ext" + "groonga").to_s) @@ -62,4 +79,4 @@ require "groonga" require_relative "helper" -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 (+6 -1) =================================================================== --- travis/Dockerfile.ubuntu-16.04 2018-04-10 11:33:04 +0900 (b62983e12) +++ travis/Dockerfile.ubuntu-16.04 2018-04-10 12:29:05 +0900 (a4a36eeee) @@ -33,7 +33,10 @@ RUN \ apt install -qq -y cutter-testing-framework RUN \ - gem install bundler + gem install \ + bundler \ + pkg-config \ + groonga-client RUN \ useradd --user-group --create-home groonga @@ -70,6 +73,8 @@ RUN \ CMD \ BUILD_DIR=test/unit \ ../source/test/unit/run-test.sh && \ + BUILD_DIR=test/mruby \ + ../source/test/mruby/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/5c4221d5/attachment-0001.htm