minitest-stackprof 0.1.0 → 0.2.0
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.
- checksums.yaml +4 -4
- data/lib/minitest/stackprof/version.rb +1 -1
- data/lib/minitest/stackprof_plugin.rb +36 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d37f637d5bc432deb02f2008a81953bf83ec2d87
|
4
|
+
data.tar.gz: 75f32dd7afd597f563f19bfb8e77e83f0164eb5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e74e10f559bf7193c71373ad2d3f96dd2352594a6da860bad1a7471da6bd83fd79cfc5395154c731d223dcfc9cd2ee74b471653511b5ca63ced5f41903ecd09
|
7
|
+
data.tar.gz: 8eb51fcbc0a9109a48c52bc08f380d1d818092eb6a43ba20f8751f762fd142e2e0d4e41139590897d02089cb49692cbcd54863a0686e63b9ea5e18a23e60aa77
|
@@ -1,13 +1,41 @@
|
|
1
1
|
module Minitest
|
2
2
|
module StackProfPlugin
|
3
|
+
@include_setup_and_teardown = false
|
4
|
+
|
5
|
+
def self.include_setup_and_teardown?
|
6
|
+
@include_setup_and_teardown
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.include_setup_and_teardown=(flag)
|
10
|
+
@include_setup_and_teardown = !!flag
|
11
|
+
end
|
12
|
+
|
3
13
|
def before_setup
|
4
|
-
|
14
|
+
if StackProfPlugin.include_setup_and_teardown?
|
15
|
+
StackProf.start(raw: true)
|
16
|
+
end
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
def after_setup
|
21
|
+
super
|
22
|
+
if !StackProfPlugin.include_setup_and_teardown?
|
23
|
+
StackProf.start(raw: true)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def before_teardown
|
5
28
|
super
|
29
|
+
if !StackProfPlugin.include_setup_and_teardown?
|
30
|
+
StackProf.stop
|
31
|
+
end
|
6
32
|
end
|
7
33
|
|
8
34
|
def after_teardown
|
9
35
|
super
|
10
|
-
|
36
|
+
if StackProfPlugin.include_setup_and_teardown?
|
37
|
+
StackProf.stop
|
38
|
+
end
|
11
39
|
end
|
12
40
|
end
|
13
41
|
|
@@ -24,14 +52,18 @@ module Minitest
|
|
24
52
|
end
|
25
53
|
|
26
54
|
def self.plugin_stackprof_options(opts, options)
|
27
|
-
opts.on '--
|
28
|
-
|
55
|
+
opts.on '--profile-setup', 'profile the setup and teardown as well as the test' do
|
56
|
+
StackProfPlugin.include_setup_and_teardown = true
|
57
|
+
end
|
58
|
+
opts.on '--stackprof[=FILE]', String, 'run under stackprof (optionally specifies the output file)' do |file|
|
59
|
+
options[:stackprof] = file || "stackprof-minitest-#{Process.pid}.dump"
|
29
60
|
end
|
30
61
|
end
|
31
62
|
def self.plugin_stackprof_init(options)
|
32
63
|
if output_file = options[:stackprof]
|
33
64
|
require 'stackprof'
|
34
65
|
puts "Stackprof enabled - dumping results to #{output_file}"
|
66
|
+
puts "Stackprof: #{"NOT " if !StackProfPlugin.include_setup_and_teardown?} profiling the setup/teardown"
|
35
67
|
Minitest::Test.prepend StackProfPlugin
|
36
68
|
reporter << StackProfReporter.new(output_file)
|
37
69
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-stackprof
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvain Joyeux
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|