]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add a target for coverage.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 4 Jul 2012 10:06:13 +0000 (10:06 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 4 Jul 2012 10:06:13 +0000 (10:06 +0000)
git-svn-id: https://svn.dealii.org/trunk@25674 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/Makefile

index 4f77885a1d6716405886cbeea5384384300e2728..2d613b2f8f394d2fd7efdfc1df374a6253e815b1 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.