grntest 1.4.2 → 1.4.7

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: 72bf123c2803dad061e343733c748d2c66ce4fb649e146cf089707b28bc24eb7
4
- data.tar.gz: 808f8b5ede307bab1f5e3e933944e487113b8f22272fe6226d3411986e9a2eac
3
+ metadata.gz: 79fb44c3eebc5c70ba4d7a0c6821d653d77b6bb7c20791a86cd973bbf90fa970
4
+ data.tar.gz: 95ed0edd5d3f25e2f9d450edda7f0f58ad16354ab66c8163d9cfdc353610db6c
5
5
  SHA512:
6
- metadata.gz: e39d5e003dd5ad5d48aa71b64b306c882413a27d873fb95c130cc00b5c4538271363f3a04cb44cfdd535a591c1c98479cc41a2558d5a0c7854bbb3793b6ce9b0
7
- data.tar.gz: c39924d196aa19cbdf0db12a7660ac6ed7b545e78b6c6852261b9f178b4acc899ba3c8f9ee875042f2700849a2ef3b3db915d72805f5a47552d6c8d358e593c7
6
+ metadata.gz: bdfaf0c54e4dd784827fbb3f2ff34acfe1dce69ef168260ede87f6d570dd190490199aec105fc2a1357c6cd46a1b4da80c993373402044d0655dac821680921e
7
+ data.tar.gz: 583b24ab3901660faa706728df925c592dfaf8746df548f4bfee78a710b1bf10951bad1087b3df951ca8d8e8baecd5a00852b2cebd2eccd5fbf0f22f962e1332
@@ -1,5 +1,36 @@
1
1
  # News
2
2
 
3
+ ## 1.4.7: 2020-12-08
4
+
5
+ ### Improvements
6
+
7
+ * `require-apache-arrow`: Added support for version check of Apache
8
+ Arrow in Groonga.
9
+
10
+ ## 1.4.6: 2020-12-08
11
+
12
+ ### Improvements
13
+
14
+ * Added `require-feature` directive.
15
+
16
+ ## 1.4.5: 2020-11-11
17
+
18
+ ### Improvements
19
+
20
+ * Added `sleep-after-command` directive.
21
+
22
+ ## 1.4.4: 2020-07-18
23
+
24
+ ### Improvements
25
+
26
+ * Added support for detecting backtrace log for MinGW build.
27
+
28
+ ## 1.4.3: 2020-05-31
29
+
30
+ ### Improvements
31
+
32
+ * Removed log normalization.
33
+
3
34
  ## 1.4.2: 2020-05-30
4
35
 
5
36
  ### Improvements
@@ -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
+ @raw_status_response = nil
49
+ @features = nil
47
50
  end
48
51
 
49
52
  def execute(script_path)
@@ -321,30 +324,48 @@ 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 status_response
349
+ @status_response ||= JSON.parse(@raw_status_response)[1]
350
+ end
351
+
352
+ def apache_arrow_version
353
+ (status_response["apache_arrow"] || {})["version"]
354
+ end
355
+
356
+ def execute_directive_require_apache_arrow(line, content, options)
357
+ version, = options
358
+ _apache_arrow_version = apache_arrow_version
359
+ if _apache_arrow_version.nil?
360
+ omit("require Apache Arrow support in Groonga")
361
+ end
346
362
  unless defined?(::Arrow)
347
- omit("require Apache Arrow")
363
+ omit("require Red Arrow in grntest")
364
+ end
365
+ return if version.nil?
366
+ if Gem::Version.new(version) < Gem::Version.new(_apache_arrow_version)
367
+ omit("require Apache Arrow #{version} in Groonga: " +
368
+ _apache_arrow_version)
348
369
  end
349
370
  end
350
371
 
@@ -364,17 +385,17 @@ module Grntest
364
385
  end
365
386
  end
366
387
 
367
- def execute_directive_add_ignore_log_pattern(parser, line, content, options)
388
+ def execute_directive_add_ignore_log_pattern(line, content, options)
368
389
  pattern = content.split(" ", 2)[1]
369
390
  @ignore_log_patterns[pattern] = compile_pattern(pattern)
370
391
  end
371
392
 
372
- def execute_directive_remove_ignore_log_pattern(parser, line, content, options)
393
+ def execute_directive_remove_ignore_log_pattern(line, content, options)
373
394
  pattern = content.split(" ", 2)[1]
374
395
  @ignore_log_patterns.delete(pattern)
375
396
  end
376
397
 
377
- def execute_directive_require_platform(parser, line, content, options)
398
+ def execute_directive_require_platform(line, content, options)
378
399
  platform, = options
379
400
  if platform.start_with?("!")
380
401
  if @context.platform == platform[1..-1]
@@ -387,6 +408,42 @@ module Grntest
387
408
  end
388
409
  end
389
410
 
