grntest 1.7.4 → 1.7.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: ec1bd62dfcf7d618511ed7c0883b8e32326b1b7eee388c71202d93dd5232c0c4
4
- data.tar.gz: 95fe9cec3b9289980bb6954b99f47351dc012c45a5bf28e16ab1c2633aadb4f1
3
+ metadata.gz: 06a66bab760554a0f1a4ba6698d87c9702ed6abd0fa0d0301634eabd28668c0f
4
+ data.tar.gz: 5ed8466037e39813ffe988dff011cefca9ce3abf688e2f63fd99c2e111daa257
5
5
  SHA512:
6
- metadata.gz: d4e76e424c2bde8a576b2913964f37cdf0a1f7d96b81cd4c2c2e015033886b890e8729cc9d7c4339742ee35e1be500736a68bd4c9b3254730200ff75d05dae0f
7
- data.tar.gz: 6815b9a5489bf74f2fa1ed0f3b73bdffbdf518b567fc2a1fc2e25786bd5eddd2dfdc2ce6c649f6b1a864db9d6e1b574578a446a84265ab90fbecdf70b4cf676e
6
+ metadata.gz: 92e1bcf1a86c228069020bd5453f8ff90e79f7103b83950ca6eeaa8d4b6f7609430a549bf2dd4e224ae474a2e25c4765ce859a0ae74d60fe3c08cfd54f2a1095
7
+ data.tar.gz: ede6349f7555fd317abebf1d5ae7c513a62b12a121f118288d23c62a5564d6b2a18e1f2cbadf478e4516f3130e931196e2b7b1bd51f1a80fb671cf501a8467f1
data/doc/text/news.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # News
2
2
 
3
+ ## 1.7.6: 2024-09-25
4
+
5
+ ### Improvements
6
+
7
+ * `#@require-os`: Added to run tests only when Groonga is built for
8
+ the given OS.
9
+
10
+ ## 1.7.5: 2024-04-12
11
+
12
+ ### Improvements
13
+
14
+ * `#@generate-series`: Improved performance.
15
+
16
+ * `#@require-env`: Added to run tests only when the given
17
+ environment variable is defined.
18
+
3
19
  ## 1.7.4: 2024-04-05
4
20
 
5
21
  ### Improvements
@@ -308,28 +308,43 @@ module Grntest
308
308
  @context.collect_query_log = (options[0] == "true")
309
309
  end
310
310
 
311
+ def each_generated_series_chunk(evaluator, start, stop)
312
+ max_chunk_size = 1 * 1024 * 1024 # 1MiB
313
+ chunk_size = 0
314
+ records = []
315
+ (Integer(start)..Integer(stop)).each do |i|
316
+ record = evaluator.evaluate(i: i).to_json
317
+ records << record
318
+ chunk_size += record.bytesize
319
+ if chunk_size > max_chunk_size
320
+ yield(records)
321
+ records.clear
322
+ chunk_size = 0
323
+ end
324
+ end
325
+ yield(records) unless records.empty?
326
+ end
327
+
311
328
  def execute_directive_generate_series(parser, line, content, options)
312
329
  start, stop, table, template, = options
313
330
  evaluator = TemplateEvaluator.new(template.force_encoding("UTF-8"))
314
- (Integer(start)..Integer(stop)).each_slice(1000) do |range|
315
- parser << "load --table #{table}\n"
316
- parser << "["
317
- first_record = true
318
- range.each do |i|
319
- record = ""
320
- if first_record
321
- first_record = false
322
- else
323
- record << ","
324
- end
325
- record << "\n"
326
- record << evaluator.evaluate(i: i).to_json
327
- before = Time.now
328
- parser << record
329
- elapsed = Time.now - before
330
- Thread.pass if elapsed > 1.0
331
+ each_generated_series_chunk(evaluator,
332
+ Integer(start),
333
+ Integer(stop)) do |records|
334
+ source = "load --table #{table}\n"
335
+ values_part_start_position = source.size
336
+ source << "["
337
+ records.each_with_index do |record, i|
338
+ source << "," unless i.zero?
339
+ source << "\n"
340
+ source << record
331
341
  end
332
- parser << "\n]\n"
342
+ source << "\n]"
343
+ values = source[values_part_start_position..-1]
344
+ command = Groonga::Command::Load.new(table: table, values: values)
345
+ command.original_source = source
346
+ execute_command(command)
347
+ Thread.pass
333
348
  end
334
349
  end
335
350
 
@@ -534,6 +549,36 @@ module Grntest
534
549
  @benchmark_result = @noop_benchmark_result
535
550
  end
536
551
 
552
+ def execute_directive_require_env(line, content, options)
553
+ env, = options
554
+ if env.start_with?("!")
555
+ if ENV[env[1..-1]]
556
+ omit("require env: #{env}")
557
+ end
558
+ else
559
+ unless ENV[env]
560
+ omit("require env: #{env}")
561
+ end
562
+ end
563
+ end
564
+
565
+ def os
566
+ status_response["os"]
567
+ end
568
+
569
+ def execute_directive_require_os(line, content, options)
570
+ required_os, = options
571
+ if required_os.start_with?("!")
572
+ if required_os[1..-1] == os
573
+ omit("require OS: #{required_os} (#{os})")
574
+ end
575
+ else
576
+ unless required_os == os
577
+ omit("require OS: #{required_os} (#{os})")
578
+ end
579
+ end
580
+ end
581
+
537
582
  def execute_directive(parser, line, content)
538
583
  command, *options = Shellwords.split(content)
539
584
  case command
@@ -597,6 +642,10 @@ module Grntest
597
642
  execute_directive_start_benchmark(line, content, options)
598
643
  when "finish-benchmark"
599
644
  execute_directive_finish_benchmark(line, content, options)
645
+ when "require-env"
646
+ execute_directive_require_env(line, content, options)
647
+ when "require-os"
648
+ execute_directive_require_os(line, content, options)
600
649
  else
601
650
  log_input(line)
602
651
  log_error("#|e| unknown directive: <#{command}>")
@@ -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.7.4"
17
+ VERSION = "1.7.6"
18
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grntest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.4
4
+ version: 1.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  - Haruka Yoshihara
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-05 00:00:00.000000000 Z
11
+ date: 2024-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diff-lcs