grntest 1.5.6 → 1.5.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: cc70a0713dc6900659018742093257e50ab5569b05e603934d3554939fd0c246
4
- data.tar.gz: 953a77a00a938f5126cc925228195b3dfad9bffc08e2aec83f168acb316cb9c6
3
+ metadata.gz: 29784781308745fb8cbb626e33012d1dfb25dfdbe7196c53079b57327478a4d2
4
+ data.tar.gz: 970b7ea3558d9ad1febbdfa4b375f849b0dd10bb81c65b6651b6e210a91e6431
5
5
  SHA512:
6
- metadata.gz: 5cc8ec7a63366dd1f0af5e5b414a2f5dd270225eb31905e43712a5c73d049a31b7ecb7e5ed4d61ef124659e660c59c4ae99988b39b5fa5c40b4d8b6fe01db7fe
7
- data.tar.gz: e8ff6acc4e760082c9511a7445baa9662057d12d1cb046b60eafe53277e6310b832198767cbeabd582db6b20fb34bdd9c7e838ccdfc5f9dbf459a138fcd7feef
6
+ metadata.gz: 9752d6bcb935119c458d2911a7643620a6b3c5b4b9a2a8af772a5d8942e3a94fef6a51370772a317bbeaa47b202e35b3e47a5ed66e6b33c0e9870249e4ac3d8d
7
+ data.tar.gz: 35d70626990bead81c6eccb5a15b21c4a00279484635f131d231e0d5f2242cf48ac220a4d72e9d61addce35d0e07c20073a2a0e3f6df08cdc48adfce351863f2
data/doc/text/news.md CHANGED
@@ -1,5 +1,16 @@
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
+
3
14
  ## 1.5.6: 2022-03-16
4
15
 
5
16
  ### Improvements
@@ -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
@@ -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.6"
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.6
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-03-16 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
@@ -269,7 +269,7 @@ homepage: https://github.com/groonga/grntest
269
269
  licenses:
270
270
  - GPL-3.0+
271
271
  metadata: {}
272
- post_install_message:
272
+ post_install_message:
273
273
  rdoc_options: []
274
274
  require_paths:
275
275
  - lib
@@ -284,8 +284,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
284
284
  - !ruby/object:Gem::Version
285
285
  version: '0'
286
286
  requirements: []
287
- rubygems_version: 3.4.0.dev
288
- signing_key:
287
+ rubygems_version: 3.5.0.dev
288
+ signing_key:
289
289
  specification_version: 4
290
290
  summary: Grntest is a testing framework for Groonga. You can write a test for Groonga
291
291
  by writing Groonga commands and expected result.