grntest 1.3.6 → 1.4.1

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
  SHA256:
3
- metadata.gz: 4a454a43f204e50c72ce0470713ee3dbcdd7c3b0f210f8fc37eb8c858dc5794f
4
- data.tar.gz: 5f5a5dfdab82eefc86318b7a09e66c97979cb68fed0c498369117c0c98666a6a
3
+ metadata.gz: 8e90468027680b461a1633c49db9f3feb7babd1a0c2e81a4aad381ade35b4fb3
4
+ data.tar.gz: 31b1cc050ea4b70ed08082a0b5443586676aa5d77c0512287736ee1837b4c371
5
5
  SHA512:
6
- metadata.gz: 707db0020a332057b06ce4822edb4fd1cac2226e88f23a642fd071e2bda2457747f54fd22b16198b629badaee7e865753d60d0c713f35c40b1b718f1248a8866
7
- data.tar.gz: 88653342fa0366047c2ecf080cc6d4bbab2f7c43186c9df4173fbeeb7814bf5a9143442ed1df7e4144674a2b0c977b109d0cfa2cf7927c20f489a74fc234370a
6
+ metadata.gz: f8067b106d13ebd121cd96d43eb82b807adb81fe89ea26df1ea4eeb8dfdd6be096e14fdbeeb6ca00528d5704d0d53d6123e28d45973fb5bb283990c59101e090
7
+ data.tar.gz: b8eb794be911a7dc8b7eb74172b4cb109cafe74a945cfc3ca3e626d90a54a36ca61058c91883238b579d4c0a92578a58d46b2aff4a7dbb1c4086059a0109245e
@@ -1,5 +1,43 @@
1
1
  # News
2
2
 
3
+ ## 1.4.1: 2020-05-30
4
+
5
+ ### Improvements
6
+
7
+ * Added support for normalizing IO open/close log message.
8
+
9
+ ## 1.4.0: 2020-05-16
10
+
11
+ ### Improvements
12
+
13
+ * Added support for normalizing mruby's syntax error message.
14
+
15
+ ## 1.3.9: 2020-05-09
16
+
17
+ ### Improvements
18
+
19
+ * Added `progress` reporter.
20
+
21
+ * Suppressed Apache Arrow related reports from Valgrind.
22
+
23
+ * Improved backtrace detection.
24
+
25
+ ## 1.3.8: 2020-04-23
26
+
27
+ ### Improvements
28
+
29
+ * Improved static port detection.
30
+
31
+ * Improved backtrace detection.
32
+
33
+ ## 1.3.7: 2020-03-26
34
+
35
+ ### Improvements
36
+
37
+ * Added `add-ignore-log-pattern` directive.
38
+
39
+ * Added `remove-ignore-log-pattern` directive.
40
+
3
41
  ## 1.3.6: 2020-03-26
4
42
 
5
43
  ### Improvements
@@ -43,6 +43,7 @@ module Grntest
43
43
  @long_read_timeout = default_long_read_timeout
44
44
  @context = context
45
45
  @custom_important_log_levels = []
46
+ @ignore_log_patterns = {}
46
47
  end
47
48
 
48
49
  def execute(script_path)
@@ -347,6 +348,32 @@ module Grntest
347
348
  end
348
349
  end
349
350
 
351
+ def compile_pattern(pattern)
352
+ case pattern
353
+ when /\A\/(.*)\/([ixm]*)?\z/
354
+ content = $1
355
+ options = $2
356
+ regexp_flags = 0
357
+ regexp_flags |= Regexp::IGNORECASE if options.include?("i")
358
+ regexp_flags |= Regexp::EXTENDED if options.include?("x")
359
+ regexp_flags |= Regexp::MULTILINE if options.include?("m")
360
+ Regexp.new(content, regexp_flags)
361
+ else
362
+ log_error("# error: invalid pattern: #{pattern}")
363
+ @context.error
364
+ end
365
+ end
366
+
367
+ def execute_directive_add_ignore_log_pattern(parser, line, content, options)
368
+ pattern = content.split(" ", 2)[1]
369
+ @ignore_log_patterns[pattern] = compile_pattern(pattern)
370
+ end
371
+
372
+ def execute_directive_remove_ignore_log_pattern(parser, line, content, options)
373
+ pattern = content.split(" ", 2)[1]
374
+ @ignore_log_patterns.delete(pattern)
375
+ end
376
+
350
377
  def execute_directive(parser, line, content)
