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
- delay combining and reporting simplecov results until end of task to
  speed up task execution
This commit is contained in:
josh committed 2026-08-19 13:14:53 -04:00
1 parent 8c92d442bb
commit 4a4647159e
3 files changed
+25 -3

No files matched your search

+6 -1
View File
@@ -39,6 +39,11 @@ class MyFormatter
end
SimpleCov.start do
command_name(#{command_name.inspect})
# Write this process's results to its own directory. Sharing one resultset
# file means every propane invocation must read, merge, and rewrite the
# results of all previous invocations, which grows quadratically over the
# suite. The parts are merged once at the end by the spec Rake task.
coverage_dir(#{"coverage/parts/#{command_name}".inspect})
filters.clear
add_filter do |src|
!(src.filename[SimpleCov.root])
@@ -119,7 +124,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)
+4
View File
@@ -15,6 +15,10 @@ unless ENV["dist_specs"]
command_name "RSpec"
end
project_name "Propane"
# Keep this process's results separate from the propane subprocess results
# so that nothing has to merge on the fly; the spec Rake task collates all
# of the parts once the suite is done.
coverage_dir "coverage/parts/rspec"
merge_timeout 3600
formatter(MyFormatter)
end