From d91e912343ab04b37d011b5c8a7c0723edc35e3d Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?= Date: Sat, 29 Apr 2017 20:53:16 -0700 Subject: [PATCH] doc: update the instructions for generating a coverage report * HACKING: Change from explicit instructions to using gnulib provided coverage testing targets. Also include instructions for adding root only tests to the report. Fixes http://bugs.gnu.org/26709 --- HACKING | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/HACKING b/HACKING index a42e102ea..4cf86540c 100644 --- a/HACKING +++ b/HACKING @@ -601,22 +601,20 @@ option is always to improve tests. You never know what you might uncover when you improve test coverage, and even if you don't find any bugs your contribution is sure to be appreciated. -A good way to quickly assess current test coverage is to use "lcov" -to generate HTML coverage reports. Follow these steps: - - # configure with coverage information - ./configure CFLAGS="-g -fprofile-arcs -ftest-coverage" - make - # run whatever tests you want, i.e.: - make check - # run lcov - lcov -t coreutils -q -d lib -b `pwd` -o lib.lcov -c - lcov -t coreutils -q -d src -b `pwd` -o src.lcov -c - # generate HTML from the output - genhtml -p `pwd` -t coreutils -q --output-directory lcov-html *.lcov - -Then just open the index.html file (in the generated lcov-html directory) -in your favorite web browser. +A good way to quickly assess current test coverage for standard +and root only tests is to follow test steps (requires lcov to be installed): + + # Do a standard run as the current user + make -j$(nproc) coverage + + # Add the root only tests + sudo make -j$(nproc) build-coverage NON_ROOT_USERNAME=$USER SUBDIRS=. + + # Generate the report with the combined results + make gen-coverage + + # view the HTML report: + xdg-open doc/coverage/index.html ======================================================================== Copyright (C) 2009-2017 Free Software Foundation, Inc. -- 2.11.4.GIT