null+****@clear*****
null+****@clear*****
2012年 4月 3日 (火) 12:48:16 JST
Kouhei Sutou 2012-04-03 12:48:16 +0900 (Tue, 03 Apr 2012) New Revision: 4c0057f1178577b5e05d956abaec01d90e8be913 Log: test: grntest -> groonga_benchmark in method Modified files: test/unit/groonga-benchmark/test-gqtp.rb test/unit/groonga-benchmark/test-http.rb test/unit/groonga-benchmark/test-option.rb test/unit/lib/ruby/groonga-grntest-test-utils.rb Modified: test/unit/groonga-benchmark/test-gqtp.rb (+6 -6) =================================================================== --- test/unit/groonga-benchmark/test-gqtp.rb 2012-04-03 12:09:42 +0900 (717fc8e) +++ test/unit/groonga-benchmark/test-gqtp.rb 2012-04-03 12:48:16 +0900 (145ac44) @@ -37,12 +37,12 @@ class GrntestGQTPTest < Test::Unit::TestCase file.puts("do_gqtp #{command_file.path} 10 5") file.puts("do_gqtp #{command_file.path} 4 2") end - output, error, status = invoke_grntest("--groonga", groonga, - "--protocol", "gqtp", - "--port", "20041", - "--log-output-dir", @tmp_dir, - script_file.path, - @database_path) + output, error, status = invoke_groonga_benchmark("--groonga", groonga, + "--protocol", "gqtp", + "--port", "20041", + "--log-output-dir", @tmp_dir, + script_file.path, + @database_path) assert_predicate(status, :success?, [output, error]) log_file = nil Dir.glob("#{@tmp_dir}/*.log") do |file| Modified: test/unit/groonga-benchmark/test-http.rb (+29 -29) =================================================================== --- test/unit/groonga-benchmark/test-http.rb 2012-04-03 12:09:42 +0900 (52e4010) +++ test/unit/groonga-benchmark/test-http.rb 2012-04-03 12:48:16 +0900 (496c1e4) @@ -36,7 +36,7 @@ class GrntestHTTPTest < Test::Unit::TestCase script = tempfile("script") do |file| file.puts("out_http #{command.path} #{expected.path}") end - output, error, status = invoke_grntest("--groonga", groonga, + output, error, status = invoke_groonga_benchmark("--groonga", groonga, "--protocol", "http", "--port", "20041", "--log-output-dir", @tmp_dir, @@ -58,21 +58,21 @@ class GrntestHTTPTest < Test::Unit::TestCase command = tempfile("command") do |file| file.puts('select Shops --sortby _id --limit 5 --output_columns "name"') end - grntest_command = "rep_http #{command.path}" + groonga_benchmark_command = "rep_http #{command.path}" script = tempfile("script") do |file| - file.puts(grntest_command) + file.puts(groonga_benchmark_command) end log = tempfile("log") - output, error, status = invoke_grntest("--groonga", groonga, - "--protocol", "http", - "--port", "20041", - "--log-path", log.path, - script.path, @database_path) + output, error, status = invoke_groonga_benchmark("--groonga", groonga, + "--protocol", "http", + "--port", "20041", + "--log-path", log.path, + script.path, @database_path) assert_predicate(status, :success?, [output, error]) jobs_list = JSON.parse(log.read).find_all do |element| element.has_key?("jobs") end - assert_equal([grntest_command], + assert_equal([groonga_benchmark_command], jobs_list.collect {|jobs| jobs["jobs"]}) end @@ -81,21 +81,21 @@ class GrntestHTTPTest < Test::Unit::TestCase file.puts('select Shops --sortby _id --limit 5 --output_columns "name" ' + '--output_type xml') end - grntest_command = "rep_http #{command.path}" + groonga_benchmark_command = "rep_http #{command.path}" script = tempfile("script") do |file| - file.puts(grntest_command) + file.puts(groonga_benchmark_command) end log = tempfile("log") - output, error, status = invoke_grntest("--groonga", groonga, - "--protocol", "http", - "--port", "20041", - "--log-path", log.path, - script.path, @database_path) + output, error, status = invoke_groonga_benchmark("--groonga", groonga, + "--protocol", "http", + "--port", "20041", + "--log-path", log.path, + script.path, @database_path) assert_predicate(status, :success?, [output, error]) jobs_list = JSON.parse(log.read).find_all do |element| element.has_key?("jobs") end - assert_equal([grntest_command], + assert_equal([groonga_benchmark_command], jobs_list.collect {|jobs| jobs["jobs"]}) end @@ -119,12 +119,12 @@ class GrntestHTTPTest < Test::Unit::TestCase script_file = tempfile("script") do |file| file.puts("test_http #{command_file.path} #{expected_file.path}") end - output, error, status = invoke_grntest("--groonga", groonga, - "--protocol", "http", - "--port", "20041", - "--log-output-dir", @tmp_dir, - script_file.path, - @database_path) + output, error, status = invoke_groonga_benchmark("--groonga", groonga, + "--protocol", "http", + "--port", "20041", + "--log-output-dir", @tmp_dir, + script_file.path, + @database_path) assert_predicate(status, :success?, [output, error]) assert_equal("", File.read("#{expected_file.path}.diff")) end @@ -158,12 +158,12 @@ class GrntestHTTPTest < Test::Unit::TestCase script_file = tempfile("script") do |file| file.puts("test_http #{command_file.path} #{expected_file.path}") end - output, error, status = invoke_grntest("--groonga", groonga, - "--protocol", "http", - "--port", "20041", - "--log-output-dir", @tmp_dir, - script_file.path, - @database_path) + output, error, status = invoke_groonga_benchmark("--groonga", groonga, + "--protocol", "http", + "--port", "20041", + "--log-output-dir", @tmp_dir, + script_file.path, + @database_path) assert_predicate(status, :success?, [output, error]) assert_equal("DIFF:command:#{command}\n" + "DIFF:result:#{normalize_result(actual)}\n" + Modified: test/unit/groonga-benchmark/test-option.rb (+5 -5) =================================================================== --- test/unit/groonga-benchmark/test-option.rb 2012-04-03 12:09:42 +0900 (cf5f969) +++ test/unit/groonga-benchmark/test-option.rb 2012-04-03 12:48:16 +0900 (7d84bfc) @@ -35,11 +35,11 @@ class GrntestOptionTest < Test::Unit::TestCase file.puts("do_gqtp #{command_file.path}") end log = tempfile("log") - output, error, status = invoke_grntest("--groonga", groonga, - "--protocol", "gqtp", - "--log-path", log.path, - script_file.path, - @database_path) + output, error, status = invoke_groonga_benchmark("--groonga", groonga, + "--protocol", "gqtp", + "--log-path", log.path, + script_file.path, + @database_path) assert_predicate(status, :success?, [output, error]) result = JSON.parse(log.read) assert_equal(1, result.last["queries"]) Modified: test/unit/lib/ruby/groonga-grntest-test-utils.rb (+9 -8) =================================================================== --- test/unit/lib/ruby/groonga-grntest-test-utils.rb 2012-04-03 12:09:42 +0900 (961ec5e) +++ test/unit/lib/ruby/groonga-grntest-test-utils.rb 2012-04-03 12:48:16 +0900 (9aceb42) @@ -36,18 +36,19 @@ module GroongaGrntestTestUtils end private - def guess_grntest_path - grntest = ENV["GROONGA_BENCHMARK"] - grntest ||= File.join(guess_top_source_dir, "src", "groonga-benchmark") - File.expand_path(grntest) + def guess_groonga_benchmark_path + groonga_benchmark = ENV["GROONGA_BENCHMARK"] + groonga_benchmark ||= File.join(guess_top_source_dir, + "src", "groonga-benchmark") + File.expand_path(groonga_benchmark) end - def grntest - @grntest ||= guess_grntest_path + def groonga_benchmark + @groonga_benchmark ||= guess_groonga_benchmark_path end - def invoke_grntest(*args) - args.unshift(grntest) + def invoke_groonga_benchmark(*args) + args.unshift(groonga_benchmark) invoke_command(*args) end