1Code coverage 2============= 3 4Documentation: 5https://gcc.gnu.org/onlinedocs/gcc/Invoking-Gcov.html 6http://ltp.sourceforge.net/coverage/lcov.php 7https://wiki.documentfoundation.org/Development/Lcov 8https://linux.die.net/man/1/lcov 9 100. Use lcov 1.12 or newer. 11 Make sure that /etc/lcovrc or your ~/.lcovrc contains 12 geninfo_auto_base = 1 13 (Without it, you get many more warnings in step 4.) 14 151. Configure in source directory (no VPATH build) with 16 $ ./configure CC="gcc --coverage" CPPFLAGS=-Wall 17 Why in the source directory? 18 Because in a VPATH build, there are more files that create trouble in 19 steps 4 and 5 (po-gram-gen.[yc], cldr-plurals.[yc], and more). 20 212. Compile: 22 $ make 23 This step creates many *.gcno files. 24 253. Run: 26 $ rm -f `find . -name '*.gcda'` 27 $ make check 28 This step creates many *.gcda files. 29 304. $ lcov --capture --directory . --output-file coverage.info 31 You get warnings about 32 c-ctype.h ostream.h ostream.oo.h styled-ostream.h term-ostream.h unistr.h xalloc.h 33 plural.c plural.y 34 Handle them by making symlinks: 35 $ for f in c-ctype.h ostream.h ostream.oo.h styled-ostream.h term-ostream.h unistr.h xalloc.h; do 36 ln -sf ../gnulib-lib/$f gettext-tools/src/$f 37 done 38 $ for f in plural.c plural.y; do 39 ln -sf ../../gettext-runtime/intl/$f gettext-tools/intl/$f 40 ln -sf ../../gettext-runtime/intl/$f gettext-tools/src/$f 41 done 42 435. $ genhtml coverage.info --output-directory lcov.out 44 456. $ xdg-open lcov.out/index.html 46 477. When done: 48 $ rm -f `find . -name '*.gcno'` `find . -name '*.gcda'` 49