groonga-query-log 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7baac32f5f72c344206d735fa04ab18fad813424
4
- data.tar.gz: b81cf03d7eac23d3b6701b2539baddb6a794bf2b
3
+ metadata.gz: cb08906bfcd75b268d3a3bed4ba2768e81ab3c9b
4
+ data.tar.gz: cc8b5b02688f467c69a99bf768e0549dec253dae
5
5
  SHA512:
6
- metadata.gz: a945b55c42cb1b483a178fc8e0d5f3ee87392bd16775df48599498d26cfcefcce66e7a7b4eae5ce7ed0ca4f41cb0ecc4ef74fa332fb05dbcba0b6fcc480548b8
7
- data.tar.gz: 886297948bbe6b312cd88258498564701cfdf218124d14c68bf8313941b6e01efd7fdab9d4ee53c95e4fe2714a506cee204db0ea01fccaa5829759a300f18175
6
+ metadata.gz: d6467ae4182b3d7e4c56a2b3652e241a83e9ffb9f969109941ad730ab11c2e957d97b773e4b1fb02b9dddbfaa6ccbe028f0ffacf321f4be3a19042cc0493a68b
7
+ data.tar.gz: 53d25ad095f97d429b32c5269f73c6d686702f5308bfeed50a79ce214acc81313271c7447a316ac8a615c6ae0ce473e0354ecfe4071cb9c90b3b1e82bbe526d1
data/README.md CHANGED
@@ -32,11 +32,11 @@ TODO...
32
32
 
33
33
  TODO...
34
34
 
35
- ### groonga-query-log-replay
35
+ ### groonga-query-log-format-regression-test-logs
36
36
 
37
37
  TODO...
38
38
 
39
- ### groonga-query-log-run-regression-test
39
+ ### groonga-query-log-replay
40
40
 
41
41
  TODO...
42
42
 
@@ -2,6 +2,7 @@
2
2
  # -*- coding: utf-8 -*-
3
3
  #
4
4
  # Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com>
5
+ # Copyright (C) 2014 Kouhei Sutou <kou@clear-code.com>
5
6
  #
6
7
  # This library is free software; you can redistribute it and/or
7
8
  # modify it under the terms of the GNU Lesser General Public
@@ -20,9 +21,4 @@
20
21
  require "groonga/query-log"
21
22
 
22
23
  analyzer = Groonga::QueryLog::Analyzer.new
23
- begin
24
- analyzer.run(*ARGV)
25
- rescue Groonga::QueryLog::Analyzer::Error
26
- $stderr.puts($!.message)
27
- exit(false)
28
- end
24
+ exit(analyzer.run(ARGV))
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- coding: utf-8 -*-
3
3
  #
4
- # Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
4
+ # Copyright (C) 2013-2014 Kouhei Sutou <kou@clear-code.com>
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
7
7
  # modify it under the terms of the GNU Lesser General Public
@@ -20,4 +20,4 @@
20
20
  require "groonga/query-log/command/detect-memory-leak"
21
21
 
22
22
  detect_memory_leak_command = Groonga::QueryLog::Command::DetectMemoryLeak.new
23
- detect_memory_leak_command.run(*ARGV)
23
+ exit(detect_memory_leak_command.run(ARGV))
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- coding: utf-8 -*-
3
3
  #
4
- # Copyright (C) 2011 Kouhei Sutou <kou@clear-code.com>
4
+ # Copyright (C) 2011-2014 Kouhei Sutou <kou@clear-code.com>
5
5
  # Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com>
6
6
  #
7
7
  # This library is free software; you can redistribute it and/or
@@ -20,9 +20,4 @@
20
20
  require "groonga/query-log/extractor"
21
21
 
22
22
  extracter = Groonga::QueryLog::Extractor.new
