grntest 1.4.1 → 1.4.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
  SHA256:
3
- metadata.gz: 8e90468027680b461a1633c49db9f3feb7babd1a0c2e81a4aad381ade35b4fb3
4
- data.tar.gz: 31b1cc050ea4b70ed08082a0b5443586676aa5d77c0512287736ee1837b4c371
3
+ metadata.gz: 88fbad2fdde680dc3110737087f9818240bd130ea4c61c14478d89577dd99420
4
+ data.tar.gz: e98f331062e055f4fd914ef1916dc4859614e1ef0c9f3a16c978d00d73d05a23
5
5
  SHA512:
6
- metadata.gz: f8067b106d13ebd121cd96d43eb82b807adb81fe89ea26df1ea4eeb8dfdd6be096e14fdbeeb6ca00528d5704d0d53d6123e28d45973fb5bb283990c59101e090
7
- data.tar.gz: b8eb794be911a7dc8b7eb74172b4cb109cafe74a945cfc3ca3e626d90a54a36ca61058c91883238b579d4c0a92578a58d46b2aff4a7dbb1c4086059a0109245e
6
+ metadata.gz: 4e51b3927eb61e1232ade4c179a140eddd68d41d5231f4bee0e7b356cce389d8b72c110f5217418d9e214fa071486bd3ffe55e61e2e9def19b90b425e193e2ca
7
+ data.tar.gz: bd7a5ad8f297572b51f797f359ae2c42d9a01a013d6c48c6d3e168d648bf32af405ec0f8af36f1e0fef84a86756ccb2b918988a35696ed3af505e50dd23350bc
@@ -1,5 +1,40 @@
1
1
  # News
2
2
 
3
+ ## 1.4.6: 2020-12-08
4
+
5
+ ### Improvements
6
+
7
+ * Added `require-feature` directive.
8
+
9
+ ## 1.4.5: 2020-11-11
10
+
11
+ ### Improvements
12
+
13
+ * Added `sleep-after-command` directive.
14
+
15
+ ## 1.4.4: 2020-07-18
16
+
17
+ ### Improvements
18
+
19
+ * Added support for detecting backtrace log for MinGW build.
20
+
21
+ ## 1.4.3: 2020-05-31
22
+
23
+ ### Improvements
24
+
25
+ * Removed log normalization.
26
+
27
+ ## 1.4.2: 2020-05-30
28
+
29
+ ### Improvements
30
+
31
+ * Removed log level normalization.
32
+
33
+ * Added `require-platform` directive.
34
+
35
+ * Added support for normalizing IO open/close log message with
36
+ additional message.
37
+
3
38
  ## 1.4.1: 2020-05-30
4
39
 
5
40
  ### Improvements
@@ -37,6 +37,7 @@ module Grntest
37
37
  attr_writer :suppress_backtrace
38
38
  attr_writer :collect_query_log
39
39
  attr_writer :debug
40
+ attr_accessor :platform
40
41
  def initialize
41
42
  @logging = true
42
43
  @base_directory = Pathname(".")
@@ -66,6 +67,7 @@ module Grntest
66
67
  @suppress_backtrace = true
67
68
  @collect_query_log = false
68
69
  @debug = false
70
+ @platform = guess_platform
69
71
  end
70
72
 
71
73
  def logging?
@@ -173,5 +175,18 @@ module Grntest
173
175
  "so"
174
176
  end
175
177
  end
178
+
179
+ def guess_platform
180
+ case RUBY_PLATFORM
181
+ when /mingw|mswin/
182
+ "windows"
183
+ when /darwin/
184
+ "macos"
185
+ when /linux/
186
+ "linux"
187
+ else
188
+ "unknown"
189
+ end
190
+ end
176
191
  end
177
192
  end
@@ -44,6 +44,9 @@ module Grntest
44
44
  @context = context
45
45
  @custom_important_log_levels = []
46
46
  @ignore_log_patterns = {}
47
+ @sleep_after_command = nil
48
+ @status_response = nil
49
+ @features = nil
47
50
  end
48
51
 
49
52
  def execute(script_path)
@@ -321,28 +324,28 @@ module Grntest
321
324
  parser << "#{expand_variables(groonga_command)}\n"
