Navigation Menu

Skip to content

Commit

Permalink
Add new options to run-regression-test command.
Browse files Browse the repository at this point in the history
New options are "--old-groonga-option" and "--new-groonga-option".
  • Loading branch information
komainu8 committed Apr 10, 2017
1 parent c7139c9 commit 3d942fb
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion lib/groonga/query-log/command/run-regression-test.rb
Expand Up @@ -34,9 +34,11 @@ def initialize

@old_groonga = "groonga"
@old_database = "db.old/db"
@old_groonga_options = []

@new_groonga = "groonga"
@new_database = "db.new/db"
@new_groonga_options = []

@recreate_database = false
@load_data = true
Expand Down Expand Up @@ -95,6 +97,14 @@ def create_option_parser
@old_groonga = groonga
end

parser.separator("")
parser.separator("Old Groonga Option:")
parser.on("--old-groonga-option=GROONGA_OPTION",
"Old groonga option",
"(#{@old_groonga_options})") do |groonga_option|
@old_groonga_options << groonga_option
end

parser.separator("")
parser.separator("New Groonga:")
parser.on("--new-groonga=GROONGA",
Expand All @@ -103,6 +113,14 @@ def create_option_parser
@new_groonga = groonga
end

parser.separator("")
parser.separator("New Groonga Option:")
parser.on("--new-groonga-option=GROONGA_OPTION",
"New groonga option",
"(#{@new_groonga_options})") do |groonga_option|
@new_groonga_options << groonga_option
end

parser.separator("")
parser.separator("Operations:")
parser.on("--recreate-database",
Expand Down Expand Up @@ -161,22 +179,25 @@ def tester_options

def old_groonga_server
GroongaServer.new(@old_groonga,
@old_groonga_options,
@old_database,
server_options)
end

def new_groonga_server
GroongaServer.new(@new_groonga,
@new_groonga_options,
@new_database,
server_options)
end

class GroongaServer
attr_reader :host, :port
def initialize(groonga, database_path, options)
def initialize(groonga, groonga_options, database_path, options)
@input_directory = options[:input_directory] || Pathname.new(".")
@working_directory = options[:working_directory] || Pathname.new(".")
@groonga = groonga
@groonga_options = groonga_options
@database_path = @working_directory + database_path
@host = "127.0.0.1"
@port = find_unused_port
Expand All @@ -192,6 +213,11 @@ def run
"--protocol", "http",
"--log-path", log_path.to_s,
]

@groonga_options.each{|groonga_option|
arguments << groonga_option
}

if @options[:output_query_log]
arguments.concat(["--query-log-path", query_log_path.to_s])
end
Expand Down

0 comments on commit 3d942fb

Please sign in to comment.