bleak_house 3.5.1 → 3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +2 -0
- data/Manifest +49 -2
- data/README +4 -1
- data/TODO +1 -1
- data/bleak_house.gemspec +48 -0
- data/ext/bleak_house/logger/snapshot.c +6 -7
- data/lib/bleak_house/analyzer/analyzer.rb +2 -2
- data/lib/bleak_house/analyzer.rb +0 -2
- data/lib/bleak_house/rails/bleak_house.rb +2 -0
- data/lib/bleak_house/rails/dispatcher.rb +11 -15
- data/test/integration/app/README +203 -0
- data/test/integration/app/Rakefile +10 -0
- data/test/integration/app/app/controllers/application.rb +12 -0
- data/test/integration/app/app/controllers/items_controller.rb +6 -0
- data/test/integration/app/app/helpers/application_helper.rb +3 -0
- data/test/integration/app/app/helpers/items_helper.rb +2 -0
- data/test/integration/app/app/views/items/index.rhtml +2 -0
- data/test/integration/app/config/boot.rb +109 -0
- data/test/integration/app/config/database.yml +19 -0
- data/test/integration/app/config/environment.rb +15 -0
- data/test/integration/app/config/environments/development.rb +18 -0
- data/test/integration/app/config/environments/production.rb +19 -0
- data/test/integration/app/config/environments/test.rb +22 -0
- data/test/integration/app/config/initializers/inflections.rb +10 -0
- data/test/integration/app/config/initializers/mime_types.rb +5 -0
- data/test/integration/app/config/routes.rb +35 -0
- data/test/integration/app/doc/README_FOR_APP +2 -0
- data/test/integration/app/log/bleak_house_production.dump +237342 -0
- data/test/integration/app/public/404.html +30 -0
- data/test/integration/app/public/422.html +30 -0
- data/test/integration/app/public/500.html +30 -0
- data/test/integration/app/public/dispatch.cgi +10 -0
- data/test/integration/app/public/dispatch.fcgi +24 -0
- data/test/integration/app/public/dispatch.rb +10 -0
- data/test/integration/app/public/favicon.ico +0 -0
- data/test/integration/app/public/images/rails.png +0 -0
- data/test/integration/app/public/javascripts/application.js +2 -0
- data/test/integration/app/public/javascripts/controls.js +963 -0
- data/test/integration/app/public/javascripts/dragdrop.js +972 -0
- data/test/integration/app/public/javascripts/effects.js +1120 -0
- data/test/integration/app/public/javascripts/prototype.js +4225 -0
- data/test/integration/app/public/robots.txt +5 -0
- data/test/integration/app/script/about +3 -0
- data/test/integration/app/script/console +3 -0
- data/test/integration/app/script/destroy +3 -0
- data/test/integration/app/script/generate +3 -0
- data/test/integration/app/script/performance/benchmarker +3 -0
- data/test/integration/app/script/performance/profiler +3 -0
- data/test/integration/app/script/performance/request +3 -0
- data/test/integration/app/script/plugin +3 -0
- data/test/integration/app/script/process/inspector +3 -0
- data/test/integration/app/script/process/reaper +3 -0
- data/test/integration/app/script/process/spawner +3 -0
- data/test/integration/app/script/runner +3 -0
- data/test/integration/app/script/server +3 -0
- data/test/integration/app/test/functional/items_controller_test.rb +8 -0
- data/test/integration/app/test/test_helper.rb +38 -0
- data/test/integration/server_test.rb +91 -0
- data/test/test_helper.rb +6 -0
- data.tar.gz.sig +0 -0
- metadata +54 -5
- metadata.gz.sig +0 -0
- data/Rakefile +0 -26
- data/lib/bleak_house/support/rake.rb +0 -25
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
|
3
|
+
require 'test_help'
|
|
4
|
+
|
|
5
|
+
class Test::Unit::TestCase
|
|
6
|
+
# Transactional fixtures accelerate your tests by wrapping each test method
|
|
7
|
+
# in a transaction that's rolled back on completion. This ensures that the
|
|
8
|
+
# test database remains unchanged so your fixtures don't have to be reloaded
|
|
9
|
+
# between every test method. Fewer database queries means faster tests.
|
|
10
|
+
#
|
|
11
|
+
# Read Mike Clark's excellent walkthrough at
|
|
12
|
+
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
|
13
|
+
#
|
|
14
|
+
# Every Active Record database supports transactions except MyISAM tables
|
|
15
|
+
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
|
16
|
+
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
|
17
|
+
# is recommended.
|
|
18
|
+
#
|
|
19
|
+
# The only drawback to using transactional fixtures is when you actually
|
|
20
|
+
# need to test transactions. Since your test is bracketed by a transaction,
|
|
21
|
+
# any transactions started in your code will be automatically rolled back.
|
|
22
|
+
self.use_transactional_fixtures = true
|
|
23
|
+
|
|
24
|
+
# Instantiated fixtures are slow, but give you @david where otherwise you
|
|
25
|
+
# would need people(:david). If you don't want to migrate your existing
|
|
26
|
+
# test cases which use the @david style and don't mind the speed hit (each
|
|
27
|
+
# instantiated fixtures translates to a database query per test method),
|
|
28
|
+
# then set this back to true.
|
|
29
|
+
self.use_instantiated_fixtures = false
|
|
30
|
+
|
|
31
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
|
32
|
+
#
|
|
33
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
|
34
|
+
# -- they do not yet inherit this setting
|
|
35
|
+
fixtures :all
|
|
36
|
+
|
|
37
|
+
# Add more helper methods to be used by all tests here...
|
|
38
|
+
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
|
|
2
|
+
require "#{File.dirname(__FILE__)}/../test_helper"
|
|
3
|
+
|
|
4
|
+
class ServerTest < Test::Unit::TestCase
|
|
5
|
+
|
|
6
|
+
RAILS_ROOT = HERE + "/integration/app"
|
|
7
|
+
PORT = 43039
|
|
8
|
+
URL = "http://localhost:#{PORT}/"
|
|
9
|
+
LOG = "#{HERE}/integration/app/log/production.log"
|
|
10
|
+
system("touch #{LOG}")
|
|
11
|
+
|
|
12
|
+
def test_server_start
|
|
13
|
+
assert_match(/Ok/, browse("items"))
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def test_too_few_frames
|
|
17
|
+
browse("items")
|
|
18
|
+
assert_match(/Not enough frames/, analyze)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_enough_frames
|
|
22
|
+
24.times do
|
|
23
|
+
browse("items")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
result = analyze
|
|
27
|
+
|
|
28
|
+
# XXX Doesn't test the caching mechanism
|
|
29
|
+
|
|
30
|
+
assert_match(/over 9 requests/, result)
|
|
31
|
+
assert_match(/items\/index\/GET leaked/mi, result)
|
|
32
|
+
assert_match(/core rails leaked/, result)
|
|
33
|
+
assert_match(/Impact.*core rails/m, result)
|
|
34
|
+
assert_match(/Impact.*items\/index\/GET/mi, result)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
# Mostly copied from Interlock's tests
|
|
40
|
+
|
|
41
|
+
def browse(url = "")
|
|
42
|
+
flag = false
|
|
43
|
+
begin
|
|
44
|
+
open(URL + url).read
|
|
45
|
+
rescue Errno::ECONNREFUSED, OpenURI::HTTPError => e
|
|
46
|
+
raise "#{e.to_s}: #{URL + url}" if flag
|
|
47
|
+
flag = true
|
|
48
|
+
sleep 3
|
|
49
|
+
retry
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def analyze
|
|
54
|
+
`#{HERE}/../bin/bleak #{HERE}/integration/app/log/bleak_house_production.dump`
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def truncate
|
|
58
|
+
Dir["#{RAILS_ROOT}/log/bleak_house*"].each { |f| File.delete f }
|
|
59
|
+
system("> #{LOG}")
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def log
|
|
63
|
+
File.open(LOG, 'r') { |f| f.read }
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def setup
|
|
67
|
+
Process.fork do
|
|
68
|
+
Dir.chdir(RAILS_ROOT) do
|
|
69
|
+
ENV['RAILS_GEM_VERSION'] = ENV['MULTIRAILS_RAILS_VERSION']
|
|
70
|
+
exec("RAILS_ENV=production BLEAK_HOUSE=1 script/server -p #{PORT} &> #{LOG}")
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
50.times do |n|
|
|
75
|
+
break if log =~ /available at 0.0.0.0:#{PORT}/
|
|
76
|
+
sleep(0.2)
|
|
77
|
+
raise "Server didn't start" if n == 49
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
truncate
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def teardown
|
|
84
|
+
# Process.kill(9, pid) doesn't work because Mongrel has double-forked itself away
|
|
85
|
+
while (pids = `ps awx | grep #{PORT} | grep -v grep | awk '{print $1}'`.split("\n")).any?
|
|
86
|
+
pids.each {|pid| system("kill #{pid}")}
|
|
87
|
+
sleep(0.2)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
end
|
data/test/test_helper.rb
ADDED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bleak_house
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: "3.6"
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Evan Weaver
|
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
|
30
30
|
yZ0=
|
|
31
31
|
-----END CERTIFICATE-----
|
|
32
32
|
|
|
33
|
-
date:
|
|
33
|
+
date: 2008-01-02 00:00:00 -05:00
|
|
34
34
|
default_executable:
|
|
35
35
|
dependencies:
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
@@ -69,19 +69,67 @@ files:
|
|
|
69
69
|
- lib/bleak_house/rails/dispatcher.rb
|
|
70
70
|
- lib/bleak_house/rails.rb
|
|
71
71
|
- lib/bleak_house/support/core_extensions.rb
|
|
72
|
-
- lib/bleak_house/support/rake.rb
|
|
73
72
|
- lib/bleak_house.rb
|
|
74
73
|
- LICENSE
|
|
75
74
|
- LICENSE_BSD
|
|
76
75
|
- Manifest
|
|
77
|
-
- Rakefile
|
|
78
76
|
- README
|
|
79
77
|
- ruby/gc.c.patch
|
|
80
78
|
- ruby/parse.y.patch
|
|
81
79
|
- ruby/ruby-1.8.6-p110.tar.bz2
|
|
80
|
+
- test/integration/app/app/controllers/application.rb
|
|
81
|
+
- test/integration/app/app/controllers/items_controller.rb
|
|
82
|
+
- test/integration/app/app/helpers/application_helper.rb
|
|
83
|
+
- test/integration/app/app/helpers/items_helper.rb
|
|
84
|
+
- test/integration/app/app/views/items/index.rhtml
|
|
85
|
+
- test/integration/app/config/boot.rb
|
|
86
|
+
- test/integration/app/config/database.yml
|
|
87
|
+
- test/integration/app/config/environment.rb
|
|
88
|
+
- test/integration/app/config/environments/development.rb
|
|
89
|
+
- test/integration/app/config/environments/production.rb
|
|
90
|
+
- test/integration/app/config/environments/test.rb
|
|
91
|
+
- test/integration/app/config/initializers/inflections.rb
|
|
92
|
+
- test/integration/app/config/initializers/mime_types.rb
|
|
93
|
+
- test/integration/app/config/routes.rb
|
|
94
|
+
- test/integration/app/doc/README_FOR_APP
|
|
95
|
+
- test/integration/app/log/bleak_house_production.dump
|
|
96
|
+
- test/integration/app/public/404.html
|
|
97
|
+
- test/integration/app/public/422.html
|
|
98
|
+
- test/integration/app/public/500.html
|
|
99
|
+
- test/integration/app/public/dispatch.cgi
|
|
100
|
+
- test/integration/app/public/dispatch.fcgi
|
|
101
|
+
- test/integration/app/public/dispatch.rb
|
|
102
|
+
- test/integration/app/public/favicon.ico
|
|
103
|
+
- test/integration/app/public/images/rails.png
|
|
104
|
+
- test/integration/app/public/javascripts/application.js
|
|
105
|
+
- test/integration/app/public/javascripts/controls.js
|
|
106
|
+
- test/integration/app/public/javascripts/dragdrop.js
|
|
107
|
+
- test/integration/app/public/javascripts/effects.js
|
|
108
|
+
- test/integration/app/public/javascripts/prototype.js
|
|
109
|
+
- test/integration/app/public/robots.txt
|
|
110
|
+
- test/integration/app/Rakefile
|
|
111
|
+
- test/integration/app/README
|
|
112
|
+
- test/integration/app/script/about
|
|
113
|
+
- test/integration/app/script/console
|
|
114
|
+
- test/integration/app/script/destroy
|
|
115
|
+
- test/integration/app/script/generate
|
|
116
|
+
- test/integration/app/script/performance/benchmarker
|
|
117
|
+
- test/integration/app/script/performance/profiler
|
|
118
|
+
- test/integration/app/script/performance/request
|
|
119
|
+
- test/integration/app/script/plugin
|
|
120
|
+
- test/integration/app/script/process/inspector
|
|
121
|
+
- test/integration/app/script/process/reaper
|
|
122
|
+
- test/integration/app/script/process/spawner
|
|
123
|
+
- test/integration/app/script/runner
|
|
124
|
+
- test/integration/app/script/server
|
|
125
|
+
- test/integration/app/test/functional/items_controller_test.rb
|
|
126
|
+
- test/integration/app/test/test_helper.rb
|
|
127
|
+
- test/integration/server_test.rb
|
|
82
128
|
- test/misc/direct.rb
|
|
129
|
+
- test/test_helper.rb
|
|
83
130
|
- test/unit/test_bleak_house.rb
|
|
84
131
|
- TODO
|
|
132
|
+
- bleak_house.gemspec
|
|
85
133
|
has_rdoc: true
|
|
86
134
|
homepage: http://blog.evanweaver.com/files/doc/fauna/bleak_house/
|
|
87
135
|
post_install_message:
|
|
@@ -105,9 +153,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
105
153
|
requirements: []
|
|
106
154
|
|
|
107
155
|
rubyforge_project: fauna
|
|
108
|
-
rubygems_version: 0.
|
|
156
|
+
rubygems_version: 1.0.1
|
|
109
157
|
signing_key:
|
|
110
158
|
specification_version: 2
|
|
111
159
|
summary: A library for finding memory leaks.
|
|
112
160
|
test_files:
|
|
161
|
+
- test/integration/server_test.rb
|
|
113
162
|
- test/unit/test_bleak_house.rb
|
metadata.gz.sig
CHANGED
|
Binary file
|
data/Rakefile
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
require 'lib/bleak_house/support/rake'
|
|
3
|
-
|
|
4
|
-
begin
|
|
5
|
-
require 'echoe'
|
|
6
|
-
|
|
7
|
-
Echoe.new("bleak_house") do |p|
|
|
8
|
-
p.author = "Evan Weaver"
|
|
9
|
-
p.project = "fauna"
|
|
10
|
-
p.summary = "A library for finding memory leaks."
|
|
11
|
-
p.url = "http://blog.evanweaver.com/files/doc/fauna/bleak_house/"
|
|
12
|
-
p.docs_host = 'blog.evanweaver.com:~/www/bax/public/files/doc/'
|
|
13
|
-
p.rdoc_pattern = /^ext.*\.c|lib.*logger.*rb|analyzer|rails\/bleak_house|^README|^CHANGELOG|^TODO|^LICENSE|^COPYING$/
|
|
14
|
-
p.dependencies = ['ccsv']
|
|
15
|
-
p.require_signed = true
|
|
16
|
-
p.include_gemspec = false
|
|
17
|
-
p.include_rakefile = true
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
rescue LoadError
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
desc 'Run tests.'
|
|
24
|
-
Rake::Task.redefine_task("test") do
|
|
25
|
-
system "ruby-bleak-house -Ibin:lib:test test/unit/test_bleak_house.rb #{ENV['METHOD'] ? "--name=#{ENV['METHOD']}" : ""}"
|
|
26
|
-
end
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
# http://www.bigbold.com/snippets/posts/show/2032
|
|
3
|
-
module Rake
|
|
4
|
-
module TaskManager
|
|
5
|
-
def redefine_task(task_class, args, &block)
|
|
6
|
-
task_name, deps = resolve_args(args)
|
|
7
|
-
task_name = task_class.scope_name(@scope, task_name)
|
|
8
|
-
deps = [deps] unless deps.respond_to?(:to_ary)
|
|
9
|
-
deps = deps.collect {|d| d.to_s }
|
|
10
|
-
task = @tasks[task_name.to_s] = task_class.new(task_name, self)
|
|
11
|
-
task.application = self
|
|
12
|
-
task.add_comment(@last_comment)
|
|
13
|
-
@last_comment = nil
|
|
14
|
-
task.enhance(deps, &block)
|
|
15
|
-
task
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
class Task
|
|
19
|
-
class << self
|
|
20
|
-
def redefine_task(args, &block)
|
|
21
|
-
Rake.application.redefine_task(self, args, &block)
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|