Permalink
Browse files

putting gdb and valgrind rake tasks under 'test' namespace

  • Loading branch information...
1 parent f46df50 commit 4f61acea2f7ab87a74c2cc0c16706c1284f84072 @flavorjones flavorjones committed Oct 21, 2008
Showing with 17 additions and 10 deletions.
  1. +17 −10 Rakefile
View
27 Rakefile
@@ -171,6 +171,13 @@ namespace :build do
task :externals => libs.map { |x| "cross/#{x}" } + ['cross/ruby-1.8.6-p287']
end
+desc "set environment variables to build and/or test with debug options"
+task :debug do
+ ENV['NOKOGIRI_DEBUG'] = "true"
+ ENV['CFLAGS'] ||= ""
+ ENV['CFLAGS'] += " -DDEBUG"
+end
+
def test_suite_cmdline
require 'find'
files = []
@@ -180,41 +187,41 @@ def test_suite_cmdline
cmdline = "ruby -w -I.:lib:ext:test -rtest/unit -e '%w[#{files.join(' ')}].each {|f| require f}'"
end
-namespace :valgrind do
+namespace :test do
# partial-loads-ok and undef-value-errors necessary to ignore
# spurious (and eminently ignorable) warnings from the ruby
# interpreter
VALGRIND_BASIC_OPTS = "--num-callers=50 --error-limit=no --partial-loads-ok=yes --undef-value-errors=no"
desc "run test suite under valgrind with basic ruby options"
- task :ruby => :build do
+ task :valgrind => :build do
cmdline = "valgrind #{VALGRIND_BASIC_OPTS} #{test_suite_cmdline}"
puts cmdline
system cmdline
end
desc "run test suite under valgrind with memory-fill ruby options"
- task :ruby_mem => :build do
+ task :valgrind_mem => :build do
# fill malloced memory with "m" and freed memory with "f"
cmdline = "valgrind #{VALGRIND_BASIC_OPTS} --freelist-vol=100000000 --malloc-fill=6D --free-fill=66 #{test_suite_cmdline}"
puts cmdline
system cmdline
end
desc "run test suite under valgrind with memory-zero ruby options"
- task :ruby_mem0 => :build do
+ task :valgrind_mem0 => :build do
# fill malloced and freed memory with 0
cmdline = "valgrind #{VALGRIND_BASIC_OPTS} --freelist-vol=100000000 --malloc-fill=00 --free-fill=00 #{test_suite_cmdline}"
puts cmdline
system cmdline
end
-end
-desc "run test suite under gdb"
-task :gdb => :build do
- cmdline = "gdb --args #{test_suite_cmdline}"
- puts cmdline
- system cmdline
+ desc "run test suite under gdb"
+ task :gdb => :build do
+ cmdline = "gdb --args #{test_suite_cmdline}"
+ puts cmdline
+ system cmdline
+ end
end

0 comments on commit 4f61ace

Please sign in to comment.