grntest 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7da2ff4d46c711c2bc7bf534ed0478fc4bb9a510
4
- data.tar.gz: 7734142d71d8b3d0375e9275eb168fac6df23932
3
+ metadata.gz: c677198eaacb9883f7cd6ca46f7b7cf0ee6d5aea
4
+ data.tar.gz: 8b50e54a05791eaf15370b1951eac4b831a52e31
5
5
  SHA512:
6
- metadata.gz: d17ae23c5d7342c7aae95d96bf2c8e271661860232b4766d7397250c1276b7984d1be6b2d415f30639b5a1f2a0b4be8705c6202973bd626afdc4b38bdce63994
7
- data.tar.gz: e35c94ee423590de22f75f33406f6728ce6ff016d08001aac49645dd1b8d7f74c7d68d0ac14e0396209a20e4efc27284c62910b0a0516602668d0f4ee9602050
6
+ metadata.gz: d8d191e4fd6029fedfa9a4b346514f280ad133266e8acb236a0c0f46ee9b35a6e8cff38e7b84c3f8d13c894ab82c20a610ed4d9c7ab1d62d2fe18552c50efa69
7
+ data.tar.gz: 0421f9e8c25fce0adbcaa43c6503737c71c8bcd2c49f167ef57c3333eabc00a7172314599c2dcb945cf0deaf56ba80e6fa8c2fc11db02253f22cf8e1991c560a
data/README.md CHANGED
@@ -219,6 +219,8 @@ Here are available `NAME` s:
219
219
  * `omit`
220
220
  * `add-important-log-levels`
221
221
  * `remove-important-log-levels`
222
+ * `sleep`
223
+ * `collect-query-log`
222
224
 
223
225
  `ARGUMENTS...` are depends on directive. A directive doesn't require
224
226
  any arguments but a directive requires arguments.
@@ -357,6 +359,9 @@ Usage:
357
359
  It copies a path from `SOURCE` to `DESTINATION`. You can use it for
358
360
  both file and directory. It is useful for using fixture data.
359
361
 
362
+ You can use `#{db_path}` in `SOURCE` and `DESTINATION`. `#{db_path}`
363
+ is expanded to the path of the database.
364
+
360
365
  Example:
361
366
 
362
367
  ```
@@ -510,6 +515,46 @@ log_put --level debug --message "This is a message"
510
515
  # No message is collected by grntest
511
516
  ```
512
517
 
518
+ #### `sleep`
519
+
520
+ Usage:
521
+
522
+ ```
523
+ #@sleep SECOND
524
+ ```
525
+
526
+ It stops execution while the specified seconds.
527
+
528
+ Example:
529
+
530
+ ```
531
+ load --table Users
532
+ [
533
+ {"_key": "User1"}
534
+ ]
535
+ #@sleep 1.5
536
+ # Run select after 1.5 sec.
537
+ select Users --query _key:User1
538
+ ```
539
+
540
+ #### `collect-query-log`
541
+
542
+ Usage:
543
+
544
+ ```
545
+ #@collect-query-log [true|false]
546
+ ```
547
+
548
+ It collects messages from query log and prints them.
549
+
550
+ Example:
551
+
552
+ ```
553
+ #@collect-query-log true
554
+ select Users --query _key:User1
555
+ #@collect-query-log false
556
+ ```
557
+
513
558
  ## Options
514
559
 
515
560
  Grntest has many options. You don't need to specify many of them
data/doc/text/news.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # News
2
2
 
3
+ ## 1.1.3: 2016-03-20
4
+
5
+ ### Improvements
6
+
7
+ * Added `sleep` directive.
8
+ * Added `collect-query-log` directive.
9
+ * Added `buffered-mark` reporter. You can use it by
10
+ `--runner=buffered-mark`.
11
+ * Improved OS X support.
12
+ * Supported `#{db_path}` in `copy-path` directive argument.
13
+ * Supported SEGV detection on exit.
14
+ * Supported `--columns` option of `load` command.
15
+ * Suppressed omit logs by default. You can enable it by
16
+ `--no-suppress-omit-log`.
17
+
3
18
  ## 1.1.2: 2015-07-08
4
19
 
5
20
  ### Improvements
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
4
4
  #
5
5
  # This program is free software: you can redistribute it and/or modify
6
6
  # it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@ module Grntest
24
24
  attr_accessor :output_type
25
25
  attr_accessor :on_error
26
26
  attr_accessor :abort_tag
27
+ attr_writer :collect_query_log
27
28
  def initialize
28
29
  @logging = true
29
30
  @base_directory = Pathname(".")
@@ -37,12 +38,17 @@ module Grntest
37
38
  @on_error = :default
38
39
  @abort_tag = nil
39
40
  @omitted = false
41
+ @collect_query_log = false
40
42
  end
41
43
 
42
44
  def logging?
43
45
  @logging
44
46
  end
45
47
 
48
+ def collect_query_log?
49
+ @collect_query_log
50
+ end
51
+
46
52
  def execute
47
53
  @n_nested += 1
48
54
  yield
@@ -62,6 +68,14 @@ module Grntest
62
68
  @log ||= File.open(log_path.to_s, "a+")
63
69
  end
64
70
 
71
+ def query_log_path
72
+ @temporary_directory_path + "groonga.query.log"
73
+ end
74
+
75
+ def query_log
76
+ @query_log ||= File.open(query_log_path.to_s, "a+")
77
+ end
78
+
65
79
  def relative_db_path
66
80
  @db_path.relative_path_from(@temporary_directory_path)
67
81
  end
@@ -21,6 +21,7 @@ require "groonga/command/parser"
21
21
 
22
22
  require "grntest/error"
23
23
  require "grntest/log-parser"
24
+ require "grntest/query-log-parser"
24
25
  require "grntest/execution-context"
25
26
  require "grntest/response-parser"
26
27
 
@@ -71,7 +72,34 @@ module Grntest
71
72
  @context.result
72
73
  end
73
74
 
75
+ def shutdown(pid)
76
+ begin
77
+ send_command(command("shutdown"))
78
+ rescue
79
+ return false
80
+ end
81
+
82
+ status = nil
83
+ timeout = 1
84
+ total_sleep_time = 0
85
+ sleep_time = 0.05
86
+ loop do
87
+ _, status = Process.waitpid2(pid, Process::WNOHANG)
88
+ break if status
89
+ sleep(sleep_time)
90
+ total_sleep_time += sleep_time
91
+ return false if total_sleep_time > timeout
92
+ end
93
+
94
+ log_error(read_all_log) unless status.success?
95
+ true
96
+ end
97
+
74
98
  private
99
+ def command(command_line)
100
+ Groonga::Command::Parser.parse(command_line)
101
+ end
102
+
75
103
  def create_parser
76
104
  parser = Groonga::Command::Parser.new
77
105
  parser.on_command do |command|
@@ -127,6 +155,17 @@ module Grntest
127
155
  execute_script(Pathname(path))
128
156
  end
129
157
 
