Improve rake tasks for specs
- clean coverage directory before running specs to avoid simplecov slowdowns - add valgrind task to run valgrind; normal spec does not run it
This commit is contained in:
parent
8c92d442bb
commit
6c66c90426
12
Rakefile.rb
12
Rakefile.rb
@ -26,6 +26,16 @@ task :spec do |task, args|
|
||||
end
|
||||
end
|
||||
end
|
||||
task :spec => :clean
|
||||
|
||||
task :valgrind do
|
||||
begin
|
||||
ENV["spec-valgrind"] = "1"
|
||||
Rake::Task[:spec].execute
|
||||
ensure
|
||||
ENV.delete("spec-valgrind")
|
||||
end
|
||||
end
|
||||
|
||||
# dspec task is useful to test the distributable release script, but is not
|
||||
# useful for coverage information.
|
||||
@ -43,4 +53,4 @@ task :user_guide do
|
||||
system("ruby", "-Ilib", "rb/gen_user_guide.rb")
|
||||
end
|
||||
|
||||
task :all => [:spec, :dspec, :user_guide]
|
||||
task :all => [:valgrind, :dspec, :user_guide]
|
||||
|
||||
@ -119,7 +119,7 @@ EOF
|
||||
results = Results.new(stdout, stderr, status)
|
||||
# Valgrind is only reliably available on Linux, so limit the leak check to
|
||||
# Linux platforms.
|
||||
if RUBY_PLATFORM =~ /linux/
|
||||
if RUBY_PLATFORM =~ /linux/ && ENV["spec-valgrind"]
|
||||
stdout, stderr, status = Open3.capture3("valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose spec/run/testparser")
|
||||
vgout = stdout + stderr
|
||||
File.binwrite("spec/run/.vgout", vgout)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user