411
+ def execute_directive_sleep_after_command(line, content, options)
412
+ if options[0]
413
+ time = options[0].to_f
414
+ else
415
+ time = nil
416
+ end
417
+ @sleep_after_command = time
418
+ end
419
+
420
+ def features
421
+ return @features if @features
422
+ @features = []
423
+ status_response["features"].each do |name, available|
424
+ @features << name if available
425
+ end
426
+ @features.sort!
427
+ @features
428
+ end
429
+
430
+ def formatted_features
431
+ features.join(", ")
432
+ end
433
+
434
+ def execute_directive_require_feature(line, content, options)
435
+ feature, = options
436
+ if feature.start_with?("!")
437
+ if features.include?(feature[1..-1])
438
+ omit("require feature: #{feature} (#{formatted_features})")
439
+ end
440
+ else
441
+ unless features.include?(feature)
442
+ omit("require feature: #{feature} (#{formatted_features})")
443
+ end
444
+ end
445
+ end
446
+
390
447
  def execute_directive(parser, line, content)
391
448
  command, *options = Shellwords.split(content)
392
449
  case command
@@ -423,19 +480,23 @@ module Grntest
423
480
  when "eval"
424
481
  execute_directive_eval(parser, line, content, options)
425
482
  when "require-input-type"
426
- execute_directive_require_input_type(parser, line, content, options)
483
+ execute_directive_require_input_type(line, content, options)
427
484
  when "require-testee"
428
- execute_directive_require_testee(parser, line, content, options)
485
+ execute_directive_require_testee(line, content, options)
429
486
  when "require-interface"
430
- execute_directive_require_interface(parser, line, content, options)
487
+ execute_directive_require_interface(line, content, options)
431
488
  when "require-apache-arrow"
432
- execute_directive_require_apache_arrow(parser, line, content, options)
489
+ execute_directive_require_apache_arrow(line, content, options)
433
490
  when "add-ignore-log-pattern"
434
- execute_directive_add_ignore_log_pattern(parser, line, content, options)
491
+ execute_directive_add_ignore_log_pattern(line, content, options)
435
492
  when "remove-ignore-log-pattern"
436
- execute_directive_remove_ignore_log_pattern(parser, line, content, options)
493
+ execute_directive_remove_ignore_log_pattern(line, content, options)
437
494
  when "require-platform"
438
- execute_directive_require_platform(parser, line, content, options)
495
+ execute_directive_require_platform(line, content, options)
496
+ when "sleep-after-command"
497
+ execute_directive_sleep_after_command(line, content, options)
498
+ when "require-feature"
499
+ execute_directive_require_feature(line, content, options)
439
500
  else
440
501
  log_input(line)
441
502
  log_error("#|e| unknown directive: <#{command}>")
@@ -501,6 +562,7 @@ module Grntest
501
562
  else
502
563
  type = @output_type
503
564
  log_output(response)
565
+ sleep(@sleep_after_command) if @sleep_after_command
504
566
  log_error(extract_important_messages(read_all_log))
505
567
  log_query_log_content(read_all_query_log)
506
568
 
@@ -550,33 +612,14 @@ module Grntest
550
612
  end
551
613
  next if thread_log_message?(entry.message)
552
614
  next if ignore_log_message?(entry.message)
553
- log_level, message = normalize_log(entry)
615
+ log_level = entry.log_level
554
616
  formatted_log_level = format_log_level(log_level)
617
+ message = entry.message
555
618
  important_messages << "\#|#{formatted_log_level}| #{message}"
556
619
  end
557
620
  important_messages.join("\n")
558
621
  end
559
622
 
560
- def normalize_log(entry)
561
- case entry.message
562
- when /\A(\[io\]\[(?:open|close)\]) (.*?)<(.*?)>\z/
563
- tag = $1
564
- io_message = $2
565
- path = $3
566
- normalized_path = File.basename(path)
567
- normalized_message = "#{tag} #{io_message}<#{normalized_path}>"
568
- case entry.log_level
569
- when :information, :debug
570
- normalized_log_level = :dump
571
- else
572
- normalized_log_level = entry.log_level
573
- end
574
- [normalized_log_level, normalized_message]
575
- else
576
- [entry.log_level, entry.message]
577
- end
578
- end
579
-
580
623
  def read_all_readable_content(output, options={})
581
624
  content = ""
582
625
  first_timeout = options[:first_timeout] || @context.read_timeout
@@ -640,6 +683,8 @@ module Grntest
640
683
  true
641
684
  when /\A\(unknown\):\d+:\d+: /
642
685
  true
686
+ when /\A[\w.\\-]+:\d+:\d+: /
687
+ true
643
688
  when /\A(?:groonga|groonga-httpd)
644
689
  \((?:\+0x\h+|\w+\+0x\h+)?\)
645
690
  \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
+ @raw_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
+ @raw_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.2"
17
+ VERSION = "1.4.7"
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.2
4
+ version: 1.4.7
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