From ba242440968c84496771af47937ad9d36624bf74 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Tue, 21 Oct 2014 15:33:22 -0400 Subject: [PATCH] Added task for summarizing code coverage for the test build --- Rakefile | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 3051900..52c3dc8 100644 --- a/Rakefile +++ b/Rakefile @@ -19,12 +19,14 @@ base_env = BuildEnv.new(echo: :command) do |env| end main_env = base_env.clone do |env| + env.build_dir('source','build/obj/source') + env.build_dir('modules','build/obj/modules') env["CFLAGS"] += ['-O3'] end test_env = base_env.clone do |env| - env.build_dir('source','build/obj/test/source') - env.build_dir('modules','build/obj/test/modules') + env.build_dir('source','build/obj_test/source') + env.build_dir('modules','build/obj_test/modules') env['CFLAGS'] += ['--coverage'] env['LDFLAGS'] += ['--coverage'] end @@ -110,3 +112,13 @@ RSpec::Core::RakeTask.new(:spec) do |t,args| main_env.process test_env.process end + +desc "Generate test coverage reports" +task :coverage => [:spec] do + FileList['build/obj_test/**/*.gcno'].each do |gcno| + obj = gcno.ext('o') + path = File.dirname(obj) + gcov = File.basename(obj).ext('c.gcov') + sh *['gcov', '-a', '-b', '-c', obj] and FileUtils.mv("./#{gcov}","#{path}/#{gcov}") + end +end -- 2.52.0