hoe-debugging 1.4.2 → 1.5.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 +5 -5
- data/CHANGELOG.rdoc +10 -0
- data/README.md +41 -9
- data/Rakefile +1 -1
- data/lib/hoe/debugging.rb +11 -2
- data/spec/files/test_project/Gemfile +1 -1
- data/spec/files/test_project/Rakefile +2 -0
- data/spec/hoe_debugging_exit_code_spec.rb +29 -17
- data/spec/hoe_debugging_valgrind_helper_spec.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d39769e054a2227a063051c68b0599af45f585371f75cccd36410f573d512923
|
4
|
+
data.tar.gz: 47c2207158e4ed4968d7c221c8536bfe29f962506e7c7705830bfd765d6bfbdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29f3d8e7cf2944169832cb7f7189baf525c16790b2dc77a49916ba36117ee50d0a5d2c726c40c9cb6ec6a3d41154e4fa704cb7465b02f8503e3fa2da35b1762d
|
7
|
+
data.tar.gz: 22f26dd9e758470f71f891d0cf719e173c1bec60e5c7e56709d46b46a8f645daa70483cc83ecd1fc4cb2f73a60caf765ea8081b8563be06d595f105a4a5c40c2
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
== Changelog for `hoe-debugging`
|
2
|
+
|
3
|
+
=== 1.5.0 / 2018-11-02
|
4
|
+
|
5
|
+
Features:
|
6
|
+
|
7
|
+
* Suppression metadata is always logged when warnings are generated
|
8
|
+
* Rake task `valgrind:suppression` can generate a suppression file from a previous run's log file. Great for when CI finds things that are hard to reproduce!
|
9
|
+
|
10
|
+
|
1
11
|
=== 1.4.2 / 2017-06-19
|
2
12
|
|
3
13
|
Features:
|
data/README.md
CHANGED
@@ -5,26 +5,58 @@
|
|
5
5
|
|
6
6
|
## Description
|
7
7
|
|
8
|
-
A Hoe plugin to help you debug your C extensions. This plugin provides `test:gdb` and `test:valgrind` tasks (plus a few variants).
|
8
|
+
A Hoe plugin to help you debug your C extensions. This plugin provides `test:gdb` and `test:valgrind` tasks (plus a few variants). As of v1.5 it also can generate a valgrind suppression from a previous test suite's log file.
|
9
9
|
|
10
10
|
See the `Hoe::Debugging` module for a few configuration options.
|
11
11
|
|
12
12
|
This plugin expects you to have `gdb` and `valgrind` available in your `PATH`.
|
13
13
|
|
14
14
|
|
15
|
+
## Summary
|
16
|
+
|
17
|
+
In your Rakefile:
|
18
|
+
|
19
|
+
``` ruby
|
20
|
+
Hoe.plugin :debugging
|
21
|
+
```
|
22
|
+
|
23
|
+
Then you'll get the following rake tasks:
|
24
|
+
|
25
|
+
```
|
26
|
+
rake test:valgrind # debugging # Run the test suite under Valgrind
|
27
|
+
rake test:valgrind:mem # debugging # Run the test suite under Valgrind with memory-fill
|
28
|
+
rake test:valgrind:mem0 # debugging # Run the test suite under Valgrind with memory-zero
|
29
|
+
rake test:valgrind:suppression # debugging # Generate a valgrind suppression file for your test suite
|
30
|
+
rake valgrind:suppression[file] # debugging # Generate a valgrind suppression file from a previous run's log file
|
31
|
+
```
|
32
|
+
|
33
|
+
|
15
34
|
## Examples
|
16
35
|
|
36
|
+
Run your test suite under gdb:
|
37
|
+
|
38
|
+
``` sh
|
39
|
+
rake test:gdb
|
40
|
+
```
|
41
|
+
|
42
|
+
Run your test suite with valgrind's memcheck:
|
43
|
+
|
44
|
+
``` sh
|
45
|
+
rake test:valgrind
|
46
|
+
```
|
47
|
+
|
48
|
+
If you have repeatable valgrind warnings that you've decided it's OK to suppress:
|
49
|
+
|
50
|
+
``` sh
|
51
|
+
rake test:valgrind:suppression
|
52
|
+
rake test:valgrind # when this runs, the previous run's errors will be suppressed
|
17
53
|
```
|
18
|
-
# in your Rakefile
|
19
|
-
Hoe.plugin :debugging
|
20
54
|
|
21
|
-
|
22
|
-
$ rake test:gdb
|
23
|
-
$ rake test:valgrind
|
55
|
+
If you have a log file containing hard-to-reproduce valgrind warnings (e.g., from CI) that you've decided it's OK to suppress:
|
24
56
|
|
25
|
-
|
26
|
-
|
27
|
-
|
57
|
+
``` sh
|
58
|
+
rake valgrind:suppression[path/to/file]
|
59
|
+
rake test:valgrind # when this runs, the errors from that log file will be suppressed
|
28
60
|
```
|
29
61
|
|
30
62
|
|
data/Rakefile
CHANGED
@@ -16,7 +16,7 @@ Hoe.spec "hoe-debugging" do
|
|
16
16
|
|
17
17
|
license "MIT"
|
18
18
|
|
19
|
-
extra_dev_deps << ["bundler", "
|
19
|
+
extra_dev_deps << ["bundler", "~> 1.16"]
|
20
20
|
extra_dev_deps << ["hoe", "~> 3.1"]
|
21
21
|
extra_dev_deps << ["hoe-bundler", ">= 0"]
|
22
22
|
extra_dev_deps << ["hoe-gemspec", ">= 0"]
|
data/lib/hoe/debugging.rb
CHANGED
@@ -11,7 +11,7 @@ class Hoe #:nodoc:
|
|
11
11
|
# * <tt>test:valgrind:mem0</tt>
|
12
12
|
|
13
13
|
module Debugging
|
14
|
-
VERSION = "1.
|
14
|
+
VERSION = "1.5.0" #:nodoc:
|
15
15
|
|
16
16
|
##
|
17
17
|
# The exit code of valgrind when it detects an error.
|
@@ -37,6 +37,7 @@ class Hoe #:nodoc:
|
|
37
37
|
"--partial-loads-ok=yes",
|
38
38
|
"--undef-value-errors=no",
|
39
39
|
"--error-exitcode=#{ERROR_EXITCODE}",
|
40
|
+
"--gen-suppressions=all",
|
40
41
|
]
|
41
42
|
end
|
42
43
|
|
@@ -104,7 +105,7 @@ class Hoe #:nodoc:
|
|
104
105
|
|
105
106
|
desc "Generate a valgrind suppression file for your test suite."
|
106
107
|
task "test:valgrind:suppression" do
|
107
|
-
vopts = valgrind_options
|
108
|
+
vopts = valgrind_options
|
108
109
|
generated_suppression_file = false
|
109
110
|
::Tempfile.open "hoe_debugging_valgrind_suppression_log" do |logfile|
|
110
111
|
begin
|
@@ -119,6 +120,14 @@ class Hoe #:nodoc:
|
|
119
120
|
puts "WARNING: no valgrind warnings detected, no suppressions file generated"
|
120
121
|
end
|
121
122
|
end
|
123
|
+
|
124
|
+
desc "Generate a valgrind suppression file from a previous run's log file"
|
125
|
+
task "valgrind:suppression", [:file] do |task, args|
|
126
|
+
file_path = args[:file]
|
127
|
+
raise "Please specify the path to your log file" unless file
|
128
|
+
suppfile = hoe_debugging_valgrind_helper.save_suppressions_from file_path
|
129
|
+
puts "NOTICE: saved suppressions to #{suppfile}"
|
130
|
+
end
|
122
131
|
end
|
123
132
|
|
124
133
|
class ValgrindHelper
|
@@ -5,14 +5,30 @@ describe "exit code" do
|
|
5
5
|
Rake.sh command, verbose: false
|
6
6
|
end
|
7
7
|
|
8
|
+
def do_in_test_dir
|
9
|
+
Bundler.with_clean_env do
|
10
|
+
Dir.chdir test_dir do
|
11
|
+
saved_gemfile = ENV['BUNDLE_GEMFILE']
|
12
|
+
ENV['BUNDLE_GEMFILE'] = "./Gemfile"
|
13
|
+
begin
|
14
|
+
yield
|
15
|
+
ensure
|
16
|
+
ENV['BUNDLE_GEMFILE'] = saved_gemfile
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
8
22
|
let(:test_dir) { File.join(File.dirname(__FILE__), "files/test_project") }
|
9
23
|
|
10
24
|
before do
|
11
|
-
|
12
|
-
|
13
|
-
sh "
|
14
|
-
sh "bundle install >> #{logfile} 2>&1"
|
25
|
+
do_in_test_dir do
|
26
|
+
begin
|
27
|
+
sh "bundle install > #{logfile} 2>&1"
|
15
28
|
sh "bundle exec rake compile >> #{logfile} 2>&1"
|
29
|
+
rescue RuntimeError => e
|
30
|
+
puts "SETUP FAILED:\n#{File.read(logfile)}"
|
31
|
+
raise
|
16
32
|
end
|
17
33
|
end
|
18
34
|
end
|
@@ -20,25 +36,21 @@ describe "exit code" do
|
|
20
36
|
context "from a good run" do
|
21
37
|
let(:logfile) { "good-run.log" }
|
22
38
|
it "is zero" do
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
expect(exitcode.success?).to(be_truthy, File.read(logfile))
|
28
|
-
end
|
39
|
+
do_in_test_dir do
|
40
|
+
system "bundle exec rake test:valgrind TESTOPTS='--name /notexist/' >> #{logfile} 2>&1"
|
41
|
+
exitcode = $?
|
42
|
+
expect(exitcode.success?).to(be_truthy, File.read(logfile))
|
29
43
|
end
|
30
44
|
end
|
31
45
|
end
|
32
46
|
|
33
47
|
context "from a bad run" do
|
34
|
-
let(:logfile) { "
|
48
|
+
let(:logfile) { "bad-run.log" }
|
35
49
|
it "is nonzero" do
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
expect(exitcode.success?).to(be_falsey, File.read(logfile))
|
41
|
-
end
|
50
|
+
do_in_test_dir do
|
51
|
+
system "bundle exec rake test:valgrind >> #{logfile} 2>&1"
|
52
|
+
exitcode = $?
|
53
|
+
expect(exitcode.success?).to(be_falsey, File.read(logfile))
|
42
54
|
end
|
43
55
|
end
|
44
56
|
end
|
@@ -27,7 +27,7 @@ describe Hoe::Debugging::ValgrindHelper do
|
|
27
27
|
it "returns possible suppression file matches in order of specificity" do
|
28
28
|
helper = klass.new "myproj"
|
29
29
|
allow(helper).to receive(:formatted_ruby_version) { "ruby-1.9.3.194" }
|
30
|
-
expect(helper.version_matches).to eq %w[ruby-1.9.3.194 ruby-1.9.3 ruby-1.9]
|
30
|
+
expect(helper.version_matches).to eq %w[ruby-1.9.3.194 ruby-1.9.3 ruby-1.9 ruby-1]
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hoe-debugging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Barnette
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-11-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '1.16'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - "
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '1.16'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: hoe
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,7 +138,7 @@ dependencies:
|
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '4.0'
|
140
140
|
description: |-
|
141
|
-
A Hoe plugin to help you debug your C extensions. This plugin provides `test:gdb` and `test:valgrind` tasks (plus a few variants).
|
141
|
+
A Hoe plugin to help you debug your C extensions. This plugin provides `test:gdb` and `test:valgrind` tasks (plus a few variants). As of v1.5 it also can generate a valgrind suppression from a previous test suite's log file.
|
142
142
|
|
143
143
|
See the `Hoe::Debugging` module for a few configuration options.
|
144
144
|
|
@@ -195,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
195
|
version: '0'
|
196
196
|
requirements: []
|
197
197
|
rubyforge_project:
|
198
|
-
rubygems_version: 2.
|
198
|
+
rubygems_version: 2.7.7
|
199
199
|
signing_key:
|
200
200
|
specification_version: 4
|
201
201
|
summary: A Hoe plugin to help you debug your C extensions
|