lib/grntest/tester.rb in grntest-1.5.7 vs lib/grntest/tester.rb in grntest-1.5.8

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (C) 2012-2022 Sutou Kouhei <kou@clear-code.com> +# Copyright (C) 2012-2023 Sutou Kouhei <kou@clear-code.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. @@ -36,22 +36,30 @@ private def create_option_parser(tester, tag) parser = OptionParser.new parser.banner += " TEST_FILE_OR_DIRECTORY..." + custom_groonga_httpd = false parser.on("--groonga=COMMAND", "Use COMMAND as groonga command", "(#{tester.groonga})") do |command| tester.groonga = normalize_command(command) end parser.on("--groonga-httpd=COMMAND", "Use COMMAND as groonga-httpd command for groonga-httpd tests", "(#{tester.groonga_httpd})") do |command| tester.groonga_httpd = normalize_command(command) + custom_groonga_httpd = true end + parser.on("--ngx-http-groonga-module-so=PATH", + "Use PATH as ngx_http_groonga_module.so for groonga-nginx tests", + "(#{tester.ngx_http_groonga_module_so})") do |path| + tester.ngx_http_groonga_module_so = path + end + parser.on("--groonga-suggest-create-dataset=COMMAND", "Use COMMAND as groonga_suggest_create_dataset command", "(#{tester.groonga_suggest_create_dataset})") do |command| tester.groonga_suggest_create_dataset = normalize_command(command) end @@ -99,19 +107,23 @@ "[#{available_output_type_labels}]", "(#{tester.output_type})") do |type| tester.output_type = type end - available_testees = ["groonga", "groonga-httpd"] + available_testees = ["groonga", "groonga-httpd", "groonga-nginx"] available_testee_labels = available_testees.join(", ") parser.on("--testee=TESTEE", available_testees, "Test against TESTEE", "[#{available_testee_labels}]", "(#{tester.testee})") do |testee| tester.testee = testee - if tester.testee == "groonga-httpd" + case tester.testee + when "groonga-httpd" tester.interface = "http" + when "groonga-nginx" + tester.interface = "http" + tester.groonga_httpd = "nginx" unless custom_groonga_httpd end end parser.on("--base-directory=DIRECTORY", "Use DIRECTORY as a base directory of relative path", @@ -279,10 +291,15 @@ "Timeout for waiting shutdown", "(#{tester.shutdown_wait_timeout})") do |timeout| tester.shutdown_wait_timeout = timeout end + parser.on("--random-seed=SEED", Integer, + "Seed for random numbers") do |seed| + srand(seed) + end + parser.on("--version", "Show version and exit") do puts(VERSION) throw(tag, true) end @@ -315,10 +332,11 @@ end end attr_accessor :groonga attr_accessor :groonga_httpd + attr_accessor :ngx_http_groonga_module_so attr_accessor :groonga_suggest_create_dataset attr_accessor :groonga_synonym_generate attr_accessor :interface attr_writer :use_http_post attr_writer :use_http_chunked @@ -344,9 +362,10 @@ attr_accessor :n_retries attr_accessor :shutdown_wait_timeout def initialize @groonga = "groonga" @groonga_httpd = "groonga-httpd" + @ngx_http_groonga_module_so = nil @groonga_suggest_create_dataset = "groonga-suggest-create-dataset" unless command_exist?(@groonga_suggest_create_dataset) @groonga_suggest_create_dataset = nil end @groonga_synonym_generate = "groonga-synonym-generate"