minitest-stackprof 0.1.0 → 0.2.0

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: a5af0b46c8d4b91058e0f63bc62768f8811c9dee
4
- data.tar.gz: 2ae770ad77a7001a88aeea12224f72c05646c487
3
+ metadata.gz: d37f637d5bc432deb02f2008a81953bf83ec2d87
4
+ data.tar.gz: 75f32dd7afd597f563f19bfb8e77e83f0164eb5c
5
5
  SHA512:
6
- metadata.gz: a5030bed3b726adbca52f604dc970e315706ebf1b72002fbbf7c79d1d2ca7b325a3c94132602191b6380dac53ea0b532fc68f084d107fa4cb684761964f0bc2b
7
- data.tar.gz: e6108ef0c873b2eea6934666fe5a728b523a08753a51808fe789a5ba8e7f696b08b9e1a03adf646411f8903a7fe399319a222a05f9d181d0f9e6f417648cf41e
6
+ metadata.gz: 4e74e10f559bf7193c71373ad2d3f96dd2352594a6da860bad1a7471da6bd83fd79cfc5395154c731d223dcfc9cd2ee74b471653511b5ca63ced5f41903ecd09
7
+ data.tar.gz: 8eb51fcbc0a9109a48c52bc08f380d1d818092eb6a43ba20f8751f762fd142e2e0d4e41139590897d02089cb49692cbcd54863a0686e63b9ea5e18a23e60aa77
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Stackprof
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -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
- StackProf.start
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
- StackProf.stop
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 '--stackprof[=FILE]', 'run under stackprof (optionally specifies the mode)' do |mode|
28
- options[:stackprof] = mode || "stackprof-minitest-#{Process.pid}.dump"
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.1.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: 2015-09-23 00:00:00.000000000 Z
11
+ date: 2016-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest