minitest-gcstats 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 723826426c412687776e3e6a424e7024f251bd2c
4
+ data.tar.gz: 088d9f5626befbd15366a576bdd8cdc49c7dcae7
5
+ SHA512:
6
+ metadata.gz: 2d01fdb3e4326e24f8ec013a8ea341d732f9e78d371c46839485f7b3a3d81c780f2e0f390f0908af13b876b67ad787b12fb71bcaf298e9cc948802f54b6b5e3f
7
+ data.tar.gz: aa57b268a2488f0a23bddcb80427a51f311895d30202328b19092a017b1d35315d0d14a5fdc29f860182e9df0c10101ea176f92bf5006029163812d1cbcc5b0c
Binary file
Binary file
@@ -0,0 +1,26 @@
1
+ # -*- ruby -*-
2
+
3
+ require "autotest/restart"
4
+
5
+ Autotest.add_hook :initialize do |at|
6
+ at.testlib = "minitest/autorun"
7
+ at.add_exception "tmp"
8
+
9
+ # at.extra_files << "../some/external/dependency.rb"
10
+ #
11
+ # at.libs << ":../some/external"
12
+ #
13
+ # at.add_exception "vendor"
14
+ #
15
+ # at.add_mapping(/dependency.rb/) do |f, _|
16
+ # at.files_matching(/test_.*rb$/)
17
+ # end
18
+ #
19
+ # %w(TestA TestB).each do |klass|
20
+ # at.extra_class_map[klass] = "test/test_misc.rb"
21
+ # end
22
+ end
23
+
24
+ # Autotest.add_hook :run_command do |at|
25
+ # system "rake build"
26
+ # end
File without changes
@@ -0,0 +1,6 @@
1
+ === 1.0.0 / 2014-08-29
2
+
3
+ * 1 major enhancement
4
+
5
+ * Birthday!
6
+
@@ -0,0 +1,8 @@
1
+ .autotest
2
+ History.rdoc
3
+ Manifest.txt
4
+ README.rdoc
5
+ Rakefile
6
+ lib/minitest/gcstats.rb
7
+ lib/minitest/gcstats_plugin.rb
8
+ test/minitest/test_gcstats.rb
@@ -0,0 +1,77 @@
1
+ = minitest-gcstats
2
+
3
+ home :: https://github.com/seattlerb/minitest-gcstats
4
+ rdoc :: http://docs.seattlerb.org/minitest-gcstats
5
+
6
+ == DESCRIPTION:
7
+
8
+ A minitest plugin that adds a report of the top tests by number of
9
+ objects allocated.
10
+
11
+ == FEATURES/PROBLEMS:
12
+
13
+ * Minitest plugin. No cost if you don't activate it.
14
+ * Reports top N tests by number of objects allocated.
15
+
16
+ == SYNOPSIS:
17
+
18
+ % rake TESTOPTS=-g
19
+ Run options: -g --seed 59120
20
+
21
+ # Running:
22
+
23
+ ..............................................................................
24
+ ..............................................................................
25
+ ..............................................................................
26
+ ...................................................
27
+
28
+ Finished in 0.145769s, 1955.1482 runs/s, 5769.4023 assertions/s.
29
+
30
+ 285 runs, 841 assertions, 0 failures, 0 errors, 0 skips
31
+
32
+ Top 10 tests by objects allocated
33
+
34
+ 2323: TestMeta#test_bug_dsl_expectations
35
+ 2101: TestMinitestUnitOrder#test_setup_and_teardown_survive_inheritance
36
+ 2096: TestMeta#test_setup_teardown_behavior
37
+ 1462: TestMinitestRunner#test_run_filtered_string_method_only
38
+ 1393: TestMinitestRunner#test_run_filtered_including_suite_name
39
+ 1378: TestMinitestRunner#test_run_filtered_including_suite_name_string
40
+ 1292: TestMinitestRunner#test_run_parallel
41
+ 1287: TestMinitestRunner#test_run_skip_verbose
42
+ 1276: TestMinitestUnitOrder#test_all_teardowns_are_guaranteed_to_run
43
+ 1264: TestMinitestRunner#test_run_error
44
+
45
+ == REQUIREMENTS:
46
+
47
+ * minitest
48
+ * ruby 2.0+
49
+
50
+ == INSTALL:
51
+
52
+ * sudo gem install minitest-gcstats
53
+
54
+ == LICENSE:
55
+
56
+ (The MIT License)
57
+
58
+ Copyright (c) Ryan Davis, seattle.rb
59
+
60
+ Permission is hereby granted, free of charge, to any person obtaining
61
+ a copy of this software and associated documentation files (the
62
+ 'Software'), to deal in the Software without restriction, including
63
+ without limitation the rights to use, copy, modify, merge, publish,
64
+ distribute, sublicense, and/or sell copies of the Software, and to
65
+ permit persons to whom the Software is furnished to do so, subject to
66
+ the following conditions:
67
+
68
+ The above copyright notice and this permission notice shall be
69
+ included in all copies or substantial portions of the Software.
70
+
71
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
72
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
73
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
74
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
75
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
76
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
77
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,15 @@
1
+ # -*- ruby -*-
2
+
3
+ require "rubygems"
4
+ require "hoe"
5
+
6
+ Hoe.plugin :isolate
7
+ Hoe.plugin :seattlerb
8
+ Hoe.plugin :rdoc
9
+
10
+ Hoe.spec "minitest-gcstats" do
11
+ developer "Ryan Davis", "ryand-ruby@zenspider.com"
12
+ license "MIT"
13
+ end
14
+
15
+ # vim: syntax=ruby
@@ -0,0 +1,56 @@
1
+ require "minitest"
2
+
3
+ module Minitest::GCStats
4
+ VERSION = "1.0.0"
5
+
6
+ attr_accessor :gc_stats
7
+
8
+ HASH = {}
9
+
10
+ begin
11
+ GC.stat :total_allocated_object
12
+
13
+ def self.current
14
+ GC.stat :total_allocated_object
15
+ end
16
+ rescue TypeError
17
+ def self.current
18
+ GC.stat(HASH)[:total_allocated_object]
19
+ end
20
+ end
21
+
22
+ def before_setup
23
+ super
24
+ self.gc_stats = -Minitest::GCStats.current
25
+ end
26
+
27
+ def after_teardown
28
+ self.gc_stats += Minitest::GCStats.current
29
+ super
30
+ end
31
+ end
32
+
33
+ class Minitest::GCStatsReporter < Minitest::AbstractReporter
34
+ attr_accessor :stats, :max
35
+
36
+ def initialize max
37
+ super()
38
+
39
+ self.max = max
40
+ self.stats = {}
41
+ end
42
+
43
+ def record result
44
+ self.stats["#{result.class.name}##{result.name}"] = result.gc_stats
45
+ end
46
+
47
+ def report
48
+ puts
49
+ puts "Top #{max} tests by objects allocated"
50
+ puts
51
+ stats.sort_by { |k,v| [-v, k] }.first(max).each do |k,v|
52
+ puts "%6d: %s" % [v, k]
53
+ end
54
+ puts
55
+ end
56
+ end
@@ -0,0 +1,19 @@
1
+ require "minitest"
2
+
3
+ module Minitest
4
+ @gcstats = false
5
+
6
+ def self.plugin_gcstats_options opts, options # :nodoc:
7
+ opts.on "-g", "--gcstats [N]", Integer, "Display top-N GC statistics per test." do |n|
8
+ @gcstats = Integer(n||10)
9
+ end
10
+ end
11
+
12
+ def self.plugin_gcstats_init options # :nodoc:
13
+ if @gcstats then
14
+ require "minitest/gcstats"
15
+ self.reporter << Minitest::GCStatsReporter.new(@gcstats)
16
+ Minitest::Test.send :include, Minitest::GCStats
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,14 @@
1
+ require "minitest/autorun"
2
+ require "minitest/gcstats"
3
+
4
+ module TestMinitest; end
5
+
6
+ class TestMinitest::TestGcstats < Minitest::Test
7
+ def test_empty
8
+ # do nothing
9
+ end
10
+
11
+ def test_full
12
+ Object.new
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: minitest-gcstats
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Davis
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDPjCCAiagAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
14
+ ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
+ GRYDY29tMB4XDTEzMDkxNjIzMDQxMloXDTE0MDkxNjIzMDQxMlowRTETMBEGA1UE
16
+ AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
+ JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
+ b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
19
+ taCPaLmfYIaFcHHCSY4hYDJijRQkLxPeB3xbOfzfLoBDbjvx5JxgJxUjmGa7xhcT
20
+ oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
21
+ GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
22
+ qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
23
+ gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
24
+ HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
25
+ AQCFZ7JTzoy1gcG4d8A6dmOJy7ygtO5MFpRIz8HuKCF5566nOvpy7aHhDDzFmQuu
26
+ FX3zDU6ghx5cQIueDhf2SGOncyBmmJRRYawm3wI0o1MeN6LZJ/3cRaOTjSFy6+S6
27
+ zqDmHBp8fVA2TGJtO0BLNkbGVrBJjh0UPmSoGzWlRhEVnYC33TpDAbNA+u39UrQI
28
+ ynwhNN7YbnmSR7+JU2cUjBFv2iPBO+TGuWC+9L2zn3NHjuc6tnmSYipA9y8Hv+As
29
+ Y4evBVezr3SjXz08vPqRO5YRdO3zfeMT8gBjRqZjWJGMZ2lD4XNfrs7eky74CyZw
30
+ xx3n58i0lQkBE1EpKE0lFu/y
31
+ -----END CERTIFICATE-----
32
+ date: 2014-08-30 00:00:00.000000000 Z
33
+ dependencies:
34
+ - !ruby/object:Gem::Dependency
35
+ name: minitest
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '5.4'
41
+ type: :development
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '5.4'
48
+ - !ruby/object:Gem::Dependency
49
+ name: rdoc
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '4.0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '4.0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: hoe
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '3.12'
69
+ type: :development
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '3.12'
76
+ description: |-
77
+ A minitest plugin that adds a report of the top tests by number of
78
+ objects allocated.
79
+ email:
80
+ - ryand-ruby@zenspider.com
81
+ executables: []
82
+ extensions: []
83
+ extra_rdoc_files:
84
+ - History.rdoc
85
+ - Manifest.txt
86
+ - README.rdoc
87
+ files:
88
+ - .autotest
89
+ - .gemtest
90
+ - History.rdoc
91
+ - Manifest.txt
92
+ - README.rdoc
93
+ - Rakefile
94
+ - lib/minitest/gcstats.rb
95
+ - lib/minitest/gcstats_plugin.rb
96
+ - test/minitest/test_gcstats.rb
97
+ homepage: https://github.com/seattlerb/minitest-gcstats
98
+ licenses:
99
+ - MIT
100
+ metadata: {}
101
+ post_install_message:
102
+ rdoc_options:
103
+ - --main
104
+ - README.rdoc
105
+ require_paths:
106
+ - lib
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - '>='
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ requirements: []
118
+ rubyforge_project:
119
+ rubygems_version: 2.2.1
120
+ signing_key:
121
+ specification_version: 4
122
+ summary: A minitest plugin that adds a report of the top tests by number of objects
123
+ allocated.
124
+ test_files:
125
+ - test/minitest/test_gcstats.rb
Binary file