grntest 1.1.0 → 1.1.1

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
  SHA1:
3
- metadata.gz: 62457341e141c3050f3969b9b5aa2690565f5ee1
4
- data.tar.gz: 03a4afb4769285f72c567536b48cffd18bd8ffb4
3
+ metadata.gz: 9681ce146649a19fe0099c41cac952e0c53c964c
4
+ data.tar.gz: accc76ff8605c28f26a07014082523f7d30134ec
5
5
  SHA512:
6
- metadata.gz: 5bc15fab4a1cc065ba334603d7db4725d9930db36f5e578882b3612e688b201a618c1de006454a1f044628f00cda5ae7f46d6c48b4643acde8c5d67643a571e0
7
- data.tar.gz: 5e2298d5aa1035ef11ae9c3b550e34aa51aa160887744e5bad29f454efa833787bcd2b02164278b41e3966b19e08fc250119bc9111d57a9ddfed2a715cfb41ea
6
+ metadata.gz: 210cd594bdfb36425deb5d28084acbf798bfd765021c002f7c00fb54d0ee64c7f69a335f269f9f4ec5229e8930692cccecabc74929004e24a66e9d7813f7615e
7
+ data.tar.gz: 51151bee659689a783ee6eed2f9c8d8fc48e1a71245cb9ec15c8cd8a9cb48a9c3bbff2b276e402a9d1abec46f740a6760d9d95daeb39b74d9152b6aae87f805f
data/doc/text/news.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # News
2
2
 
3
+ ## 1.1.1: 2015-02-03
4
+
5
+ ### Improvements
6
+
7
+ * mark reporter: Show test name on detecting memory leak.
8
+ * Support errno value in system call error message.
9
+ * Support groonga-httpd.
10
+ * Support groonga HTTP server.
11
+
3
12
  ## 1.1.0: 2014-10-25
4
13
 
5
14
  ### Improvements
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
4
4
  #
5
5
  # This program is free software: you can redistribute it and/or modify
6
6
  # it under the terms of the GNU General Public License as published by
@@ -41,10 +41,10 @@ module Grntest
41
41
  n_retried = 0
42
42
  begin
43
43
  send_command(command("status"))
44
- rescue SystemCallError
44
+ rescue Error
45
45
  n_retried += 1
46
46
  sleep(0.1)
47
- retry if n_retried < 10
47
+ retry if n_retried < 50
48
48
  raise
49
49
  end
50
50
  end
@@ -64,34 +64,45 @@ module Grntest
64
64
 
65
65
  MAX_URI_SIZE = 4096
66
66
  def send_load_command(command)
67
- if command.to_uri_format.size <= MAX_URI_SIZE
67
+ lines = command.original_source.lines
68
+ if lines.size == 1 and command.to_uri_format.size <= MAX_URI_SIZE
68
69
  return send_normal_command(command)
69
70
  end
70
71
 
71
72
  values = command.arguments.delete(:values)
73
+ if lines.size >= 2 and lines[1].start_with?("[")
74
+ command.arguments.delete(:columns)
75
+ body = lines[1..-1].join
76
+ else
77
+ body = values
78
+ end
79
+
72
80
  request = Net::HTTP::Post.new(command.to_uri_format)
73
81
  request.content_type = "application/json; charset=UTF-8"
74
- request.body = values
82
+ request.body = body
75
83
  response = Net::HTTP.start(@host, @port) do |http|
76
84
  http.read_timeout = @read_timeout
77
85
  http.request(request)
78
86
  end
79
- normalize_response_data(response.body)
87
+ normalize_response_data(command, response.body)
80
88
  end
81
89
 
82
90
  def send_normal_command(command)
83
91
  url = "http://#{@host}:#{@port}#{command.to_uri_format}"
84
92
  begin
85
93
  open(url, :read_timeout => @read_timeout) do |response|
86
- normalize_response_data(response.read)
94
+ normalize_response_data(command, response.read)
87
95
  end
96
+ rescue SystemCallError
97
+ message = "failed to read response from Groonga: <#{url}>: #{$!}"
98
+ raise Error.new(message)
88
99
  rescue OpenURI::HTTPError
89
100
  $!.io.read
90
101
  end
91
102
  end
92
103
 
93
- def normalize_response_data(raw_response_data)
94
- if raw_response_data.empty?
104
+ def normalize_response_data(command, raw_response_data)
105
+ if raw_response_data.empty? or command.output_type == :none
95
106
  raw_response_data
96
107
  else
97
108
  "#{raw_response_data}\n"
@@ -54,10 +54,12 @@ module Grntest
54
54
  def on_test_leak(worker, result)
55
55
  synchronize do
56
56
  report_test_result_mark("L(#{result.n_leaked_objects})", result)
57
- unless result.checked?
58
- puts
59
- report_test(worker, result)
57
+ puts
58
+ report_test(worker, result)
59
+ if result.checked?
60
60
  report_actual(result)
61
+ else
62
+ report_marker(result)
61
63
  end
62
64
  end
63
65
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2014 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2012-2015 Kouhei Sutou <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
@@ -298,7 +298,7 @@ EOC
298
298
  end
299
299
  yield(executor)
300
300
  ensure
301
- executor.shutdown
301
+ Process.kill(:TERM, pid)
302
302
  wait_groonga_http_shutdown(pid_file_path)
303
303
  end
304
304
  ensure
@@ -359,17 +359,30 @@ EOC
359
359
  config_file_path =
360
360
  context.temporary_directory_path + "groonga-httpd.conf"
361
361
  config_file_path.open("w") do |config_file|
362
- config_file.puts(<<EOF)
362
+ config_file.puts(<<-GLOBAL)
363
363
  daemon off;
364
364
  master_process off;
365
365
  worker_processes 1;
366
366
  working_directory #{context.temporary_directory_path};
367
- error_log groonga-httpd-access.log;
367
+ error_log groonga-httpd-error.log;
368
368
  pid #{pid_file_path};
369
369
  events {
370
370
  worker_connections 1024;
371
371
  }
372
+ GLOBAL
372
373
 
374
+ ENV.each do |key, value|
375
+ next unless key.start_with?("GRN_")
376
+ config_file.puts(<<-ENV)
377
+ env #{key};
378
+ ENV
379
+ end
380
+ config_file.puts(<<-ENV)
381
+ env LD_LIBRARY_PATH;
382
+ env DYLD_LIBRARY_PATH;
383
+ ENV
384
+
385
+ config_file.puts(<<-HTTP)
373
386
  http {
374
387
  server {
375
388
  access_log groonga-httpd-access.log;
@@ -377,11 +390,12 @@ http {
377
390
  server_name #{host};
378
391
  location /d/ {
379
392
  groonga_database #{context.relative_db_path};
393
+ groonga_log_path #{context.log_path};
380
394
  groonga on;
381
395
  }
382
396
  }
383
397
  }
384
- EOF
398
+ HTTP
385
399
  end
386
400
  config_file_path
387
401
  end
@@ -493,7 +507,8 @@ EOF
493
507
  path = $2
494
508
  post = $3
495
509
  normalized_path = File.basename(path)
496
- post = "" unless post.end_with?(")")
510
+ post = post.gsub(/\[\d+\]\z/, "[?]")
511
+ post = "" unless /[\)\]]\z/ =~ post
497
512
  "#{pre}<#{normalized_path}>'#{post}"
498
513
  else
499
514
  content
@@ -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.1.0"
17
+ VERSION = "1.1.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.1.0
4
+ version: 1.1.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: 2014-10-25 00:00:00.000000000 Z
12
+ date: 2015-02-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json