grntest 1.5.5 → 1.5.7

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: e8a09deb6171d6819a7874a580276f5b972859e5d57e5d746759bfbeb54b501b
4
- data.tar.gz: 60da288a453817a64a157f3ed82d84745dae567e5a3cea418d2a6d46d930313a
3
+ metadata.gz: 29784781308745fb8cbb626e33012d1dfb25dfdbe7196c53079b57327478a4d2
4
+ data.tar.gz: 970b7ea3558d9ad1febbdfa4b375f849b0dd10bb81c65b6651b6e210a91e6431
5
5
  SHA512:
6
- metadata.gz: 748cca0d65ac9073708bd5d9c483f8d14e0f592f9ce3e6ef82874af58597e3703e7ee3b328caf2824eea916151cf8b09785a1583d6203ff3bf5f99f7b915dcd5
7
- data.tar.gz: debc154f725645857bf626b5b4fb088e8483171473ba0a921bbd3eb458a21fa38a778613c7ca89d5b4634d353329a76893a2cd394ac99b55bbaa0f97575e4efb
6
+ metadata.gz: 9752d6bcb935119c458d2911a7643620a6b3c5b4b9a2a8af772a5d8942e3a94fef6a51370772a317bbeaa47b202e35b3e47a5ed66e6b33c0e9870249e4ac3d8d
7
+ data.tar.gz: 35d70626990bead81c6eccb5a15b21c4a00279484635f131d231e0d5f2242cf48ac220a4d72e9d61addce35d0e07c20073a2a0e3f6df08cdc48adfce351863f2
data/doc/text/news.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # News
2
2
 
3
+ ## 1.5.7: 2023-03-08
4
+
5
+ ### Improvements
6
+
7
+ * Added support for `rr`.
8
+
9
+ * Improved backtrace normalization on macOS.
10
+
11
+ * Added `add-substitution` and `remove-substitution` to unify common
12
+ tests for `NormalizerNFKC*`.
13
+
14
+ ## 1.5.6: 2022-03-16
15
+
16
+ ### Improvements
17
+
18
+ * Added `groonga-synomym` to required dependencies.
19
+
3
20
  ## 1.5.5: 2022-01-18
4
21
 
5
22
  ### Improvements
data/grntest.gemspec CHANGED
@@ -48,6 +48,7 @@ Gem::Specification.new do |spec|
48
48
  spec.add_runtime_dependency("groonga-command-parser")
49
49
  spec.add_runtime_dependency("groonga-log")
50
50
  spec.add_runtime_dependency("groonga-query-log", ">= 1.4.1")
51
+ spec.add_runtime_dependency("groonga-synonym")
51
52
  spec.add_runtime_dependency("json")
52
53
  spec.add_runtime_dependency("msgpack")
53
54
  spec.add_runtime_dependency("rexml")
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2021 Sutou Kouhei <kou@clear-code.com>
1
+ # Copyright (C) 2012-2023 Sutou Kouhei <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
@@ -47,6 +47,7 @@ module Grntest
47
47
  @sleep_after_command = nil
48
48
  @raw_status_response = nil
49
49
  @features = nil
50
+ @substitutions = {}
50
51
  end
51
52
 
52
53
  def execute(script_path)
@@ -59,6 +60,7 @@ module Grntest
59
60
  parser = create_parser
60
61
  script_file.each_line do |line|
61
62
  begin
63
+ line = substitute_input(line)
62
64
  parser << line
63
65
  rescue Error, Groonga::Command::Parser::Error
64
66
  line_info = "#{script_path}:#{script_file.lineno}:#{line.chomp}"
@@ -319,7 +321,7 @@ module Grntest
319
321
  record << ","
320
322
  end
321
323
  record << "\n"
322
- record << evaluator.evaluate(i).to_json
324
+ record << evaluator.evaluate(i: i).to_json
323
325
  before = Time.now
324
326
  parser << record
325
327
  elapsed = Time.now - before
@@ -479,6 +481,45 @@ module Grntest
479
481
  end
480
482
  end
481
483
 
484
+ def substitute_input(input)
485
+ return input if @substitutions.empty?
486
+ @substitutions.each_value do |pattern, substituted_evaluator, _|
487
+ input = input.gsub(pattern) do
488
+ substituted_evaluator.evaluate(match_data: Regexp.last_match)
489
+ end
490
+ end
491
+ input
492
+ end
493
+
494
+ def normalize_input(input)
495
+ return input if @substitutions.empty?
496
+ @substitutions.each_value do |pattern, _, normalized_evaluator|
497
+ input = input.gsub(pattern) do
498
+ normalized_evaluator.evaluate(match_data: Regexp.last_match)
499
+ end
500
+ end
501
+ input
502
+ end
503
+
504
+ def execute_directive_add_substitution(line, content, options)
505
+ _, pattern, rest = content.split(" ", 3)
506
+ substituted, normalized = Shellwords.shellsplit(rest)
507
+ substituted.force_encoding("UTF-8")
508
+ normalized.force_encoding("UTF-8")
509
+ substituted_evaluator = TemplateEvaluator.new("\"#{substituted}\"")
510
+ normalized_evaluator = TemplateEvaluator.new("\"#{normalized}\"")
511
+ @substitutions[pattern] = [
512
+ compile_pattern(pattern),
513
+ substituted_evaluator,
514
+ normalized_evaluator,
515
+ ]
516
+ end
517
+
518
+ def execute_directive_remove_substitution(line, content, options)
519
+ pattern = content.split(" ", 2)[1]
520
+ @substitutions.delete(pattern)
521
+ end
522
+
482
523
  def execute_directive(parser, line, content)