23
- begin
24
- extracter.run(*ARGV)
25
- rescue Groonga::QueryLog::Extractor::Error
26
- $stderr.puts($!.message)
27
- exit(false)
28
- end
23
+ exit(extracter.run(*ARGV))
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2014 Kouhei Sutou <kou@clear-code.com>
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ require "groonga/query-log/command/format-regression-test-logs"
20
+
21
+ command = Groonga::QueryLog::Command::FormatRegressionTestLogs.new
22
+ exit(command.run(ARGV))
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- coding: utf-8 -*-
3
3
  #
4
- # Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
4
+ # Copyright (C) 2013-2014 Kouhei Sutou <kou@clear-code.com>
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
7
7
  # modify it under the terms of the GNU Lesser General Public
@@ -20,4 +20,4 @@
20
20
  require "groonga/query-log/command/replay"
21
21
 
22
22
  replay_command = Groonga::QueryLog::Command::Replay.new
23
- replay_command.run(*ARGV)
23
+ exit(replay_command.run(ARGV))
@@ -20,4 +20,4 @@
20
20
  require "groonga/query-log/command/run-regression-test"
21
21
 
22
22
  command = Groonga::QueryLog::Command::RunRegressionTest.new
23
- command.run(*ARGV)
23
+ exit(command.run(ARGV))
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- coding: utf-8 -*-
3
3
  #
4
- # Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
4
+ # Copyright (C) 2013-2014 Kouhei Sutou <kou@clear-code.com>
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
7
7
  # modify it under the terms of the GNU Lesser General Public
@@ -20,4 +20,4 @@
20
20
  require "groonga/query-log/command/verify-server"
21
21
 
22
22
  verify_server_command = Groonga::QueryLog::Command::VerifyServer.new
23
- verify_server_command.run(*ARGV)
23
+ exit(verify_server_command.run(ARGV))
data/doc/text/news.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # News
2
2
 
3
+ ## 1.0.6: 2014-06-02
4
+
5
+ ### Improvements
6
+
7
+ * groonga-query-log-run-regression-test: Supported `output_columns=*`
8
+ case.
9
+ * groonga-query-log-format-regression-test-logs: Added a command that
10
+ formats logs by groonga-query-log-run-regression-test.
11
+
3
12
  ## 1.0.5: 2014-05-12
4
13
 
5
14
  ### Improvements
@@ -57,7 +57,7 @@ module Groonga
57
57
  # @param [Array<String>] arguments arguments for
58
58
  # groonga-query-log-analyze. Please execute
59
59
  # "groonga-query-log-analyze --help" or see #setup_options.
60
- def run(*arguments)
60
+ def run(arguments)
61
61
  log_paths = @option_parser.parse!(arguments)
62
62
 
63
63
  stream = @options[:stream]
@@ -89,13 +89,15 @@ module Groonga
89
89
 
90
90
  if stream
91
91
  streamer.finish
92
- return
92
+ else
93
+ statistics.replace(full_statistics) unless dynamic_sort
94
+
95
+ reporter = create_reporter(statistics)
96
+ reporter.apply_options(@options)
97
+ reporter.report
93
98
  end
94
- statistics.replace(full_statistics) unless dynamic_sort
95
99
 
96
- reporter = create_reporter(statistics)
97
- reporter.apply_options(@options)
98
- reporter.report
100
+ true
99
101
  end
100
102
 
101
103
  private
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2013-2014 Kouhei Sutou <kou@clear-code.com>
4
4
  #
5
5
  # This library is free software; you can redistribute it and/or
6
6
  # modify it under the terms of the GNU Lesser General Public
@@ -28,14 +28,15 @@ module Groonga
28
28
  @options = MemoryLeakDetector::Options.new
29
29
  end
30
30
 
31
- def run(*command_line)
32
- input_paths = create_parser.parse(*command_line)
31
+ def run(command_line)
32
+ input_paths = create_parser.parse(command_line)
33
33
  detector = MemoryLeakDetector.new(@options)
34
34
  input_paths.each do |input_path|
35
35
  File.open(input_path) do |input|
36
36
  detector.detect(input)
37
37
  end
38
38
  end
39
+ true
39
40
  end
40
41
 
41
42
  private
