bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: coreutils test coverage


From: Bo Borgerson
Subject: Re: coreutils test coverage
Date: Wed, 30 Apr 2008 09:10:22 -0400
User-agent: Thunderbird 2.0.0.12 (X11/20080227)

Daniel Dunbar wrote:
> Here is the process I use for generating those results. First, generate the 
> coverage information:


Thanks, that worked like a charm!

I've attached a patch that puts your instructions into the HACKING file.

I used a `.lcov' extension for the lcov output files instead of `.info',
since that extension is already used in the doc/ directory for a
different file format.

One nice further addition would be to have `make clean' also remove the
generated `.gcda' and `.gcno' files, but I'm going to show my
inexperience here and say I don't know how to do that safely. :)


> I also have an additional script which munges the lcov output to make the 
> tables
> sortable but this is pretty gross. When I get a chance I would prefer to push 
> this
> back to lcov as an extra option, although if you really want it I can pass it 
> on.


Yeah, that's probably better to send back upstream to lcov.  I'm sure
they'll appreciate that, and when it works its way down onto coreutils
hackers' boxes they'll appreciate it, too. :)

Thanks again!

Bo
>From decc65cb8f2608743ae906cf4479dd084219ae5d Mon Sep 17 00:00:00 2001
From: Bo Borgerson <address@hidden>
Date: Wed, 30 Apr 2008 08:49:59 -0400
Subject: [PATCH] Add Daniel Dunbar's lcov instructions to HACKING

* HACKING: New section `Finding things to do', points to TODO file and
gives instructions on generating an html coverage report as provided by
Daniel Dunbar.
* TODO: Add item for improving test coverage.  Point back to HACKING.

Signed-off-by: Bo Borgerson <address@hidden>
---
 HACKING |   27 +++++++++++++++++++++++++++
 TODO    |    3 +++
 2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/HACKING b/HACKING
index b40ff00..c33bdd3 100644
--- a/HACKING
+++ b/HACKING
@@ -317,3 +317,30 @@ Miscellaneous useful git commands
   * git rebase -i master: run this from on a branch, and it gives
       you an interface with which you can reorder and modify arbitrary
       change sets on that branch.
+
+-------------------------------------------
+
+Finding things to do
+====================
+If you don't know where to start, check out the TODO file for projects
+that look like they're at your skill-/interest-level.  Another good
+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 lib -o lib.lcov -c
+  lcov -t coreutils -q -d src -b src -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.
diff --git a/TODO b/TODO
index 86320b9..bda8de2 100644
--- a/TODO
+++ b/TODO
@@ -106,6 +106,9 @@ Remove suspicious uses of alloca (ones that may allocate 
more than
 Adapt these contribution guidelines for coreutils:
   http://sources.redhat.com/automake/contribute.html
 
+Improve test coverage.
+  See HACKING for instructions on generating an html test coverage report.
+  Find a program that has poor coverage and improve.
 
 Changes expected to go in, someday.
 ======================================
-- 
1.5.4.3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]