483
524
  command, *options = Shellwords.split(content)
484
525
  case command
@@ -534,6 +575,10 @@ module Grntest
534
575
  execute_directive_require_feature(line, content, options)
535
576
  when "synonym-generate"
536
577
  execute_directive_synonym_generate(parser, line, content, options)
578
+ when "add-substitution"
579
+ execute_directive_add_substitution(line, content, options)
580
+ when "remove-substitution"
581
+ execute_directive_remove_substitution(line, content, options)
537
582
  else
538
583
  log_input(line)
539
584
  log_error("#|e| unknown directive: <#{command}>")
@@ -731,7 +776,7 @@ module Grntest
731
776
  # groonga-httpd(+0xbd1aa) [0x564caf2bfc12]
732
777
  # groonga-httpd(ngx_http_core_run_phases+0x25) [0x564caf2bfc12]
733
778
  true
734
- when /\A\d+\s+(?:lib\S+\.dylib|\S+\.so|groonga|nginx|\?\?\?)\s+
779
+ when /\A\d+\s+(?:lib\S+\.dylib|\S+\.so|groonga|nginx|\?\?\?|dyld)\s+
735
780
  0x[\da-f]+\s
736
781
  \S+\s\+\s\d+\z/x
737
782
  true
@@ -780,6 +825,7 @@ module Grntest
780
825
  end
781
826
 
782
827
  def log_input(content)
828
+ content = normalize_input(content)
783
829
  log(:input, content)
784
830
  end
785
831
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2016-2023 Sutou Kouhei <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
@@ -19,8 +19,12 @@ module Grntest
19
19
  @template = template
20
20
  end
21
21
 
22
- def evaluate(i)
23
- eval(@template)
22
+ def evaluate(**local_variables)
23
+ _binding = binding
24
+ local_variables.each do |name, value|
25
+ _binding.local_variable_set(name, value)
26
+ end
27
+ _binding.eval(@template)
24
28
  end
25
29
  end
26
30
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2021 Sutou Kouhei <kou@clear-code.com>
1
+ # Copyright (C) 2012-2022 Sutou Kouhei <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
@@ -272,6 +272,13 @@ call (int)chdir("#{context.temporary_directory_path}")
272
272
  command_line << "--command=#{gdb_command_path}"
273
273
  command_line << "--quiet"
274
274
  command_line << "--args"
275
+ elsif @tester.rr
276
+ if libtool_wrapper?(command)
277
+ command_line << find_libtool(command)
278
+ command_line << "--mode=execute"
279
+ end
280
+ command_line << @tester.rr
281
+ command_line << "record"
275
282
  elsif @tester.valgrind
276
283
  if libtool_wrapper?(command)
277
284
  command_line << find_libtool(command)
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2021 Sutou Kouhei <kou@clear-code.com>
1
+ # Copyright (C) 2012-2022 Sutou Kouhei <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
@@ -197,6 +197,12 @@ module Grntest
197
197
  tester.gdb = command || tester.default_gdb
198
198
  end
199
199
 
200
+ parser.on("--rr[=COMMAND]",
201
+ "Run Groonga on 'rr record' and use COMMAND as rr",
202
+ "(#{tester.default_rr})") do |command|
203
+ tester.rr = command || tester.default_rr
204
+ end
205
+
200
206
  parser.on("--valgrind[=COMMAND]",
201
207
  "Run Groonga on valgrind and use COMMAND as valgrind",
202
208
  "(#{tester.default_valgrind})") do |command|
@@ -323,6 +329,7 @@ module Grntest
323
329
  attr_accessor :n_workers
324
330
  attr_accessor :output
325
331
  attr_accessor :gdb, :default_gdb
332
+ attr_accessor :rr, :default_rr
326
333
  attr_accessor :valgrind, :default_valgrind
327
334
  attr_accessor :timeout
328
335
  attr_accessor :read_timeout
@@ -534,6 +541,8 @@ module Grntest
534
541
  def initialize_debuggers
535
542
  @gdb = nil
536
543
  @default_gdb = "gdb"
544
+ @rr = nil
545
+ @default_rr = "rr"
537
546
  end
538
547
 
539
548
  def initialize_memory_checkers
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2021 Sutou Kouhei <kou@clear-code.com>
1
+ # Copyright (C) 2012-2022 Sutou Kouhei <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
@@ -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.5.5"
17
+ VERSION = "1.5.7"
18
18
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grntest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.5
4
+ version: 1.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  - Haruka Yoshihara
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-01-18 00:00:00.000000000 Z
12
+ date: 2023-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: diff-lcs
@@ -81,6 +81,20 @@ dependencies:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: 1.4.1
84
+ - !ruby/object:Gem::Dependency
85
+ name: groonga-synonym
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :runtime
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
84
98
  - !ruby/object:Gem::Dependency
85
99
  name: json
86
100
  requirement: !ruby/object:Gem::Requirement
@@ -255,7 +269,7 @@ homepage: https://github.com/groonga/grntest
255
269
  licenses:
256
270
  - GPL-3.0+
257
271
  metadata: {}
258
- post_install_message:
272
+ post_install_message:
259
273
  rdoc_options: []
260
274
  require_paths:
261
275
  - lib
@@ -270,8 +284,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
284
  - !ruby/object:Gem::Version
271
285
  version: '0'
272
286
  requirements: []
273
- rubygems_version: 3.4.0.dev
274
- signing_key:
287
+ rubygems_version: 3.5.0.dev
288
+ signing_key:
275
289
  specification_version: 4
276
290
  summary: Grntest is a testing framework for Groonga. You can write a test for Groonga
277
291
  by writing Groonga commands and expected result.