@@ -0,0 +1,121 @@
1
+ # Copyright (C) 2014 Kouhei Sutou <kou@clear-code.com>
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ require "English"
18
+ require "find"
19
+ require "tempfile"
20
+ require "pp"
21
+ require "optparse"
22
+ require "json"
23
+
24
+ require "groonga/query-log/version"
25
+
26
+ module Groonga
27
+ module QueryLog
28
+ module Command
29
+ class FormatRegressionTestLogs
30
+ def initialize
31
+ end
32
+
33
+ def run(command_line)
34
+ parser = OptionParser.new
35
+ parser.banner += " PATH1 PATH2 ..."
36
+ parser.version = VERSION
37
+ paths = parser.parse!(command_line)
38
+
39
+ if paths.empty?
40
+ format_log($stdin, "-")
41
+ else
42
+ paths.each do |path|
43
+ if File.directory?(path)
44
+ Find.find(path) do |sub_path|
45
+ next unless File.file?(sub_path)
46
+ File.open(sub_path) do |file|
47
+ format_log(file, sub_path)
48
+ end
49
+ end
50
+ else
51
+ File.open(path) do |file|
52
+ format_log(file, path)
53
+ end
54
+ end
55
+ end
56
+ end
57
+ true
58
+ end
59
+
60
+ private
61
+ def format_log(input, path)
62
+ command = nil
63
+ response1 = nil
64
+ response2 = nil
65
+
66
+ input.each_line do |line|
67
+ unless line.valid_encoding?
68
+ puts("invalid encoding line")
69
+ puts("#{path}:#{input.lineno}:#{line}")
70
+ next
71
+ end
72
+ case line
73
+ when /\Acommand: /
74
+ command = $POSTMATCH.chomp
75
+ when /\Aresponse1: /
76
+ response1 = $POSTMATCH.chomp
77
+ when /\Aresponse2: /
78
+ response2 = $POSTMATCH.chomp
79
+ parse_failed = false
80
+ begin
81
+ JSON.parse(response1)
82
+ rescue JSON::ParserError
83
+ puts(command)
84
+ puts("failed to parse response1: #{$!.message}")
85
+ puts(response1)
86
+ parse_failed = true
87
+ end
88
+
89
+ begin
90
+ JSON.parse(response2)
91
+ rescue JSON::ParserError
92
+ puts(command)
93
+ puts("failed to parse response2: #{$!.message}")
94
+ puts(response2)
95
+ parse_failed = true
96
+ end
97
+
98
+ next if parse_failed
99
+
100
+ next if response1 == response2
101
+
102
+ base_name = File.basename(path, ".*")
103
+ Tempfile.open("response1-#{base_name}") do |response1_file|
104
+ PP.pp(JSON.parse(response1), response1_file)
105
+ response1_file.flush
106
+ Tempfile.open("response2-#{base_name}") do |response2_file|
107
+ PP.pp(JSON.parse(response2), response2_file)
108
+ response2_file.flush
109
+ puts(command)
110
+ system("diff",
111
+ "-u",
112
+ response1_file.path, response2_file.path)
113
+ end
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
121
+ end
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2013-2014 Kouhei Sutou <kou@clear-code.com>
4
4
  #
5
5
  # This library is free software; you can redistribute it and/or
6
6
  # modify it under the terms of the GNU Lesser General Public
@@ -28,14 +28,15 @@ module Groonga
28
28
  @options = Replayer::Options.new
29
29
  end
30
30
 
31
- def run(*command_line)
32
- input_paths = create_parser.parse(*command_line)
31
+ def run(command_line)
32
+ input_paths = create_parser.parse(command_line)
33
33
  replayer = Replayer.new(@options)
34
34
  input_paths.each do |input_path|
35
35
  File.open(input_path) do |input|
36
36
  replayer.replay(input)
37
37
  end
38
38
  end
39
+ true
39
40
  end
40
41
 
41
42
  private
@@ -44,7 +44,7 @@ module Groonga
44
44
  @skip_finished_queries = false
