summaryrefslogtreecommitdiff
path: root/Admin/coverage.txt
blob: db2b8edd47b2f39702a2ade45421bbf3bdc44da3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Code coverage
=============

Documentation:
https://gcc.gnu.org/onlinedocs/gcc/Invoking-Gcov.html
http://ltp.sourceforge.net/coverage/lcov.php
https://wiki.documentfoundation.org/Development/Lcov
https://linux.die.net/man/1/lcov

0. Use lcov 1.12 or newer.
   Make sure that /etc/lcovrc or your ~/.lcovrc contains
     geninfo_auto_base = 1
   (Without it, you get many more warnings in step 4.)

1. Configure in source directory (no VPATH build) with
   $ ./configure CC="gcc --coverage" CPPFLAGS=-Wall
   Why in the source directory?
   Because in a VPATH build, there are more files that create trouble in
   steps 4 and 5 (po-gram-gen.[yc], cldr-plurals.[yc], and more).

2. Compile:
   $ make
   This step creates many *.gcno files.

3. Run:
   $ rm -f `find . -name '*.gcda'`
   $ make check
   This step creates many *.gcda files.

4. $ lcov --capture --directory . --output-file coverage.info
   You get warnings about
     c-ctype.h ostream.h ostream.oo.h styled-ostream.h term-ostream.h unistr.h xalloc.h
     plural.c plural.y
   Handle them by making symlinks:
   $ for f in c-ctype.h ostream.h ostream.oo.h styled-ostream.h term-ostream.h unistr.h xalloc.h; do
       ln -sf ../gnulib-lib/$f gettext-tools/src/$f
     done
   $ for f in plural.c plural.y; do
       ln -sf ../../gettext-runtime/intl/$f gettext-tools/intl/$f
       ln -sf ../../gettext-runtime/intl/$f gettext-tools/src/$f
     done

5. $ genhtml coverage.info --output-directory lcov.out

6. $ xdg-open lcov.out/index.html

7. When done:
   $ rm -f `find . -name '*.gcno'` `find . -name '*.gcda'`