hoe-debugging 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,84 @@
1
+ {
2
+ <insert_a_suppression_name_here>
3
+ Memcheck:Addr4
4
+ fun:glob_helper
5
+ fun:ruby_glob0
6
+ fun:rb_push_glob
7
+ fun:vm_call_method
8
+ fun:vm_exec_core
9
+ fun:vm_exec
10
+ fun:rb_yield
11
+ fun:rb_ary_each
12
+ fun:vm_call_method
13
+ fun:vm_exec_core
14
+ fun:vm_exec
15
+ fun:vm_call0
16
+ fun:rb_iterate
17
+ fun:rb_block_call
18
+ fun:enum_find_all
19
+ fun:vm_call_method
20
+ fun:vm_exec_core
21
+ fun:vm_exec
22
+ fun:vm_call0
23
+ fun:rb_class_new_instance
24
+ fun:vm_call_method
25
+ fun:vm_exec_core
26
+ fun:vm_exec
27
+ fun:vm_call0
28
+ }
29
+ {
30
+ <insert_a_suppression_name_here>
31
+ Memcheck:Addr4
32
+ fun:glob_helper
33
+ fun:ruby_glob0
34
+ fun:ruby_brace_expand.constprop.7
35
+ fun:rb_push_glob
36
+ fun:vm_call_method
37
+ fun:vm_exec_core
38
+ fun:vm_exec
39
+ fun:any_iter_i
40
+ fun:vm_yield_with_cfunc
41
+ fun:rb_yield
42
+ fun:rb_ary_each
43
+ fun:vm_call0
44
+ fun:rb_iterate
45
+ fun:rb_block_call
46
+ fun:enum_any
47
+ fun:vm_call_method
48
+ fun:vm_exec_core
49
+ fun:vm_exec
50
+ fun:vm_call0
51
+ fun:rb_class_new_instance
52
+ fun:vm_call_method
53
+ fun:vm_exec_core
54
+ fun:vm_exec
55
+ fun:rb_iseq_eval
56
+ }
57
+ {
58
+ <insert_a_suppression_name_here>
59
+ Memcheck:Addr4
60
+ fun:glob_helper
61
+ fun:glob_helper
62
+ fun:ruby_glob0
63
+ fun:ruby_brace_expand.constprop.7
64
+ fun:rb_push_glob
65
+ fun:vm_call_method
66
+ fun:vm_exec_core
67
+ fun:vm_exec
68
+ fun:any_iter_i
69
+ fun:vm_yield_with_cfunc
70
+ fun:rb_yield
71
+ fun:rb_ary_each
72
+ fun:vm_call0
73
+ fun:rb_iterate
74
+ fun:rb_block_call
75
+ fun:enum_any
76
+ fun:vm_call_method
77
+ fun:vm_exec_core
78
+ fun:vm_exec
79
+ fun:vm_call0
80
+ fun:rb_class_new_instance
81
+ fun:vm_call_method
82
+ fun:vm_exec_core
83
+ fun:vm_exec
84
+ }
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "bundler"
4
+ gem "hoe"
5
+ gem "hoe-debugging", path: "../../.."
6
+ gem "minitest"
7
+ gem "rake-compiler"
@@ -0,0 +1,6 @@
1
+ === 1.0.0 / 2017-01-20
2
+
3
+ * 1 major enhancement
4
+
5
+ * Birthday!
6
+
@@ -0,0 +1,8 @@
1
+ .autotest
2
+ History.txt
3
+ Manifest.txt
4
+ README.txt
5
+ Rakefile
6
+ bin/test_project
7
+ lib/test_project.rb
8
+ test/test_test_project.rb
@@ -0,0 +1,6 @@
1
+ = blah
2
+
3
+ home :: http://testproject.example.com/
4
+ code :: http://testproject.example.com/
5
+ rdoc :: http://testproject.example.com/
6
+ bugs :: http://testproject.example.com/
@@ -0,0 +1,28 @@
1
+ # -*- ruby -*-
2
+
3
+ require "rubygems"
4
+ require "hoe"
5
+
6
+ require 'rake/extensiontask'
7
+
8
+ # Hoe.plugin :bundler
9
+ # Hoe.plugin :compiler
10
+ Hoe.plugin :debugging
11
+ # Hoe.plugin :gem_prelude_sucks
12
+ # Hoe.plugin :gemspec
13
+ # Hoe.plugin :git
14
+ # Hoe.plugin :inline
15
+ # Hoe.plugin :minitest
16
+ # Hoe.plugin :racc
17
+ # Hoe.plugin :rcov
18
+ # Hoe.plugin :rdoc
19
+
20
+ HOE = Hoe.spec "test_project" do |spec|
21
+ developer("Hoe Debuggin", "hoedebuggin@example.com")
22
+ license("MIT")
23
+ spec.version = "1.0.0"
24
+ end
25
+
26
+ Rake::ExtensionTask.new("test_project")
27
+
28
+ # vim: syntax=ruby
@@ -0,0 +1,3 @@
1
+ require 'mkmf'
2
+
3
+ create_makefile('test_project')
@@ -0,0 +1,20 @@
1
+ #include <ruby.h>
2
+
3
+ static VALUE bad_method()
4
+ {
5
+ int *foo = malloc(sizeof(int));
6
+ *foo = 0 ;
7
+
8
+ printf("Hoedebuggingtest: running %d\n", *(foo + 512));
9
+ printf("Hoedebuggingtest: running %d\n", *(foo + 1024));
10
+ printf("Hoedebuggingtest: running %d\n", *(foo + 2048));
11
+ return Qnil;
12
+ }
13
+
14
+
15
+ void Init_test_project()
16
+ {
17
+ VALUE mHoedebuggingtest = rb_define_module("Hoedebuggingtest");
18
+
19
+ rb_define_singleton_method(mHoedebuggingtest, "bad_method", bad_method, 0);
20
+ }
@@ -0,0 +1,11 @@
1
+ gem "minitest"
2
+ require "minitest/autorun"
3
+ require "test_project"
4
+ require "test_project.so"
5
+
6
+ class TestTestProject < Minitest::Test
7
+ def test_good
8
+ STDERR.puts "MIKE: running the test"
9
+ Hoedebuggingtest.bad_method
10
+ end
11
+ end
@@ -0,0 +1,45 @@
1
+ require_relative "spec_helper.rb"
2
+
3
+ describe "exit code" do
4
+ def sh command
5
+ Rake.sh command, verbose: false
6
+ end
7
+
8
+ let(:test_dir) { File.join(File.dirname(__FILE__), "files/test_project") }
9
+
10
+ before do
11
+ Bundler.with_clean_env do
12
+ Dir.chdir test_dir do
13
+ sh "gem install bundler > #{logfile} 2>&1"
14
+ sh "bundle install >> #{logfile} 2>&1"
15
+ sh "bundle exec rake compile >> #{logfile} 2>&1"
16
+ end
17
+ end
18
+ end
19
+
20
+ context "from a good run" do
21
+ let(:logfile) { "good-run.log" }
22
+ it "is zero" do
23
+ Bundler.with_clean_env do
24
+ Dir.chdir test_dir do
25
+ system "bundle exec rake test:valgrind TESTOPTS='--name /notexist/' >> #{logfile} 2>&1"
26
+ exitcode = $?
27
+ expect(exitcode.success?).to(be_truthy, File.read(logfile))
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ context "from a bad run" do
34
+ let(:logfile) { "good-run.log" }
35
+ it "is nonzero" do
36
+ Bundler.with_clean_env do
37
+ Dir.chdir test_dir do
38
+ system "bundle exec rake test:valgrind >> #{logfile} 2>&1"
39
+ exitcode = $?
40
+ expect(exitcode.success?).to(be_falsey, File.read(logfile))
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,98 @@
1
+ require_relative "spec_helper.rb"
2
+
3
+ describe Hoe::Debugging::ValgrindHelper do
4
+ let(:logfile) { File.join File.dirname(__FILE__), "files/sample.log" }
5
+ let(:suppfile) { File.join File.dirname(__FILE__), "files/sample.supp" }
6
+ let(:klass) { Hoe::Debugging::ValgrindHelper }
7
+
8
+ let(:suppressions_directory) { "tmp/suppressions" }
9
+ before { FileUtils.rm_rf suppressions_directory }
10
+
11
+ describe "#initialize" do
12
+ it "requires a project_name argument" do
13
+ expect { klass.new }.to raise_error ArgumentError
14
+ end
15
+ end
16
+
17
+ describe "#directory" do
18
+ it { expect(klass.new("myproj") .directory).to eq "suppressions" }
19
+ it { expect(klass.new("myproj", :directory => "foo").directory).to eq "foo" }
20
+ end
21
+
22
+ describe "#project_name" do
23
+ it { expect(klass.new("myproj").project_name).to eq "myproj" }
24
+ end
25
+
26
+ describe "#version_matches" do
27
+ it "returns possible suppression file matches in order of specificity" do
28
+ helper = klass.new "myproj"
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]
31
+ end
32
+ end
33
+
34
+ describe "#parse_suppressions_from" do
35
+ it "generates a de-duped set of suppressions" do
36
+ helper = klass.new "myproj"
37
+ suppressions = helper.parse_suppressions_from logfile
38
+
39
+ expected = File.read suppfile
40
+
41
+ expect(suppressions).to eq expected
42
+ end
43
+ end
44
+
45
+ describe "#save_suppressions_from" do
46
+ it "saves a file simply containing the ruby" do
47
+ helper = klass.new "myproj", :directory => suppressions_directory
48
+ actual_file = helper.save_suppressions_from logfile
49
+ expect(actual_file).to match(/myproj_ruby-.*\.supp/)
50
+
51
+ actual = File.read actual_file
52
+ expected = File.read suppfile
53
+ expect(actual).to eq expected
54
+ end
55
+ end
56
+
57
+ describe "#matching_suppression_file" do
58
+ context "there are multiple matches" do
59
+ it "returns the best match" do
60
+ helper = klass.new "myproj", :directory => suppressions_directory
61
+ exact_match = File.join(suppressions_directory, "myproj_#{helper.formatted_ruby_version}.supp")
62
+ inexact_match = File.join(suppressions_directory, "myproj_#{helper.version_matches[1]}.999999999.supp")
63
+ FileUtils.mkdir_p suppressions_directory
64
+ FileUtils.touch inexact_match
65
+ FileUtils.touch exact_match
66
+ expect(helper.matching_suppression_file).to eq exact_match
67
+ end
68
+ end
69
+
70
+
71
+ context "there is one inexact match" do
72
+ it "returns it" do
73
+ helper = klass.new "myproj", :directory => suppressions_directory
74
+ inexact_match = File.join(suppressions_directory, "myproj_#{helper.version_matches[1]}.999999999.supp")
75
+ FileUtils.mkdir_p suppressions_directory
76
+ FileUtils.touch inexact_match
77
+ expect(helper.matching_suppression_file).to eq inexact_match
78
+ end
79
+ end
80
+
81
+ context "there is one exact match" do
82
+ it "returns it" do
83
+ helper = klass.new "myproj", :directory => suppressions_directory
84
+ exact_match = File.join(suppressions_directory, "myproj_#{helper.formatted_ruby_version}.supp")
85
+ FileUtils.mkdir_p suppressions_directory
86
+ FileUtils.touch exact_match
87
+ expect(helper.matching_suppression_file).to eq exact_match
88
+ end
89
+ end
90
+
91
+ context "there are zero matches" do
92
+ it "returns nil" do
93
+ helper = klass.new "myproj", :directory => suppressions_directory
94
+ expect(helper.matching_suppression_file).to be_nil
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,3 @@
1
+ require File.join File.dirname(__FILE__), "../lib/hoe/debugging"
2
+ require "fileutils"
3
+ require "rake"
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.2.1
4
+ version: 1.3.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: 2015-12-17 00:00:00.000000000 Z
12
+ date: 2017-01-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rdoc
15
+ name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '4.0'
20
+ version: '0'
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: '4.0'
27
+ version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: hoe
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -40,21 +40,21 @@ dependencies:
40
40
  - !ruby/object:Gem::Version
