grntest 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/text/news.md +11 -0
- data/grntest.gemspec +1 -1
- data/lib/grntest/executors/base-executor.rb +7 -10
- data/lib/grntest/log-entry.rb +19 -0
- data/lib/grntest/log-parser.rb +44 -0
- data/lib/grntest/test-runner.rb +5 -7
- data/lib/grntest/version.rb +1 -1
- data/test/executors/test-base-executor.rb +8 -4
- data/test/test-log-parser.rb +77 -0
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eaa3b200f88ffe43771ed58704ddc925c8c3b54
|
4
|
+
data.tar.gz: d55bdd76d826f869ecb6482b2c04d2a5b6ed7beb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2aa26866b78d9e4c0a89ba28d1041dec5e698025f89533ef2c460114bd0d2331d2f80806ff19c5486effc6e4172e382c6fbfe45887102adcd29902f9e261f21d
|
7
|
+
data.tar.gz: 1bc57cd0f43d21abaedda718f65cf4bfc486c8ad93c97c812a1691500a78b2f922870f21ba1d99c4b0a9287e94674af4583f09f2dbd1ea171e3a3c2b5ef25607
|
data/doc/text/news.md
CHANGED
data/grntest.gemspec
CHANGED
@@ -49,7 +49,7 @@ Gem::Specification.new do |spec|
|
|
49
49
|
|
50
50
|
spec.add_development_dependency("bundler")
|
51
51
|
spec.add_development_dependency("rake")
|
52
|
-
spec.add_development_dependency("test-unit")
|
52
|
+
spec.add_development_dependency("test-unit", ">= 3.0.0")
|
53
53
|
spec.add_development_dependency("test-unit-rr")
|
54
54
|
spec.add_development_dependency("packnga")
|
55
55
|
spec.add_development_dependency("redcarpet")
|
@@ -1,6 +1,4 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# Copyright (C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
|
1
|
+
# Copyright (C) 2012-2014 Kouhei Sutou <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
|
@@ -22,6 +20,7 @@ require "shellwords"
|
|
22
20
|
require "groonga/command/parser"
|
23
21
|
|
24
22
|
require "grntest/error"
|
23
|
+
require "grntest/log-parser"
|
25
24
|
require "grntest/execution-context"
|
26
25
|
require "grntest/response-parser"
|
27
26
|
|
@@ -273,13 +272,11 @@ module Grntest
|
|
273
272
|
|
274
273
|
def extract_important_messages(log)
|
275
274
|
important_messages = []
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
next if backtrace_log_message?(message)
|
282
|
-
important_messages << "\#|#{log_level}| #{message}"
|
275
|
+
parser = LogParser.new
|
276
|
+
parser.parse(log) do |entry|
|
277
|
+
next unless important_log_level?(entry.log_level)
|
278
|
+
next if backtrace_log_message?(entry.message)
|
279
|
+
important_messages << "\#|#{entry.log_level}| #{entry.message}"
|
283
280
|
end
|
284
281
|
important_messages.join("\n")
|
285
282
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Copyright (C) 2014 Kouhei Sutou <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
|
+
module Grntest
|
17
|
+
class LogEntry < Struct.new(:timestamp, :log_level, :message)
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Copyright (C) 2014 Kouhei Sutou <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/log-entry"
|
17
|
+
|
18
|
+
module Grntest
|
19
|
+
class LogParser
|
20
|
+
def parse(log)
|
21
|
+
timestamp = nil
|
22
|
+
log_level = nil
|
23
|
+
message = nil
|
24
|
+
emit_entry = lambda do
|
25
|
+
if timestamp
|
26
|
+
entry = LogEntry.new(timestamp, log_level, message.chomp)
|
27
|
+
yield(entry)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
log.each_line do |line|
|
31
|
+
case line
|
32
|
+
when /\A(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+)\|([a-zA-Z])\|\s*/
|
33
|
+
emit_entry.call
|
34
|
+
timestamp = $1
|
35
|
+
log_level = $2
|
36
|
+
message = $POSTMATCH
|
37
|
+
else
|
38
|
+
message << line
|
39
|
+
end
|
40
|
+
end
|
41
|
+
emit_entry.call
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/grntest/test-runner.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# Copyright (C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
|
1
|
+
# Copyright (C) 2012-2014 Kouhei Sutou <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
|
@@ -22,6 +20,7 @@ require "tempfile"
|
|
22
20
|
require "json"
|
23
21
|
|
24
22
|
require "grntest/error"
|
23
|
+
require "grntest/log-parser"
|
25
24
|
require "grntest/executors"
|
26
25
|
require "grntest/base-result"
|
27
26
|
|
@@ -549,10 +548,9 @@ EOF
|
|
549
548
|
end
|
550
549
|
|
551
550
|
def check_memory_leak(context)
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
next unless /^grn_fin \((\d+)\)$/ =~ message
|
551
|
+
parser = LogParser.new
|
552
|
+
parser.parse(context.log) do |entry|
|
553
|
+
next unless /^grn_fin \((\d+)\)$/ =~ entry.message
|
556
554
|
n_leaked_objects = $1.to_i
|
557
555
|
next if n_leaked_objects.zero?
|
558
556
|
context.result << [:n_leaked_objects, n_leaked_objects, {}]
|
data/lib/grntest/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
|
1
|
+
# Copyright (C) 2013-2014 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
|
@@ -21,14 +21,16 @@ class TestBaseExecutor < Test::Unit::TestCase
|
|
21
21
|
@context = @executor.context
|
22
22
|
end
|
23
23
|
|
24
|
-
class
|
24
|
+
class TestErrorLogLevel < self
|
25
25
|
data("emergency" => "E",
|
26
26
|
"alert" => "A",
|
27
27
|
"critical" => "C",
|
28
28
|
"error" => "e",
|
29
29
|
"warning" => "w")
|
30
30
|
def test_important_log_level(level)
|
31
|
-
|
31
|
+
assert do
|
32
|
+
@executor.send(:important_log_level?, level)
|
33
|
+
end
|
32
34
|
end
|
33
35
|
|
34
36
|
data("notice" => "n",
|
@@ -36,7 +38,9 @@ class TestBaseExecutor < Test::Unit::TestCase
|
|
36
38
|
"debug" => "d",
|
37
39
|
"dump" => "-")
|
38
40
|
def test_not_important_log_level(level)
|
39
|
-
|
41
|
+
assert do
|
42
|
+
not @executor.send(:important_log_level?, level)
|
43
|
+
end
|
40
44
|
end
|
41
45
|
end
|
42
46
|
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# Copyright (C) 2014 Kouhei Sutou <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/log-parser"
|
17
|
+
|
18
|
+
class TestLogParser < Test::Unit::TestCase
|
19
|
+
def parse(log)
|
20
|
+
parser = Grntest::LogParser.new
|
21
|
+
entries = []
|
22
|
+
parser.parse(log) do |entry|
|
23
|
+
entries << entry.to_h
|
24
|
+
end
|
25
|
+
entries
|
26
|
+
end
|
27
|
+
|
28
|
+
sub_test_case("#parse") do
|
29
|
+
def test_one_line
|
30
|
+
log = "2014-09-27 17:31:53.046467|n| message"
|
31
|
+
assert_equal([
|
32
|
+
{
|
33
|
+
:timestamp => "2014-09-27 17:31:53.046467",
|
34
|
+
:log_level => "n",
|
35
|
+
:message => "message",
|
36
|
+
},
|
37
|
+
],
|
38
|
+
parse(log))
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_one_lines
|
42
|
+
log = <<-LOG
|
43
|
+
2014-09-27 17:31:53.046467|n| notification message
|
44
|
+
2014-09-27 17:31:54.046467|W| warning message
|
45
|
+
LOG
|
46
|
+
assert_equal([
|
47
|
+
{
|
48
|
+
:timestamp => "2014-09-27 17:31:53.046467",
|
49
|
+
:log_level => "n",
|
50
|
+
:message => "notification message",
|
51
|
+
},
|
52
|
+
{
|
53
|
+
:timestamp => "2014-09-27 17:31:54.046467",
|
54
|
+
:log_level => "W",
|
55
|
+
:message => "warning message",
|
56
|
+
},
|
57
|
+
],
|
58
|
+
parse(log))
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
def test_multi_line
|
63
|
+
log = <<-LOG
|
64
|
+
2014-09-27 17:31:53.046467|n| multi
|
65
|
+
line message
|
66
|
+
LOG
|
67
|
+
assert_equal([
|
68
|
+
{
|
69
|
+
:timestamp => "2014-09-27 17:31:53.046467",
|
70
|
+
:log_level => "n",
|
71
|
+
:message => "multi\nline message",
|
72
|
+
},
|
73
|
+
],
|
74
|
+
parse(log))
|
75
|
+
end
|
76
|
+
end
|
77
|
+
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.0.
|
4
|
+
version: 1.0.9
|
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-
|
12
|
+
date: 2014-09-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -87,14 +87,14 @@ dependencies:
|
|
87
87
|
requirements:
|
88
88
|
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
90
|
+
version: 3.0.0
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
97
|
+
version: 3.0.0
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: test-unit-rr
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -161,6 +161,8 @@ files:
|
|
161
161
|
- lib/grntest/executors/base-executor.rb
|
162
162
|
- lib/grntest/executors/http-executor.rb
|
163
163
|
- lib/grntest/executors/standard-io-executor.rb
|
164
|
+
- lib/grntest/log-entry.rb
|
165
|
+
- lib/grntest/log-parser.rb
|
164
166
|
- lib/grntest/reporters.rb
|
165
167
|
- lib/grntest/reporters/base-reporter.rb
|
166
168
|
- lib/grntest/reporters/inplace-reporter.rb
|
@@ -175,6 +177,7 @@ files:
|
|
175
177
|
- test/executors/test-base-executor.rb
|
176
178
|
- test/executors/test-standard-io-executor.rb
|
177
179
|
- test/run-test.rb
|
180
|
+
- test/test-log-parser.rb
|
178
181
|
homepage: https://github.com/groonga/grntest
|
179
182
|
licenses:
|
180
183
|
- GPL-3.0+
|
@@ -204,4 +207,5 @@ test_files:
|
|
204
207
|
- test/executors/test-base-executor.rb
|
205
208
|
- test/executors/test-standard-io-executor.rb
|
206
209
|
- test/run-test.rb
|
210
|
+
- test/test-log-parser.rb
|
207
211
|
has_rdoc:
|