Skip to content

Commit

Permalink
Adding valgrind task
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Ares committed Feb 9, 2011
1 parent 84f8961 commit 3623244
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
21 changes: 20 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ begin
gem.add_development_dependency "rspec", ">= 2.1.0"
gem.add_development_dependency "rake-compiler", "~> 0.7.5"
gem.extensions = FileList["ext/**/extconf.rb"].to_a

# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
Jeweler::GemcutterTasks.new
Expand Down Expand Up @@ -65,3 +65,22 @@ task :http11_parser do
raise "Failed to build C source" unless File.exist? target
end
end

def test_suite_cmdline
require 'find'
files = []
Find.find("test") do |f|
files << f if File.basename(f) =~ /.*spec.*\.rb$/
end
cmdline = "#{RUBY} -w -I.:lib:ext:test \
-e '%w[#{files.join(' ')}].each {|f| require f}'"
end

namespace :test do
desc "run test suite under valgrind with basic ruby options"
task :valgrind => :compile do
system "valgrind --num-callers=50 --error-limit=no \
--partial-loads-ok=yes --undef-value-errors=no #{test_suite_cmdline}"
end
end

2 changes: 1 addition & 1 deletion spec/possible_tests/test_on_resolve_failed.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require '../rev'
require "rev"
class Tester < Rev::TCPSocket
def on_resolve_failed
print "resolved failed! that's good!"
Expand Down
2 changes: 1 addition & 1 deletion spec/possible_tests/test_resolves.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.dirname(__FILE__) + '/../rev'
require "rev"

ADDR = 'wilkboardonline.com'
PORT = 80
Expand Down
2 changes: 1 addition & 1 deletion spec/possible_tests/test_write_during_resolve.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.dirname(__FILE__) + '/../rev'
require "rev"

ADDR = 'wilkboardonline.com'
PORT = 80
Expand Down
4 changes: 2 additions & 2 deletions spec/possible_tests/works_straight.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ def sleep_until(seconds = 1, interval = 0.1)
stopped = false;
@server.attach(loop)
Thread.new {
loop.run_nonblock_over_and_over_again
loop.run_nonblock_over_and_over_again
stopped = true
}
sleep 0
stopped.should == false
loop.stop

sleep_until { stopped == true }
stopped.should == true
end
Expand Down

0 comments on commit 3623244

Please sign in to comment.