351
378
  command, *options = Shellwords.split(content)
352
379
  case command
@@ -390,6 +417,10 @@ module Grntest
390
417
  execute_directive_require_interface(parser, line, content, options)
391
418
  when "require-apache-arrow"
392
419
  execute_directive_require_apache_arrow(parser, line, content, options)
420
+ when "add-ignore-log-pattern"
421
+ execute_directive_add_ignore_log_pattern(parser, line, content, options)
422
+ when "remove-ignore-log-pattern"
423
+ execute_directive_remove_ignore_log_pattern(parser, line, content, options)
393
424
  else
394
425
  log_input(line)
395
426
  log_error("#|e| unknown directive: <#{command}>")
@@ -503,12 +534,33 @@ module Grntest
503
534
  next if !in_crash and backtrace_log_message?(entry.message)
504
535
  end
505
536
  next if thread_log_message?(entry.message)
506
- formatted_log_level = format_log_level(entry.log_level)
507
- important_messages << "\#|#{formatted_log_level}| #{entry.message}"
537
+ next if ignore_log_message?(entry.message)
538
+ log_level, message = normalize_log(entry)
539
+ formatted_log_level = format_log_level(log_level)
540
+ important_messages << "\#|#{formatted_log_level}| #{message}"
508
541
  end
509
542
  important_messages.join("\n")
510
543
  end
511
544
 
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
+
512
564
  def read_all_readable_content(output, options={})
513
565
  content = ""
514
566
  first_timeout = options[:first_timeout] || @context.read_timeout
@@ -570,7 +622,16 @@ module Grntest
570
622
  true
571
623
  when /\A[a-zA-Z]:[\/\\]/
572
624
  true
573
- when /\Agroonga\(\) \[0x[\da-f]+\]\z/
625
+ when /\A\(unknown\):\d+:\d+: /
626
+ true
627
+ when /\A(?:groonga|groonga-httpd)
628
+ \((?:\+0x\h+|\w+\+0x\h+)?\)
629
+ \s
630
+ \[0x\h+\]\z/x
631
+ # groonga() [0x564caf2bfc12]
632
+ # groonga(+0xbd1aa) [0x564caf2bfc12]
633
+ # groonga-httpd(+0xbd1aa) [0x564caf2bfc12]
634
+ # groonga-httpd(ngx_http_core_run_phases+0x25) [0x564caf2bfc12]
574
635
  true
575
636
  when /\A\d+\s+(?:lib\S+\.dylib|\S+\.so|groonga|nginx|\?\?\?)\s+
576
637
  0x[\da-f]+\s
@@ -592,6 +653,12 @@ module Grntest
592
653
  end
593
654
  end
594
655
 
656
+ def ignore_log_message?(message)
657
+ @ignore_log_patterns.any? do |_pattern, regexp|
658
+ regexp === message
659
+ end
660
+ end
661
+
595
662
  def error_response?(response, type)
596
663
  status = nil
597
664
  begin
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2012-2020 Sutou Kouhei <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
@@ -19,6 +17,7 @@ require "grntest/reporters/mark-reporter"
19
17
  require "grntest/reporters/buffered-mark-reporter"
20
18
  require "grntest/reporters/stream-reporter"
21
19
  require "grntest/reporters/inplace-reporter"
20
+ require "grntest/reporters/progress-reporter"
22
21
 
23
22
  module Grntest
24
23
  module Reporters
@@ -33,6 +32,8 @@ module Grntest
33
32
  StreamReporter.new(tester)
34
33
  when :inplace
35
34
  InplaceReporter.new(tester)