45
45
  end
46
46
 
47
- def run(*command_line)
47
+ def run(command_line)
48
48
  option_parser = create_option_parser
49
49
  begin
50
50
  option_parser.parse!(command_line)
@@ -299,14 +299,16 @@ module Groonga
299
299
  end
300
300
  end
301
301
 
302
- old_thread.join
303
- new_thread.join
302
+ old_thread_success = old_thread.value
303
+ new_thread_success = new_thread.value
304
+
305
+ old_thread_success and new_thread_success
304
306
  end
305
307
 
306
308
  private
307
309
  def run_test
308
310
  @n_ready_waits -= 1
309
- return unless @n_ready_waits.zero?
311
+ return true unless @n_ready_waits.zero?
310
312
 
311
313
  @clone_pids.each do |pid|
312
314
  Process.waitpid(pid)
@@ -358,7 +360,7 @@ module Groonga
358
360
  query_log_path.to_s,
359
361
  ]
360
362
  verify_serer = VerifyServer.new
361
- verify_serer.run(*command_line)
363
+ verify_serer.run(command_line)
362
364
  end
363
365
 
364
366
  def query_log_paths
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2013-2014 Kouhei Sutou <kou@clear-code.com>
4
4
  #
5
5
  # This library is free software; you can redistribute it and/or
6
6
  # modify it under the terms of the GNU Lesser General Public
@@ -28,8 +28,8 @@ module Groonga
28
28
  @options = ServerVerifier::Options.new
29
29
  end
30
30
 
31
- def run(*command_line)
32
- input_paths = create_parser.parse(*command_line)
31
+ def run(command_line)
32
+ input_paths = create_parser.parse(command_line)
33
33
  verifier = ServerVerifier.new(@options)
34
34
  if input_paths.empty?
35
35
  verifier.verify($stdin)
@@ -40,6 +40,7 @@ module Groonga
40
40
  end
41
41
  end
42
42
  end
43
+ true
43
44
  end
44
45
 
45
46
  private
@@ -31,9 +31,6 @@ module Groonga
31
31
  class Error < StandardError
32
32
  end
33
33
 
34
- class NoInputError < Error
35
- end
36
-
37
34
  attr_accessor :options
38
35
  attr_reader :option_parser
39
36
 
@@ -58,16 +55,18 @@ module Groonga
58
55
  # @param [Array<String>] arguments arguments for
59
56
  # groonga-query-log-extract. Please execute
60
57
  # "groonga-query-log-extract --help" or see #setup_options.
61
- def run(*arguments)
58
+ def run(arguments)
62
59
  begin
63
60
  log_paths = @option_parser.parse!(arguments)
64
61
  rescue OptionParser::ParseError
65
- raise(ArgumentError, $!.message)
62
+ $stderr.puts($!.message)
63
+ return false
66
64
  end
67
65
 
68
66
  if log_paths.empty?
69
67
  unless log_via_stdin?
70
- raise(NoInputError, "Error: Please specify input log files.")
68
+ $stderr.puts("Error: Please specify input log files.")
69
+ return false
71
70
  end
72
71
  log = $stdin
73
72
  else
@@ -81,6 +80,8 @@ module Groonga
81
80
  else
82
81
  extract(log, $stdout)
83
82
  end
83
+
84
+ true
84
85
  end
85
86
 
86
87
  private
@@ -57,10 +57,9 @@ module Groonga
57
57
 
58
58
  def same_select_response?
59
59
  if random_sort?
60
- records_result1 = @response1.body[0] || []
61
- records_result2 = @response2.body[0] || []
62
- records_result1.size == records_result2.size and
63
- records_result1[0..1] == records_result2[0..1]
60
+ same_random_sort_response?
61
+ elsif all_output_columns?
62
+ same_all_output_columns?
64
63
  else
65
64
  same_response?
66
65
  end
@@ -81,6 +80,69 @@ module Groonga
81
80
  end
82
81
  normalized_sort_items.include?("_score")