322
325
  end
323
326
 
324
- def execute_directive_require_input_type(parser, line, content, options)
327
+ def execute_directive_require_input_type(line, content, options)
325
328
  input_type, = options
326
329
  unless @context.input_type == input_type
327
330
  omit("require input type: #{input_type}")
328
331
  end
329
332
  end
330
333
 
331
- def execute_directive_require_testee(parser, line, content, options)
334
+ def execute_directive_require_testee(line, content, options)
332
335
  testee, = options
333
336
  unless @context.testee == testee
334
337
  omit("require testee: #{testee}")
335
338
  end
336
339
  end
337
340
 
338
- def execute_directive_require_interface(parser, line, content, options)
341
+ def execute_directive_require_interface(line, content, options)
339
342
  interface, = options
340
343
  unless @context.interface == interface
341
344
  omit("require interface: #{interface}")
342
345
  end
343
346
  end
344
347
 
345
- def execute_directive_require_apache_arrow(parser, line, content, options)
348
+ def execute_directive_require_apache_arrow(line, content, options)
346
349
  unless defined?(::Arrow)
347
350
  omit("require Apache Arrow")
348
351
  end
@@ -364,16 +367,65 @@ module Grntest
364
367
  end
365
368
  end
366
369
 
367
- def execute_directive_add_ignore_log_pattern(parser, line, content, options)
370
+ def execute_directive_add_ignore_log_pattern(line, content, options)
368
371
  pattern = content.split(" ", 2)[1]
369
372
  @ignore_log_patterns[pattern] = compile_pattern(pattern)
370
373
  end
371
374
 
372
- def execute_directive_remove_ignore_log_pattern(parser, line, content, options)
375
+ def execute_directive_remove_ignore_log_pattern(line, content, options)
373
376
  pattern = content.split(" ", 2)[1]
374
377
  @ignore_log_patterns.delete(pattern)
375
378
  end
376
379
 
380
+ def execute_directive_require_platform(line, content, options)
381
+ platform, = options
382
+ if platform.start_with?("!")
383
+ if @context.platform == platform[1..-1]
384
+ omit("require platform: #{platform} (#{@context.platform})")
385
+ end
386
+ else
387
+ if @context.platform != platform
388
+ omit("require platform: #{platform} (#{@context.platform})")
389
+ end
390
+ end
391
+ end
392
+
393
+ def execute_directive_sleep_after_command(line, content, options)
394
+ if options[0]
395
+ time = options[0].to_f
396
+ else
397
+ time = nil
398
+ end
399
+ @sleep_after_command = time
400
+ end
401
+
402
+ def features
403
+ return @features if @features
404
+ @features = []
405
+ JSON.parse(@status_response)[1]["features"].each do |name, available|
406
+ @features << name if available
407
+ end
408
+ @features.sort!
409
+ @features
410
+ end
411
+
412
+ def formatted_features
413
+ features.join(", ")
414
+ end
415
+
416
+ def execute_directive_require_feature(line, content, options)
417
+ feature, = options
418
+ if feature.start_with?("!")
419
+ if features.include?(feature[1..-1])
420
+ omit("require feature: #{feature} (#{formatted_features})")
421
+ end
422
+ else
423
+ unless features.include?(feature)
424
+ omit("require feature: #{feature} (#{formatted_features})")
425
+ end
426
+ end
427
+ end
428
+
377
429
  def execute_directive(parser, line, content)
378
430
  command, *options = Shellwords.split(content)
379
431
  case command
@@ -410,17 +462,23 @@ module Grntest
410
462
  when "eval"
411
463
  execute_directive_eval(parser, line, content, options)
412
464
  when "require-input-type"
413
- execute_directive_require_input_type(parser, line, content, options)
465
+ execute_directive_require_input_type(line, content, options)
414
466
  when "require-testee"
415
- execute_directive_require_testee(parser, line, content, options)
467
+ execute_directive_require_testee(line, content, options)
416
468
  when "require-interface"
417
- execute_directive_require_interface(parser, line, content, options)
469
+ execute_directive_require_interface(line, content, options)
418
470
  when "require-apache-arrow"
