ADDED coverage.sh Index: coverage.sh ================================================================== --- coverage.sh +++ coverage.sh @@ -0,0 +1,5 @@ +#!/bin/sh +gnatmake -p -Ptests -XMODE=Coverage || exit $? +coverage/bin/test_all +lcov --gcov-tool gnatgcov --directory coverage/obj --output coverage/test-info.dat --capture || exit $? +genhtml --output-dir coverage coverage/test-info.dat Index: natools.gpr ================================================================== --- natools.gpr +++ natools.gpr @@ -1,9 +1,32 @@ project Natools is + type Build_Type is ("Release", "Coverage"); + Mode : Build_Type := external ("MODE", "Release"); + + Prefix := ""; + Extra_Switches := (); + + case Mode is + when "Release" => + Prefix := ""; + when "Coverage" => + Prefix := "coverage/"; + end case; + -- Source_Dirs is left to default "." for Source_Dirs use ("src"); - for Object_Dir use "obj"; + for Object_Dir use Prefix & "obj"; + for Exec_Dir use Prefix & "bin"; + + case Mode is + when "Release" => + Extra_Switches := ("-O3"); + when "Coverage" => + Extra_Switches := + ("-g", "-O0", "-fprofile-arcs", "-ftest-coverage"); + end case; + package Compiler is for Default_Switches ("Ada") use ("-gnatafnovy", -- a: assersions enabled @@ -31,13 +54,13 @@ "-gnateE", -- generate extra information in exception messages "-gnatwae", -- a: turn on most warnings -- e: treat all warnings as errors - "-fstack-check", - "-O3"); + "-fstack-check") + & Extra_Switches; end Compiler; package Linker is - for Default_Switches ("Ada") use ("-O3"); + for Default_Switches ("Ada") use Extra_Switches; end Linker; end Natools;