83
82
  end
83
+
84
+ def same_random_sort_response?
85
+ records_result1 = @response1.body[0] || []
86
+ records_result2 = @response2.body[0] || []
87
+ return false if records_result1.size != records_result2.size
88
+
89
+ n_hits1 = records_result1[0]
90
+ n_hits2 = records_result2[0]
91
+ return false if n_hits1 != n_hits2
92
+
93
+ columns1 = records_result1[1]
94
+ columns2 = records_result2[1]
95
+ if all_output_columns?
96
+ columns1.sort_by(&:first) == columns2.sort_by(&:first)
97
+ else
98
+ columns1 == columns2
99
+ end
100
+ end
101
+
102
+ def all_output_columns?
103
+ output_columns = @command.output_columns
104
+ output_columns.nil? or
105
+ /\A\s*\z/ === output_columns or
106
+ output_columns.split(/\s*,?\s*/).include?("*")
107
+ end
108
+
109
+ def same_all_output_columns?
110
+ records_result1 = @response1.body[0] || []
111
+ records_result2 = @response2.body[0] || []
112
+ return false if records_result1.size != records_result2.size
113
+
114
+ n_hits1 = records_result1[0]
115
+ n_hits2 = records_result2[0]
116
+ return false if n_hits1 != n_hits2
117
+
118
+ columns1 = records_result1[1]
119
+ columns2 = records_result2[1]
120
+ return false if columns1.sort_by(&:first) != columns2.sort_by(&:first)
121
+
122
+ column_to_index1 = make_column_to_index_map(columns1)
123
+ column_to_index2 = make_column_to_index_map(columns2)
124
+
125
+ records1 = records_result1[2..-1]
126
+ records2 = records_result2[2..-1]
127
+ records1.each_with_index do |record1, record_index|
128
+ record2 = records2[record_index]
129
+ column_to_index1.each do |name, column_index1|
130
+ value1 = record1[column_index1]
131
+ value2 = record2[column_to_index2[name]]
132
+ return false if value1 != value2
133
+ end
134
+ end
135
+
136
+ true
137
+ end
138
+
139
+ def make_column_to_index_map(columns)
140
+ map = {}
141
+ columns.each_with_index do |(name, _), i|
142
+ map[name] = i
143
+ end
144
+ map
145
+ end
84
146
  end
85
147
  end
86
148
  end
@@ -18,6 +18,6 @@
18
18
 
19
19
  module Groonga
20
20
  module QueryLog
21
- VERSION = "1.0.5"
21
+ VERSION = "1.0.6"
22
22
  end
23
23
  end
@@ -85,7 +85,7 @@ class AnalyzerTest < Test::Unit::TestCase
85
85
  def run_analyzer(*arguments)
86
86
  Tempfile.open("output.actual") do |output|
87
87
  arguments << "--output" << output.path
88
- @analyzer.run(*arguments)
88
+ @analyzer.run(arguments)
89
89
  File.read(output.path)
90
90
  end
91
91
  end
@@ -45,9 +45,8 @@ EOC
45
45
  end
46
46
 
47
47
  def test_no_specified
48
- assert_raise(Groonga::QueryLog::Extractor::NoInputError) do
49
- run_extractor
50
- end
48
+ assert_equal("Error: Please specify input log files.\n",
49
+ run_extractor)
51
50
  end
52
51
  end
53
52
 
@@ -100,10 +99,28 @@ EOC
100
99
 
101
100
  private
102
101
  def run_extractor(*arguments)
103
- Tempfile.open("extract.actual") do |output|
104
- arguments << "--output" << output.path
105
- @extractor.run(*arguments)
106
- File.read(output.path)
102
+ Tempfile.open("extract.output") do |output|
103
+ open_error_output do |error|
104
+ arguments << "--output" << output.path
105
+ if @extractor.run(arguments)
106
+ File.read(output.path)
107
+ else
108
+ File.read(error.path)
109
+ end
110
+ end
111
+ end
112
+ end
113
+
114
+ def open_error_output
115
+ Tempfile.open("extract.error") do |error|
116
+ error.sync = true
117
+ original_stderr = $stderr.dup
118
+ $stderr.reopen(error)
119
+ begin
120
+ yield(error)
121
+ ensure
122
+ $stderr.reopen(original_stderr)
123
+ end
107
124
  end
