From 60927eb21b7caca185bd99c31faf094ebc925f9f Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 4 Jul 2012 10:06:13 +0000 Subject: [PATCH] Add a target for coverage. git-svn-id: https://svn.dealii.org/trunk@25674 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/Makefile | 44 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/deal.II/source/Makefile b/deal.II/source/Makefile index 4f77885a1d..2d613b2f8f 100644 --- a/deal.II/source/Makefile +++ b/deal.II/source/Makefile @@ -1,5 +1,5 @@ # $Id$ -# Copyright W. Bangerth, University of Heidelberg, 1998, 1999, 2000, 2001, 2002, 2010, 2011 +# Copyright W. Bangerth, University of Heidelberg, 1998, 1999, 2000, 2001, 2002, 2010, 2011, 2012 ifneq ($(CLEAN),yes) @@ -240,6 +240,48 @@ clean: $D/lib/{debug,optimized}/*.o +################### coverage +# A target that creates a visual representation of which files and +# lines are covered by the testsuite, the example programs, and +# possible other executables. To use this rule, configure deal.II +# as usual, then add "-fprofile-arcs -ftest-coverage" to the following +# variables in common/Make.global_options: +# - SHLIBFLAGS +# - LDFLAGS +# - CXXFLAGS.g +# Then compile the library and run all the executables for which you +# want it reported that. Note, however, that you can't run them in +# parallel or they will step on each other's toes when writing output. +# In other words, the testsuite has to be run with -j1, however long +# that may take. +# +# When all of these programs have been run, the do +# cd source +# make coverage +# This may take a long time: both running lcov and, in particular, +# genhtml can take hours. In the latter case, there isn't even an +# indication that anything is happening, but it is -- just be +# patient, let it run overnight. +coverage: + for dir in $(all-dirs) ; do \ + cd $$dir ; \ + for file in *.cc ; do \ + basename=`echo $$file | perl -pi -e 's/\\.cc$$//;'` ; \ + for ext in o gcda gcno ; do \ + rm -f $${basename}.$$ext ; \ + if test -f $D/lib/debug/$${dir}_$${basename}.$$ext ; then \ + ln $D/lib/debug/$${dir}_$${basename}.$$ext $${basename}.$$ext ; \ + fi ; \ + done ; \ + done ; \ + cd .. ; \ + done + lcov --base-directory . --directory . -c -o d2.info + lcov --remove d2.info "/usr*" -o d2.info + rm -rf ../coverage + genhtml -o ../coverage -t "deal.II test coverage" --num-spaces 8 d2.info + + ################### .PHONY: default all debug optimized TAGS -- 2.39.5