41
41
  version: '3.1'
42
42
  - !ruby/object:Gem::Dependency
43
- name: rspec
43
+ name: hoe-bundler
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: '2.0'
48
+ version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: '2.0'
55
+ version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
- name: hoe-git
57
+ name: hoe-gemspec
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - ">="
@@ -68,7 +68,7 @@ dependencies:
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  - !ruby/object:Gem::Dependency
71
- name: hoe-gemspec
71
+ name: hoe-git
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - ">="
@@ -82,7 +82,7 @@ dependencies:
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
- name: hoe-bundler
85
+ name: rake-compiler
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - ">="
@@ -95,18 +95,40 @@ dependencies:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: rspec
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: 3.5.0
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: 3.5.0
112
+ - !ruby/object:Gem::Dependency
113
+ name: rdoc
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '4.0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '4.0'
98
126
  description: |-
99
- A Hoe plugin to help you debug your C extensions. This plugin provides
100
- <tt>test:gdb</tt> and <tt>test:valgrind</tt> tasks (plus a few
101
- variants).
102
-
103
- See the Hoe::Debugging module for a few configuration options.
127
+ A Hoe plugin to help you debug your C extensions. This plugin provides `test:gdb` and `test:valgrind` tasks (plus a few variants).
104
128
 
105
- This plugin expects you to have <tt>gdb</tt> and <tt>valgrind</tt>
106
- available in your <tt>PATH</tt>.
129
+ See the `Hoe::Debugging` module for a few configuration options.
107
130
 
108
- These tasks were extracted from nokogiri / johnson and originally written by
109
- ruby legend, {Mike Dalessio}[http://mike.daless.io].
131
+ This plugin expects you to have `gdb` and `valgrind` available in your `PATH`.
110
132
  email:
111
133
  - jbarnette@rubyforge.org
112
134
  - mike.dalessio@gmail.com
@@ -115,13 +137,28 @@ extensions: []
115
137
  extra_rdoc_files:
116
138
  - CHANGELOG.rdoc
117
139
  - Manifest.txt
118
- - README.rdoc
140
+ - README.md
119
141
  files:
142
+ - ".rspec"
120
143
  - CHANGELOG.rdoc
144
+ - LICENSE
121
145
  - Manifest.txt
122
- - README.rdoc
146
+ - README.md
123
147
  - Rakefile
124
148
  - lib/hoe/debugging.rb
149
+ - spec/files/sample.log
150
+ - spec/files/sample.supp
151
+ - spec/files/test_project/Gemfile
152
+ - spec/files/test_project/History.txt
153
+ - spec/files/test_project/Manifest.txt
154
+ - spec/files/test_project/README.txt
155
+ - spec/files/test_project/Rakefile
156
+ - spec/files/test_project/ext/test_project/extconf.rb
157
+ - spec/files/test_project/ext/test_project/test_project.c
158
+ - spec/files/test_project/test/test_test_project.rb
159
+ - spec/hoe_debugging_exit_code_spec.rb
160
+ - spec/hoe_debugging_valgrind_helper_spec.rb
161
+ - spec/spec_helper.rb
125
162
  homepage: http://github.com/jbarnette/hoe-debugging
126
163
  licenses:
127
164
  - MIT
@@ -129,7 +166,7 @@ metadata: {}
129
166
  post_install_message:
130
167
  rdoc_options:
131
168
  - "--main"
132
- - README.rdoc
169
+ - README.md
133
170
  require_paths:
134
171
  - lib
135
172
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -144,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
181
  version: '0'
145
182
  requirements: []
146
183
  rubyforge_project:
147
- rubygems_version: 2.4.8
184
+ rubygems_version: 2.6.8
148
185
  signing_key:
149
186
  specification_version: 4
150
187
  summary: A Hoe plugin to help you debug your C extensions