419
- execute_directive_require_apache_arrow(parser, line, content, options)
471
+ execute_directive_require_apache_arrow(line, content, options)
420
472
  when "add-ignore-log-pattern"
421
- execute_directive_add_ignore_log_pattern(parser, line, content, options)
473
+ execute_directive_add_ignore_log_pattern(line, content, options)
422
474
  when "remove-ignore-log-pattern"
423
- execute_directive_remove_ignore_log_pattern(parser, line, content, options)
475
+ execute_directive_remove_ignore_log_pattern(line, content, options)
476
+ when "require-platform"
477
+ execute_directive_require_platform(line, content, options)
478
+ when "sleep-after-command"
479
+ execute_directive_sleep_after_command(line, content, options)
480
+ when "require-feature"
481
+ execute_directive_require_feature(line, content, options)
424
482
  else
425
483
  log_input(line)
426
484
  log_error("#|e| unknown directive: <#{command}>")
@@ -486,6 +544,7 @@ module Grntest
486
544
  else
487
545
  type = @output_type
488
546
  log_output(response)
547
+ sleep(@sleep_after_command) if @sleep_after_command
489
548
  log_error(extract_important_messages(read_all_log))
490
549
  log_query_log_content(read_all_query_log)
491
550
 
@@ -535,32 +594,14 @@ module Grntest
535
594
  end
536
595
  next if thread_log_message?(entry.message)
537
596
  next if ignore_log_message?(entry.message)
538
- log_level, message = normalize_log(entry)
597
+ log_level = entry.log_level
539
598
  formatted_log_level = format_log_level(log_level)
599
+ message = entry.message
540
600
  important_messages << "\#|#{formatted_log_level}| #{message}"
541
601
  end
542
602
  important_messages.join("\n")
543
603
  end
544
604
 
545
- def normalize_log(entry)
546
- case entry.message
547
- when /\A(\[io\]\[(?:open|close)\]) <(.*?)>\z/
548
- tag = $1
549
- path = $2
550
- normalized_path = File.basename(path)
551
- normalized_message = "#{tag} <#{normalized_path}>"
552
- case entry.log_level
553
- when :info, :debug
554
- normalized_log_level = :debug
555
- else
556
- normalized_log_level = entry.log_level
557
- end
558
- [normalized_log_level, normalized_message]
559
- else
560
- [entry.log_level, entry.message]
561
- end
562
- end
563
-
564
605
  def read_all_readable_content(output, options={})
565
606
  content = ""
566
607
  first_timeout = options[:first_timeout] || @context.read_timeout
@@ -624,6 +665,8 @@ module Grntest
624
665
  true
625
666
  when /\A\(unknown\):\d+:\d+: /
626
667
  true
668
+ when /\A[\w.\\-]+:\d+:\d+: /
669
+ true
627
670
  when /\A(?:groonga|groonga-httpd)
628
671
  \((?:\+0x\h+|\w+\+0x\h+)?\)
629
672
  \s
@@ -61,7 +61,7 @@ module Grntest
61
61
  def ensure_groonga_ready
62
62
  n_retried = 0
63
63
  begin
64
- send_command(command("status"))
64
+ @status_response = send_command(command("status"))
65
65
  rescue Error
66
66
  n_retried += 1
67
67
  sleep(0.1)
@@ -44,7 +44,7 @@ module Grntest
44
44
  def ensure_groonga_ready
45
45
  @input.print("status\n")
46
46
  @input.flush
47
- @output.gets
47
+ @status_response = @output.gets
48
48
  end
49
49
 
50
50
  def create_sub_executor(context)
@@ -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.4.1"
17
+ VERSION = "1.4.6"
18
18
  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.4.1
4
+ version: 1.4.6
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: 2020-05-30 00:00:00.000000000 Z
12
+ date: 2020-12-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: diff-lcs
@@ -270,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
270
  - !ruby/object:Gem::Version
271
271
  version: '0'
272
272
  requirements: []
273
- rubygems_version: 3.2.0.pre1
273
+ rubygems_version: 3.2.0.rc.2
274
274
  signing_key:
275
275
  specification_version: 4
276
276
  summary: Grntest is a testing framework for Groonga. You can write a test for Groonga