grntest 1.2.9 → 1.3.0

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: 918e4ad9c8dff964b3ed84306ab5b8c732f7e955
4
- data.tar.gz: badb1c9d6184a8b06bdcf5a31ea0b3a522af6d8b
3
+ metadata.gz: c55e0bf4a89cc29c33e5081c6380c2652844e33a
4
+ data.tar.gz: 0d469e06c4bdb6b18761d40342d0d6d436f4d6fb
5
5
  SHA512:
6
- metadata.gz: 5efc50e1de933eaa6f5ca269557671aeb74b53c3cad944a658da036bb2efb8228c8b43e768945a8fbc01595d881271de627980876943cd6fb1a6534624a061b2
7
- data.tar.gz: 5a77064a41d9990c0acfe3bb89e90a000989fd9765411713a4efa9b2eb2066dc9fd7fa39080490ea771c4a313e6ad09d2e32ad6243c8fb93bda402f1349a37f5
6
+ metadata.gz: 95563f90d0b1d93ec3568d5996a4c43a9d3617db4ead96f843b2b13f1009702c974511caee8d1638a26b90cd1fb3dc51625e39c97903d4e7120983bc8fc13f2f
7
+ data.tar.gz: aee7784eac1c012ee42ea39faba590f74044abbee1dee52ecf21d42008bdc38f3d698ce56eeb144d80ffebb7b62680f8288c2a4365277456483a434be2bf8458
data/doc/text/news.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # News
2
2
 
3
+ ## 1.3.0: 2018-11-16
4
+
5
+ ### Improvements
6
+
7
+ * Improved to force logging backtrace on crash.
8
+
9
+ * Added `--n-retries` option.
10
+
11
+ ### Fixes
12
+
13
+ * Fixed encoding error on error report.
14
+
3
15
  ## 1.2.9: 2018-01-18
4
16
 
5
17
  ### Improvements
@@ -58,11 +58,11 @@ module Grntest
58
58
  parser << line
59
59
  rescue Error, Groonga::Command::Parser::Error
60
60
  line_info = "#{script_path}:#{script_file.lineno}:#{line.chomp}"
61
- log_error("#{line_info}: #{$!.message}")
61
+ log_error("#{line_info}: #{$!.message.b}")
62
62
  if $!.is_a?(Groonga::Command::Parser::Error)
63
63
  @context.abort
64
64
  else
65
- log_error("#{line_info}: #{$!.message}")
65
+ log_error("#{line_info}: #{$!.message.b}")
66
66
  raise unless @context.top_level?
67
67
  end
68
68
  end
@@ -426,10 +426,20 @@ module Grntest
426
426
  def extract_important_messages(log)
427
427
  important_messages = []
428
428
  parser = LogParser.new
429
+ in_crash = false
429
430
  parser.parse(log) do |entry|
431
+ if entry.log_level == "C"
432
+ case entry.message
433
+ when "-- CRASHED!!! --"
434
+ in_crash = true
435
+ when "----------------"
436
+ in_crash = false
437
+ end
438
+ end
439
+
430
440
  next unless important_log_level?(entry.log_level)
431
441
  if @context.suppress_backtrace?
432
- next if backtrace_log_message?(entry.message)
442
+ next if !in_crash and backtrace_log_message?(entry.message)
433
443
  end
434
444
  next if thread_log_message?(entry.message)
435
445
  important_messages << "\#|#{entry.log_level}| #{entry.message}"
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2016 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2012-2018 Kouhei Sutou <kou@clear-code.com>
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License as published by
@@ -230,6 +230,12 @@ module Grntest
230
230
  tester.debug = debug
231
231
  end
232
232
 
233
+ parser.on("--n-retries=N", Integer,
234
+ "Retry N times on failure",
235
+ "(#{tester.n_retries})") do |n|
236
+ tester.n_retries = n
237
+ end
238
+
233
239
  parser.on("--version",
234
240
  "Show version and exit") do
235
241
  puts(VERSION)
@@ -281,6 +287,7 @@ module Grntest
281
287
  attr_writer :debug
282
288
  attr_reader :test_patterns, :test_suite_patterns
283
289
  attr_reader :exclude_test_patterns, :exclude_test_suite_patterns
290
+ attr_accessor :n_retries
284
291
  def initialize
285
292
  @groonga = "groonga"
286
293
  @groonga_httpd = "groonga-httpd"
@@ -311,6 +318,7 @@ module Grntest
311
318
  initialize_memory_checkers
312
319
  @timeout = 5
313
320
  @read_timeout = 3
321
+ @n_retries = 0
314
322
  end
315
323
 
316
324
  def run(*targets)
@@ -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.2.9"
17
+ VERSION = "1.3.0"
18
18
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2016 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2012-2018 Kouhei Sutou <kou@clear-code.com>
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License as published by
@@ -99,12 +99,13 @@ module Grntest
99
99
  @suite_name = suite_name
100
100
  @reporter.on_suite_start(self)
101
101
  end
102
- @test_script_path = test_script_path
103
- @test_name = test_name
104
- runner = TestRunner.new(@tester, self)
105
- succeeded = false unless runner.run
102
+
103
+ unless run_test(test_script_path, test_name)
104
+ succeeded = false
105
+ end
106
106
 
107
107
  break if interruptted?
108
+
108
109
  if @tester.stop_on_failure? and @test_suites_result.have_failure?
109
110
  break
110
111
  end
@@ -162,8 +163,32 @@ module Grntest
162
163
  def on_test_finish(result)
163
164
  @result.on_test_finish
164
165
  @reporter.on_test_finish(self, result)
165
- @test_script_path = nil
166
- @test_name = nil
166
+ end
167
+
168
+ private
169
+ def run_test(test_script_path, test_name)
170
+ begin
171
+ @test_script_path = test_script_path
172
+ @test_name = test_name
173
+
174
+ n = -1
175
+ loop do
176
+ n += 1
177
+
178
+ runner = TestRunner.new(@tester, self)
179
+ return true if runner.run
180
+
181
+ if n < @tester.n_retries and not interruptted?
182
+ @test_suites_result.n_total_tests += 1
183
+ next
184
+ end
185
+
186
+ return false
187
+ end
188
+ ensure
189
+ @test_script_path = nil
190
+ @test_name = nil
191
+ end
167
192
  end
168
193
  end
169
194
  end
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.2.9
4
+ version: 1.3.0
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: 2018-01-18 00:00:00.000000000 Z
12
+ date: 2018-11-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -219,13 +219,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
219
  version: '0'
220
220
  requirements: []
221
221
  rubyforge_project:
222
- rubygems_version: 2.5.2.2
222
+ rubygems_version: 2.5.2.1
223
223
  signing_key:
224
224
  specification_version: 4
225
225
  summary: Grntest is a testing framework for Groonga. You can write a test for Groonga
226
226
  by writing Groonga commands and expected result.
227
227
  test_files:
228
- - test/run-test.rb
229
228
  - test/executors/test-base-executor.rb
230
229
  - test/executors/test-standard-io-executor.rb
230
+ - test/run-test.rb
231
231
  - test/test-log-parser.rb