Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding valgrind task

  • Loading branch information...
commit 3623244022c0a8d51a80b9e43faa3f79f2c1f2d2 1 parent 84f8961
Rob Ares rares authored
21 Rakefile
View
@@ -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
@@ -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  spec/possible_tests/test_on_resolve_failed.rb
View
@@ -1,4 +1,4 @@
-require '../rev'
+require "rev"
class Tester < Rev::TCPSocket
def on_resolve_failed
print "resolved failed! that's good!"
2  spec/possible_tests/test_resolves.rb
View
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../rev'
+require "rev"
ADDR = 'wilkboardonline.com'
PORT = 80
2  spec/possible_tests/test_write_during_resolve.rb
View
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../rev'
+require "rev"
ADDR = 'wilkboardonline.com'
PORT = 80
4 spec/possible_tests/works_straight.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.