108
125
  end
109
126
 
@@ -58,19 +58,43 @@ class ResponseComparerTest < Test::Unit::TestCase
58
58
  end
59
59
 
60
60
  def test_different_order
61
+ @command["output_columns"] = "_id"
61
62
  assert_true(same?([[[3], [["_id", "UInt32"]], [1], [2], [3]]],
62
63
  [[[3], [["_id", "UInt32"]], [3], [2], [1]]]))
63
64
  end
64
65
 
65
66
  def test_different_attributes
67
+ @command["output_columns"] = "_id, age"
66
68
  assert_false(same?([[[3], [["_id", "UInt32"]], [1], [2], [3]]],
67
69
  [[[3], [["age", "UInt32"]], [1], [2], [3]]]))
68
70
  end
69
71
 
70
72
  def test_different_n_records
73
+ @command["output_columns"] = "_id"
71
74
  assert_false(same?([[[3], [["_id", "UInt32"]], [1], [2]]],
72
75
  [[[3], [["_id", "UInt32"]], [1], [2], [3]]]))
73
76
  end
77
+
78
+ def test_all_output_columns
79
+ assert_true(same?([
80
+ [
81
+ [3],
82
+ [["_id", "UInt32"], ["_key", "ShortText"]],
83
+ [1, "1"],
84
+ [2, "2"],
85
+ [3, "3"],
86
+ ],
87
+ ],
88
+ [
89
+ [
90
+ [3],
91
+ [["_key", "ShortText"], ["_id", "UInt32"]],
92
+ ["3", 3],
93
+ ["2", 2],
94
+ ["1", 1],
95
+ ],
96
+ ]))
97
+ end
74
98
  end
75
99
 
76
100
  class DetectRandTest < self
@@ -138,6 +162,73 @@ class ResponseComparerTest < Test::Unit::TestCase
138
162
  end
139
163
  end
140
164
 
165
+ class OutputColumnsTest < self
166
+ class AllTest < self
167
+ def setup
168
+ super
169
+ @command["output_columns"] = "*"
170
+ end
171
+
172
+ def test_different_order
173
+ assert_true(same?([
174
+ [
175
+ [3],
176
+ [["_id", "UInt32"], ["_key", "ShortText"]],
177
+ [1, "1"],
178
+ [2, "2"],
179
+ [3, "3"],
180
+ ],
181
+ ],
182
+ [
183
+ [
184
+ [3],
185
+ [["_key", "ShortText"], ["_id", "UInt32"]],
186
+ ["1", 1],
187
+ ["2", 2],
188
+ ["3", 3],
189
+ ],
190
+ ]))
191
+ end
192
+
193
+ def test_different_record
194
+ assert_false(same?([
195
+ [
196
+ [1],
197
+ [["_id", "UInt32"], ["_key", "ShortText"]],
198
+ [1, "1"],
199
+ ],
200
+ ],
201
+ [
202
+ [
203
+ [1],
204
+ [["_key", "ShortText"], ["_id", "UInt32"]],
205
+ [2, "2"],
206
+ ],
207
+ ]))
208
+ end
209
+ end
210
+
211
+ class DetectAllTest < self
212
+ def test_star_only
213
+ assert_true(all_output_columns?("*"))
214
+ end
215
+
216
+ def test_include_star
217
+ assert_true(all_output_columns?("_key, _value, *"))
218
+ end
219
+
220
+ def test_default
221
+ assert_true(all_output_columns?(nil))
222
+ end
223
+
224
+ private
225
+ def all_output_columns?(output_columns)
226
+ @command["output_columns"] = output_columns if output_columns
227
+ comparer([[[0]]], [[[0]]]).send(:all_output_columns?)
228
+ end
229
+ end
230
+ end
231
+
141
232
  class ErrorTest < self