158
+ def expand_variables(string)
159
+ string.gsub(/\#{(.+?)}/) do |matched|
160
+ case $1
161
+ when "db_path"
162
+ @context.db_path.to_s
163
+ else
164
+ matched
165
+ end
166
+ end
167
+ end
168
+
130
169
  def execute_directive_copy_path(line, content, options)
131
170
  source, destination, = options
132
171
  if source.nil? or destination.nil?
@@ -139,8 +178,8 @@ module Grntest
139
178
  end
140
179
  return
141
180
  end
142
- source = resolve_path(Pathname(source))
143
- destination = resolve_path(Pathname(destination))
181
+ source = resolve_path(Pathname(expand_variables(source)))
182
+ destination = resolve_path(Pathname(expand_variables(destination)))
144
183
  FileUtils.cp_r(source.to_s, destination.to_s)
145
184
  end
146
185
 
@@ -210,6 +249,15 @@ module Grntest
210
249
  level[0]
211
250
  end
212
251
 
252
+ def execute_directive_sleep(line, content, options)
253
+ time = options[0].to_f
254
+ sleep(time) if time >= 0
255
+ end
256
+
257
+ def execute_directive_collect_query_log(line, content, options)
258
+ @context.collect_query_log = (options[0] == "true")
259
+ end
260
+
213
261
  def execute_directive(line, content)
214
262
  command, *options = Shellwords.split(content)
215
263
  case command
@@ -233,6 +281,10 @@ module Grntest
233
281
  execute_directive_add_important_log_levels(line, content, options)
234
282
  when "remove-important-log-levels"
235
283
  execute_directive_remove_important_log_levels(line, content, options)
284
+ when "sleep"
285
+ execute_directive_sleep(line, content, options)
286
+ when "collect-query-log"
287
+ execute_directive_collect_query_log(line, content, options)
236
288
  else
237
289
  log_input(line)
238
290
  log_error("#|e| unknown directive: <#{command}>")
@@ -284,6 +336,7 @@ module Grntest
284
336
  type = @output_type
285
337
  log_output(response)
286
338
  log_error(extract_important_messages(read_all_log))
339
+ log_query_log_content(read_all_query_log)
287
340
 
288
341
  @context.error if error_response?(response, type)
289
342
  end
@@ -293,6 +346,10 @@ module Grntest
293
346
  read_all_readable_content(context.log, :first_timeout => 0)
294
347
  end
295
348
 
349
+ def read_all_query_log
350
+ read_all_readable_content(context.query_log, :first_timeout => 0)
351
+ end
352
+
296
353
  def extract_important_messages(log)
297
354
  important_messages = []
298
355
  parser = LogParser.new
@@ -306,7 +363,7 @@ module Grntest
306
363
 
307
364
  def read_all_readable_content(output, options={})
308
365
  content = ""
309
- first_timeout = options[:first_timeout] || 1
366
+ first_timeout = options[:first_timeout] || 5
310
367
  timeout = first_timeout
311
368
  while IO.select([output], [], [], timeout)
312
369
  break if output.eof?
@@ -329,6 +386,10 @@ module Grntest
329
386
  true
330
387
  when /\Agroonga\(\) \[0x[\da-f]+\]\z/
331
388
  true
389
+ when /\A\d+\s+(?:lib\S+\.dylib|\S+\.so|groonga|nginx|\?\?\?)\s+
390
+ 0x[\da-f]+\s
391
+ \S+\s\+\s\d+\z/x
392
+ true
332
393
  else
333
394
  false
334
395
  end
@@ -372,6 +433,19 @@ module Grntest
372
433
  log_force(:error, content, {})
373
434
  end
374
435
 
436
+ def log_query(content)
437
+ log_force(:query, content, {})
438
+ end
439
+
440
+ def log_query_log_content(content)
441
+ return unless @context.collect_query_log?
442
+
443
+ parser = QueryLogParser.new
444
+ parser.parse(content) do |entry|
445
+ log_query("\##{entry.mark}#{entry.message}")
446
+ end
447
+ end
448
+
375
449
  def default_long_timeout
376
450
  180
377
451
  end
@@ -49,22 +49,11 @@ module Grntest
49
49
  end
50
50
  end
51
51
 
52
- def shutdown
53
- begin
54
- send_command(command("shutdown"))
55
- rescue Error
56
- end
57
- end
58
-
59
52
  def create_sub_executor(context)
60
53
  self.class.new(@host, @port, context)
61
54
  end
62
55
 
63
56
  private
64
- def command(command_line)
65
- Groonga::Command::Parser.parse(command_line)
66
- end
67
-
68
57
  MAX_URI_SIZE = 4096
69
58
  def send_load_command(command)
70
59
  lines = command.original_source.lines
@@ -74,7 +63,9 @@ module Grntest
74
63
 
75
64
  values = command.arguments.delete(:values)
76
65
  if lines.size >= 2 and lines[1].start_with?("[")
77
- command.arguments.delete(:columns)
66
+ unless /\s--columns\s/ =~ lines.first
67
+ command.arguments.delete(:columns)
68
+ end
78
69
  body = lines[1..-1].join
79
70
  else
80
71
  body = values
@@ -27,8 +27,8 @@ module Grntest
27
27
  end
28
28
 
29
29
  def send_command(command)
30
- command_line = @current_command.original_source
31
- unless @current_command.has_key?(:output_type)
30
+ command_line = command.original_source
31
+ if !command.key?(:output_type) and @output_type
32
32
  command_line = command_line.sub(/$/, " --output_type #{@output_type}")
33
33
  end
34
34
  begin
@@ -39,7 +39,7 @@ module Grntest
39
39
  message = "failed to write to groonga: <#{command_line}>: #{$!}"
40
40
  raise Error.new(message)
41
41
  end
42
- read_output
42
+ read_output(command)
43
43
  end
44
44
 
45
45
  def ensure_groonga_ready
@@ -53,19 +53,24 @@ module Grntest
53
53
  end
54
54
 
55
55
  private
56
- def read_output
56
+ def read_output(command)
57
57
  options = {}
58
- options[:first_timeout] = @long_timeout if may_slow_command?
58
+ if may_slow_command?(command)
59
+ options[:first_timeout] = @long_timeout
60
+ elsif command.name == "dump"
61
+ options[:first_timeout] = 0.1
62
+ end
59
63
  read_all_readable_content(@output, options)
60
64
  end
61
65
 
62
66
  MAY_SLOW_COMMANDS = [
63
67
  "column_create",
64
- "register",
65
68
  "load",
69
+ "plugin_register",
70
+ "register",
66
71
  ]
67
- def may_slow_command?
68
- MAY_SLOW_COMMANDS.include?(@current_command.name)
72
+ def may_slow_command?(command)
73
+ MAY_SLOW_COMMANDS.include?(command.name)
69
74
  end
70
75
  end
71
76
  end
@@ -0,0 +1,19 @@
1
+ # Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program 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
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ module Grntest
17
+ class QueryLogEntry < Struct.new(:timestamp, :mark, :message)
18
+ end
19
+ end
@@ -0,0 +1,63 @@
1
+ # Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program 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
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require "grntest/query-log-entry"
17
+
18
+ module Grntest
19
+ class QueryLogParser
20
+ def parse(log)
21
+ log.each_line do |line|
22
+ case line
23
+ when /\A(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+)\|.+?\|(.)/
24
+ timestamp = $1
25
+ mark = $2
26
+ message = normalize_message(mark, $POSTMATCH.chomp)
27
+ entry = QueryLogEntry.new(timestamp, mark, message)
28
+ yield(entry)
29
+ end
30
+ end
31
+ end
32
+
33
+ private
34
+ def normalize_message(mark, message)
35
+ case mark
36
+ when ">"
37
+ message = normalize_command(message)
38
+ else
39
+ message = normalize_elapsed_time(message)
40
+ message = normalize_cache_content(message)
41
+ end
42
+ message
43
+ end
44
+
45
+ def normalize_command(message)
46
+ command = Groonga::Command::Parser.parse(message)
47
+ if command.output_type == :json
48
+ command[:output_type] = nil
49
+ end
50
+ command.to_command_format
51
+ end
52
+
53
+ def normalize_elapsed_time(message)
54
+ message.gsub(/\A\d{15} /, "0" * 15 + " ")
55
+ end
56
+
57
+ def normalize_cache_content(message)
58
+ message.gsub(/\A(0{15}) (cache\()\d+(\))\z/) do
59
+ "#{$1} #{$2}0#{$3}"
60
+ end
61
+ end
62
+ end
63
+ end
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
4
4
  #
5
5
  # This program is free software: you can redistribute it and/or modify
6
6
  # it under the terms of the GNU General Public License as published by
@@ -16,6 +16,7 @@
16
16
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
18
  require "grntest/reporters/mark-reporter"
19
+ require "grntest/reporters/buffered-mark-reporter"
19
20
  require "grntest/reporters/stream-reporter"
20
21
  require "grntest/reporters/inplace-reporter"
21
22
 
@@ -26,6 +27,8 @@ module Grntest
26
27
  case tester.reporter
27
28
  when :mark
28
29
  MarkReporter.new(tester)
30
+ when :"buffered-mark"
31
+ BufferedMarkReporter.new(tester)
29
32
  when :stream
30
33
  StreamReporter.new(tester)
31
34
  when :inplace
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
4
2
  #
5
3
  # This program is free software: you can redistribute it and/or modify
6
4
  # it under the terms of the GNU General Public License as published by
@@ -155,7 +153,7 @@ module Grntest
155
153
  end
156
154
 
157
155
  def print(message)
158
- @current_column += string_width(message.to_s)
156
+ increment_current_column(message)
159
157
  @output.print(message)
160
158
  end
161
159
 
@@ -164,6 +162,10 @@ module Grntest
164
162
  @output.puts(*messages)
165
163
  end
166
164
 
165
+ def increment_current_column(message)
166
+ @current_column += string_width(message.to_s)
167
+ end
168
+
167
169
  def reset_current_column
168
170
  @current_column = 0
169
171
  end
@@ -0,0 +1,41 @@
1
+ # Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program 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
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require "grntest/reporters/mark-reporter"
17
+
18
+ module Grntest
19
+ module Reporters
20
+ class BufferedMarkReporter < MarkReporter
21
+ def initialize(tester)
22
+ super
23
+ @buffer = ""
24
+ end
25
+
26
+ private
27
+ def print_new_line
28
+ puts(@buffer)
29
+ @buffer.clear
30
+ end
31
+
32
+ def print_mark(mark)
33
+ increment_current_column(mark)
34
+ @buffer << mark
35
+ end
36
+
37
+ def flush_mark
38
+ end
39
+ end
40
+ end
41
+ end
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
4
4
  #
5
5
  # This program is free software: you can redistribute it and/or modify
6
6
  # it under the terms of the GNU General Public License as published by
@@ -45,7 +45,7 @@ module Grntest
45
45
  def on_test_failure(worker, result)
46
46
  synchronize do
47
47
  report_test_result_mark("F", result)
48
- puts
48
+ print_new_line
49
49
  report_test(worker, result)
50
50
  report_failure(result)
51
51
  end
@@ -54,7 +54,7 @@ module Grntest
54
54
  def on_test_leak(worker, result)
55
55
  synchronize do
56
56
  report_test_result_mark("L(#{result.n_leaked_objects})", result)
57
- puts
57
+ print_new_line
58
58
  report_test(worker, result)
59
59
  if result.checked?
60
60
  report_actual(result)
@@ -67,7 +67,7 @@ module Grntest
67
67
  def on_test_omission(worker, result)
68
68
  synchronize do
69
69
  report_test_result_mark("O", result)
70
- puts
70
+ print_new_line
71
71
  report_test(worker, result)
72
72
  report_actual(result)
73
73
  end
@@ -76,7 +76,7 @@ module Grntest
76
76
  def on_test_no_check(worker, result)
77
77
  synchronize do
78
78
  report_test_result_mark("N", result)
79
- puts
79
+ print_new_line
80
80
  report_test(worker, result)
81
81
  report_actual(result)
82
82
  end
@@ -92,23 +92,35 @@ module Grntest
92
92
  end
93
93
 
94
94
  def on_finish(result)
95
- puts
96
- puts
95
+ print_new_line
96
+ print_new_line
97
97
  report_summary(result)
98
98
  end
99
99
 
100
100
  private
101
101
  def report_test_result_mark(mark, result)
102
102
  if @term_width < @current_column + mark.bytesize
103
- puts
103
+ print_new_line
104
104
  end
105
- print(colorize(mark, result))
105
+ print_mark(colorize(mark, result))
106
106
  if @term_width <= @current_column
107
- puts
107
+ print_new_line
108
108
  else
109
- @output.flush
109
+ flush_mark
110
110
  end
111
111
  end
112
+
113
+ def print_new_line
114
+ puts
115
+ end
116
+
117
+ def print_mark(mark)
118
+ print(mark)
119
+ end
120
+
121
+ def flush_mark
122
+ @output.flush
123
+ end
112
124
  end
113
125
  end
114
126
  end
@@ -204,7 +204,11 @@ module Grntest
204
204
  groonga_output,
205
205
  context)
206
206
  executor.ensure_groonga_ready
207
- yield(executor)
207
+ begin
208
+ yield(executor)
209
+ ensure
210
+ pid = nil if executor.shutdown(pid)
211
+ end
208
212
  end
209
213
  ensure
210
214
  Process.waitpid(pid) if pid
@@ -284,6 +288,7 @@ call chdir("#{context.temporary_directory_path}")
284
288
  command_line = command_command_line(@tester.groonga, context,
285
289
  spawn_options)
286
290
  command_line << "--log-path=#{context.log_path}"
291
+ command_line << "--query-log-path=#{context.query_log_path}"
287
292
  command_line << "--working-directory=#{context.temporary_directory_path}"
288
293
  command_line
289
294
  end
@@ -338,7 +343,7 @@ call chdir("#{context.temporary_directory_path}")
338
343
  end
339
344
  yield(executor)
340
345
  ensure
341
- executor.shutdown
346
+ pid = nil if executor.shutdown(pid)
342
347
  if wait_groonga_http_shutdown(pid_file_path, shutdown_wait_timeout)
343
348
  pid = nil if wait_pid(pid, shutdown_wait_timeout)
344
349
  end
@@ -450,6 +455,7 @@ http {
450
455
  location /d/ {
451
456
  groonga_database #{context.relative_db_path};
452
457
  groonga_log_path #{context.log_path};
458
+ groonga_query_log_path #{context.query_log_path};
453
459
  groonga on;
454
460
  }
455
461
  }
@@ -487,6 +493,8 @@ http {
487
493
  normalized_result << normalize_output(content, options)
488
494
  when :error
489
495
  normalized_result << normalize_error(content)
496
+ when :query
497
+ normalized_result << normalize_raw_content(content)
490
498
  when :n_leaked_objects
491
499
  result.n_leaked_objects = content
492
500
  end
@@ -534,6 +542,8 @@ http {
534
542
  when "xml"
535
543
  normalized_xml = normalize_output_xml(content, options)
536
544
  normalize_raw_content(normalized_xml)
545
+ when "groonga-command"
546
+ normalize_raw_content(content.chomp)
537
547
  else
538
548
  normalize_raw_content(content)
539
549
  end
@@ -578,14 +588,10 @@ http {
578
588
 
579
589
  def normalize_path_in_error_message(content)
580
590
  case content
581
- when /\A(.*'fopen: failed to open mruby script file: )<(.+?)>'(.*)\z/
591
+ when /\A(.*: fopen: failed to open mruby script file: )<(.+?)>?\z/
582
592
  pre = $1
583
593
  path = $2
584
- post = $3
585
- normalized_path = File.basename(path)
586
- post = post.gsub(/\[\d+\]\z/, "[?]")
587
- post = "" unless /[\)\]]\z/ =~ post
588
- "#{pre}<#{normalized_path}>'#{post}"
594
+ "#{pre}<PATH>"
589
595
  else
590
596
  content
591
597
  end
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2012-2016 Kouhei Sutou <kou@clear-code.com>
4
2
  #
5
3
  # This program is free software: you can redistribute it and/or modify
6
4
  # it under the terms of the GNU General Public License as published by
@@ -116,7 +114,7 @@ module Grntest
116
114
  diff_option_is_specified = true
117
115
  end
118
116
 
119
- available_reporters = [:mark, :stream, :inplace]
117
+ available_reporters = [:mark, :"buffered-mark", :stream, :inplace]
120
118
  available_reporter_labels = available_reporters.join(", ")
121
119
  parser.on("--reporter=REPORTER", available_reporters,
122
120
  "Report test result by REPORTER",
@@ -188,6 +186,12 @@ module Grntest
188
186
  tester.stop_on_failure = boolean
189
187
  end
190
188
 
189
+ parser.on("--no-suppress-omit-log",
190
+ "Suppress omit logs",
191
+ "(#{tester.suppress_omit_log?})") do |boolean|
192
+ tester.suppress_omit_log = boolean
193
+ end
194
+
191
195
  parser.on("--output=OUTPUT",
192
196
  "Output to OUTPUT",
193
197
  "(stdout)") do |output|
@@ -228,6 +232,7 @@ module Grntest
228
232
  attr_writer :valgrind_gen_suppressions
229
233
  attr_writer :reporter, :keep_database, :use_color
230
234
  attr_writer :stop_on_failure
235
+ attr_writer :suppress_omit_log
231
236
  attr_reader :test_patterns, :test_suite_patterns
232
237
  attr_reader :exclude_test_patterns, :exclude_test_suite_patterns
233
238
  def initialize
@@ -245,6 +250,7 @@ module Grntest
245
250
  @keep_database = false
246
251
  @use_color = nil
247
252
  @stop_on_failure = false
253
+ @suppress_omit_log = true
248
254
  @test_patterns = []
249
255
  @test_suite_patterns = []
250
256
  @exclude_test_patterns = []
@@ -289,6 +295,10 @@ module Grntest
289
295
  @stop_on_failure
290
296
  end
291
297
 
298
+ def suppress_omit_log?
299
+ @suppress_omit_log
300
+ end
301
+
292
302
  def valgrind_gen_suppressions?
293
303
  @valgrind_gen_suppressions
294
304
  end
@@ -14,5 +14,5 @@
14
14
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
15
 
16
16
  module Grntest
17
- VERSION = "1.1.2"
17
+ VERSION = "1.1.3"
18
18
  end
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2012-2016 Kouhei Sutou <kou@clear-code.com>
4
2
  #
5
3
  # This program is free software: you can redistribute it and/or modify
6
4
  # it under the terms of the GNU General Public License as published by
@@ -148,7 +146,9 @@ module Grntest
148
146
  def on_test_omission(result)
149
147
  @status = "omitted"
150
148
  @result.on_test_omission
151
- @reporter.on_test_omission(self, result)
149
+ unless @tester.suppress_omit_log?
150
+ @reporter.on_test_omission(self, result)
151
+ end
152
152
  end
153
153
 
154
154
  def on_test_no_check(result)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grntest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-08 00:00:00.000000000 Z
12
+ date: 2016-03-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -163,8 +163,11 @@ files:
163
163
  - lib/grntest/executors/standard-io-executor.rb
164
164
  - lib/grntest/log-entry.rb
165
165
  - lib/grntest/log-parser.rb
166
+ - lib/grntest/query-log-entry.rb
167
+ - lib/grntest/query-log-parser.rb
166
168
  - lib/grntest/reporters.rb
167
169
  - lib/grntest/reporters/base-reporter.rb
170
+ - lib/grntest/reporters/buffered-mark-reporter.rb
168
171
  - lib/grntest/reporters/inplace-reporter.rb
169
172
  - lib/grntest/reporters/mark-reporter.rb
170
173
  - lib/grntest/reporters/stream-reporter.rb
@@ -198,14 +201,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
201
  version: '0'
199
202
  requirements: []
200
203
  rubyforge_project:
201
- rubygems_version: 2.2.2
204
+ rubygems_version: 2.5.1
202
205
  signing_key:
203
206
  specification_version: 4
204
207
  summary: Grntest is a testing framework for Groonga. You can write a test for Groonga
205
208
  by writing Groonga commands and expected result.
206
209
  test_files:
207
- - test/test-log-parser.rb
210
+ - test/run-test.rb
208
211
  - test/executors/test-base-executor.rb
209
212
  - test/executors/test-standard-io-executor.rb
210
- - test/run-test.rb
213
+ - test/test-log-parser.rb
211
214
  has_rdoc: