Kouhei Sutou
null+****@clear*****
Tue Nov 26 00:14:03 JST 2013
Kouhei Sutou 2013-11-26 00:14:03 +0900 (Tue, 26 Nov 2013) New Revision: aff04f3c5a706b333db2ae14afd5dbbf9d27eb6d https://github.com/droonga/drntest/commit/aff04f3c5a706b333db2ae14afd5dbbf9d27eb6d Message: Add --fluentd-options option Modified files: lib/drntest/test-runner.rb lib/drntest/tester.rb Modified: lib/drntest/test-runner.rb (+8 -2) =================================================================== --- lib/drntest/test-runner.rb 2013-11-26 00:05:19 +0900 (5ad761b) +++ lib/drntest/test-runner.rb 2013-11-26 00:14:03 +0900 (29d540f) @@ -106,7 +106,11 @@ module Drntest temporary_catalog = temporary_dir + "catalog.json" FileUtils.cp(catalog, temporary_catalog) - engine_command = "#{@owner.fluentd} --config #{temporary_config}" + engine_command = [ + @owner.fluentd, + "--config", temporary_config.to_s, + *@owner.fluentd_options, + ] engine_env = { "RUBYOPT" => nil, "BUNDLE_GEMFILE" => nil, @@ -116,7 +120,9 @@ module Drntest :chdir => temporary_dir.to_s, STDERR => STDOUT, } - @engine_pid = Process.spawn(engine_env, engine_command, engine_options) + arguments = [engine_env, *engine_command] + arguments << engine_options + @engine_pid = Process.spawn(*arguments) end def teardown Modified: lib/drntest/tester.rb (+10 -1) =================================================================== --- lib/drntest/tester.rb 2013-11-26 00:05:19 +0900 (0aaa6e3) +++ lib/drntest/tester.rb 2013-11-26 00:14:03 +0900 (5eabd34) @@ -13,6 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +require "shellwords" require "optparse" require "drntest/version" require "drntest/test-runner" @@ -69,6 +70,12 @@ module Drntest tester.fluentd = fluentd end + parser.on("--fluentd-options=OPTIONS", + "Options for fluentd", + "You can specify this option multiple times") do |options| + tester.fluentd_options.concat(Shellwords.split(options)) + end + parser.on("--test=PATTERN", "Run only tests which have a name matched to the given PATTERN") do |pattern| if /\A\/(.+)\/\z/ =~ pattern @@ -81,7 +88,8 @@ module Drntest end end - attr_accessor :port, :host, :tag, :fluentd, :pattern, :config, :catalog + attr_accessor :port, :host, :tag, :fluentd, :fluentd_options + attr_accessor :pattern, :config, :catalog def initialize @port = 24224 @@ -90,6 +98,7 @@ module Drntest @config = nil @catalog = nil @fluentd = "fluentd" + @fluetnd_options = [] @pattern = nil end -------------- next part -------------- HTML����������������������������...Download