142
233
  def test_with_location
143
234
  response1_header = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groonga-query-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-12 00:00:00.000000000 Z
11
+ date: 2014-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: groonga-command-parser
@@ -154,12 +154,13 @@ description: ''
154
154
  email:
155
155
  - kou@clear-code.com
156
156
  executables:
157
+ - groonga-query-log-format-regression-test-logs
158
+ - groonga-query-log-verify-server
159
+ - groonga-query-log-extract
157
160
  - groonga-query-log-run-regression-test
158
- - groonga-query-log-analyze
159
- - groonga-query-log-detect-memory-leak
160
161
  - groonga-query-log-replay
161
- - groonga-query-log-extract
162
- - groonga-query-log-verify-server
162
+ - groonga-query-log-detect-memory-leak
163
+ - groonga-query-log-analyze
163
164
  extensions: []
164
165
  extra_rdoc_files: []
165
166
  files:
@@ -170,6 +171,7 @@ files:
170
171
  - bin/groonga-query-log-analyze
171
172
  - bin/groonga-query-log-detect-memory-leak
172
173
  - bin/groonga-query-log-extract
174
+ - bin/groonga-query-log-format-regression-test-logs
173
175
  - bin/groonga-query-log-replay
174
176
  - bin/groonga-query-log-run-regression-test
175
177
  - bin/groonga-query-log-verify-server
@@ -189,6 +191,7 @@ files:
189
191
  - lib/groonga/query-log/analyzer/streamer.rb
190
192
  - lib/groonga/query-log/command-line-utils.rb
191
193
  - lib/groonga/query-log/command/detect-memory-leak.rb
194
+ - lib/groonga/query-log/command/format-regression-test-logs.rb
192
195
  - lib/groonga/query-log/command/replay.rb
193
196
  - lib/groonga/query-log/command/run-regression-test.rb
194
197
  - lib/groonga/query-log/command/verify-server.rb
@@ -247,24 +250,24 @@ summary: Groonga-query-log is a collection of library and tools to process [Groo
247
250
  as a library. You can analyze your Groonga's queries and test with your Groonga's
248
251
  query log by using groonga-query-log as a tool.
249
252
  test_files:
250
- - test/run-test.rb
251
- - test/test-extractor.rb
252
- - test/command/test-select.rb
253
253
  - test/test-analyzer.rb
254
- - test/test-replayer.rb
255
254
  - test/test-parser.rb
256
- - test/fixtures/no-report-summary.expected
257
- - test/fixtures/order/elapsed.expected
258
- - test/fixtures/order/-start-time.expected
259
- - test/fixtures/order/start-time.expected
260
- - test/fixtures/order/-elapsed.expected
261
- - test/fixtures/n_entries.expected
255
+ - test/groonga-query-log-test-utils.rb
256
+ - test/test-response-comparer.rb
257
+ - test/command/test-select.rb
262
258
  - test/fixtures/other-query.log
263
- - test/fixtures/reporter/json.expected
264
259
  - test/fixtures/reporter/console.expected
265
260
  - test/fixtures/reporter/html.expected
266
- - test/fixtures/multi.expected
261
+ - test/fixtures/reporter/json.expected
267
262
  - test/fixtures/query.log
268
- - test/groonga-query-log-test-utils.rb
269
- - test/test-response-comparer.rb
263
+ - test/fixtures/multi.expected
264
+ - test/fixtures/no-report-summary.expected
265
+ - test/fixtures/n_entries.expected
266
+ - test/fixtures/order/-start-time.expected
267
+ - test/fixtures/order/elapsed.expected
268
+ - test/fixtures/order/start-time.expected
269
+ - test/fixtures/order/-elapsed.expected
270
+ - test/run-test.rb
271
+ - test/test-extractor.rb
272
+ - test/test-replayer.rb
270
273
  has_rdoc: