1
0
Fork 0
mirror of https://github.com/rubyjs/mini_racer synced 2023-03-27 23:21:28 -04:00
mini_racer/Rakefile

55 lines
1.5 KiB
Text
Raw Normal View History

2016-05-04 02:54:51 -04:00
require "bundler/gem_tasks"
require "rake/testtask"
require "rake/extensiontask"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList['test/**/*_test.rb']
end
2016-05-13 21:34:32 -04:00
task :default => [:compile, :test]
2016-05-04 02:54:51 -04:00
gem = Gem::Specification.load( File.dirname(__FILE__) + '/mini_racer.gemspec' )
Rake::ExtensionTask.new( 'mini_racer_extension', gem )
# via http://blog.flavorjon.es/2009/06/easily-valgrind-gdb-your-ruby-c.html
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 :valgrind => :compile do
cmdline = "valgrind #{VALGRIND_BASIC_OPTS} ruby test/test_leak.rb"
puts cmdline
system cmdline
end
desc "run test suite under valgrind with leak-check=full"
task :valgrind_leak_check => :compile do
cmdline = "valgrind #{VALGRIND_BASIC_OPTS} --leak-check=full ruby test/test_leak.rb"
puts cmdline
require 'open3'
_, stderr = Open3.capture3(cmdline)
section = ""
stderr.split("\n").each do |line|
if line =~ /==.*==\s*$/
if (section =~ /mini_racer|SUMMARY/)
puts
puts section
puts
end
section = ""
else
section << line << "\n"
end
end
end
end