aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in16
-rw-r--r--auto.def13
2 files changed, 22 insertions, 7 deletions
diff --git a/Makefile.in b/Makefile.in
index b299c1a..1207b0f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -19,6 +19,9 @@ CXX = @CCACHE@ @CXX@
RANLIB = @RANLIB@
AR = @AR@
STRIP = @STRIP@
+@if COVERAGE
+export CCACHE_DISABLE := 1
+@endif
# Configuration
@@ -184,9 +187,15 @@ Tcl.html: jim_tcl.txt @srcdir@/make-index
coverage:
@if COVERAGE
-@if GCOVR
+@if COVERAGE_TOOL eq "lcov"
+ @LCOV@ -c --rc genhtml_branch_coverage=1 -d . -o lcov.txt
+ @GENHTML@ --rc genhtml_branch_coverage=1 -o coverage_html lcov.txt > genhtml_output.txt
+ @LCOV@ --summary lcov.txt
+@endif
+@if COVERAGE_TOOL eq "gcovr"
@GCOVR@ -s -e 'conftest*' --html --html-details --output coverage.html
-@else
+@endif
+@if COVERAGE_TOOL eq "gcov"
gcov @srcdir@/*.c
@endif
@else
@@ -196,7 +205,8 @@ coverage:
clean:
rm -f *.o *.so *.dll *.exe lib*.a $(JIMSH) $(LIBJIM) Tcl.html _*.c
@if COVERAGE
- rm -f *.gcno *.gcov *.gcda coverage*.html
+ rm -f *.gcno *.gcov *.gcda */*.gcno */*.gcda */*.gcov coverage*.html
+ rm -rf coverage_html lcov.txt genhtml_output.txt
@endif
distclean: clean
diff --git a/auto.def b/auto.def
index 7693e13..4a891de 100644
--- a/auto.def
+++ b/auto.def
@@ -103,13 +103,18 @@ if {[cctest -cflags -fno-asynchronous-unwind-tables]} {
}
if {[opt-bool coverage]} {
if {[cctest -link 1 -cflags --coverage]} {
- # Disable ccache when using coverage
+ # When using coverage, disable ccache and compiler optimisation
define CCACHE ""
- define-append CCOPTS --coverage
+ define-append CCOPTS --coverage -O0
define-append LDFLAGS --coverage
define COVERAGE 1
- if {![cc-check-progs gcovr]} {
- lappend warnings "Note: gcovr is not available, falling back to gcov"
+ if {[cc-check-progs gcovr]} {
+ define COVERAGE_TOOL gcovr
+ } elseif {[cc-check-progs lcov] && [cc-check-progs genhtml]} {
+ define COVERAGE_TOOL lcov
+ } else {
+ define COVERAGE_TOOL gcov
+ lappend warnings "Note: Neither lcov nor gcovr is available, falling back to gcov"
}
} else {
lappend warnings "Warning: --coverage specified, but compiler does not support --coverage"