35
+ when :progress
36
+ ProgressReporter.new(tester)
36
37
  end
37
38
  end
38
39
  end
@@ -0,0 +1,37 @@
1
+ # Copyright (C) 2020 Sutou Kouhei <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/inplace-reporter"
17
+
18
+ module Grntest
19
+ module Reporters
20
+ class ProgressReporter < InplaceReporter
21
+ private
22
+ def draw_statistics_header_line
23
+ puts(statistics_header)
24
+ end
25
+
26
+ def draw_status_line(worker)
27
+ end
28
+
29
+ def draw_test_line(worker)
30
+ end
31
+
32
+ def n_worker_lines
33
+ 0
34
+ end
35
+ end
36
+ end
37
+ end
@@ -297,6 +297,30 @@ call (int)chdir("#{context.temporary_directory_path}")
297
297
  match-leak-kinds: reachable
298
298
  ...
299
299
  fun:_dl_catch_error
300
+ }
301
+ {
302
+ _dl_init
303
+ Memcheck:Leak
304
+ match-leak-kinds: reachable
305
+ ...
306
+ fun:_dl_init
307
+ ...
308
+ }
309
+ {
310
+ _Z41__static_initialization_and_destruction_0ii
311
+ Memcheck:Leak
312
+ match-leak-kinds: reachable
313
+ ...
314
+ fun:_Z41__static_initialization_and_destruction_0ii
315
+ ...
316
+ }
317
+ {
318
+ je_arrow_private_je_background_thread_create
319
+ Memcheck:Leak
320
+ match-leak-kinds: possible
321
+ ...
322
+ fun:je_arrow_private_je_background_thread_create
323
+ ...
300
324
  }
301
325
  SUPPRESSIONS
302
326
  end
@@ -344,10 +368,10 @@ call (int)chdir("#{context.temporary_directory_path}")
344
368
  static_port = 50041 + @worker.id
345
369
  10.times do
346
370
  begin
347
- TCPSocket.new(host, static_port)
371
+ TCPServer.open(host, static_port) do |server|
372
+ return static_port
373
+ end
348
374
  rescue SystemCallError
349
- return static_port
350
- else
351
375
  sleep(0.1)
352
376
  end
353
377
  end
@@ -787,6 +811,8 @@ http {
787
811
  pre = $1
788
812
  _path = $2
789
813
  "#{pre}<PATH>"
814
+ when /\A(line \d+:\d+: syntax error), unexpected .*\z/
815
+ $1
790
816
  else
791
817
  content
792
818
  end
@@ -137,7 +137,13 @@ module Grntest
137
137
  diff_option_is_specified = true
138
138
  end
139
139
 
140
- available_reporters = [:mark, :"buffered-mark", :stream, :inplace]
140
+ available_reporters = [
141
+ :mark,
142
+ :"buffered-mark",
143
+ :stream,
144
+ :inplace,
145
+ :progress,
146
+ ]
141
147
  available_reporter_labels = available_reporters.join(", ")
142
148
  parser.on("--reporter=REPORTER", available_reporters,
143
149
  "Report test result by REPORTER",
@@ -371,7 +377,7 @@ module Grntest
371
377
  if @n_workers == 1
372
378
  :mark
373
379
  else
374
- :inplace
380
+ :progress
375
381
  end
376
382
  else
377
383
  @reporter
@@ -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.3.6"
17
+ VERSION = "1.4.1"
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.3.6
4
+ version: 1.4.1
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-03-25 00:00:00.000000000 Z
12
+ date: 2020-05-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: diff-lcs
@@ -238,6 +238,7 @@ files:
238
238
  - lib/grntest/reporters/buffered-mark-reporter.rb
239
239
  - lib/grntest/reporters/inplace-reporter.rb
240
240
  - lib/grntest/reporters/mark-reporter.rb
241
+ - lib/grntest/reporters/progress-reporter.rb
241
242
  - lib/grntest/reporters/stream-reporter.rb
242
243
  - lib/grntest/response-parser.rb
243
244
  - lib/grntest/template-evaluator.rb