1
1
-------------------------------------------------
2
2
- README file for the LTP GCOV extension (LCOV) -
3
- - Last changes: 2024-12-16
3
+ - Last changes: 2024-12-25
4
4
-------------------------------------------------
5
5
6
6
Description
7
7
-----------
8
- LCOV is an extension of GCOV, a GNU tool which provides information about
9
- what parts of a program are actually executed (i.e. "covered") while running
10
- a particular test case. The extension consists of a set of Perl scripts
11
- which build on the textual GCOV output to implement the following enhanced
8
+ LCOV is a tool to manipulate and display information about what parts of a
9
+ program are actually executed (i.e. "covered") while running a particular test
10
+ case or set of testcases. LCOV consists of a set of Perl scripts which build on
11
+ the text output of various coverage tools - e.g., gcov, llvm-cov, Coverage.py,
12
+ Cobertura, Devel::Cover, Jacoco, etc. - to implement the following enhanced
12
13
functionality:
13
14
14
- * HTML based output: coverage rates are additionally indicated using bar
15
- graphs and specific colors.
15
+ * HTML based output: coverage rates are indicated using bar
16
+ graphs and specific colors in a hyperlinked coverage report, intended
17
+ to enable the user to quickly diagnose and address coverage issues.
16
18
17
19
* Support for large projects: overview pages allow quick browsing of
18
20
coverage data by providing a hierarchical directory structure
19
- view, a flat list of all source files in the project, or a three-level
21
+ view, a flat list of all source files in the project, or a three-level
20
22
detail view: directory, file and source code view.
21
23
22
24
* Support for multiple languages - including C/C++, Perl, and Python.
@@ -25,7 +27,7 @@ Description
25
27
but works as well for coverage measurements on standard user space
26
28
applications.
27
29
28
- LCOV supports differential coverage, as well as date- and owner-binning.
30
+ LCOV supports differential coverage, as well as date- and owner-binning.
29
31
See:
30
32
https://arxiv.org/abs/2008.07947
31
33
or
@@ -35,7 +37,7 @@ Description
35
37
A video presentation of the basic ideas can be found at
36
38
http://doi.org/10.5281/zenodo.4653252
37
39
38
- In addition, several other features and capabilities have been added . See
40
+ In addition, several other features and capabilities are available . See
39
41
section 6, below, for a brief description - and also see the man pages and
40
42
the test cases.
41
43
@@ -205,6 +207,11 @@ Point the web browser of your choice to the resulting index.html file.
205
207
$ gcc -c file1.c file2.c ... --coverage
206
208
$ gcc -o myOtherTest --coverage file1.o file2.o ....
207
209
210
+ Alternately, LLVM users can use the 'profdata path' (rather than the
211
+ 'gcov path') to collect coverage data from their C/C++ code. See
212
+ https://github.com/linux-test-project/lcov/discussions/234 for more
213
+ information.
214
+
208
215
Run your testcase at least once:
209
216
210
217
$ path/to/my/testcase/myTest
@@ -213,11 +220,18 @@ Point the web browser of your choice to the resulting index.html file.
213
220
214
221
$ lcov --directory path/to/my/testcase --capture --output-file app.info
215
222
223
+ (LLVM users using the 'prodata path' will use a somewhat different
224
+ command for this step - see the discussion referenced above.)
225
+
216
226
If you want to collect Modified Condition / Decision Coverage (MD/DC)
217
227
date, then:
218
- - you must use gcc/14.2 or newer
219
- - your compile- and link command line must include flag
220
- '-fcondition-coverage'
228
+ - you must use gcc/14.2 (or newer), or LLVM/18 (or newer)
229
+ - your GCC compile- and link command line must include flag
230
+ '-fcondition-coverage'.
231
+ - LLVM users must use the 'prodata path' for coverage data collection,
232
+ and your compile command line must include
233
+ '-fprofile-inst-generate -fcoverage-mapping -fcoverage-mcdc'.
234
+ See the above referenced discussion for details.
221
235
- your lcov and genhtml command line must include flag
222
236
'--mcdc-coverage'
223
237
See the '--mcdc-coverage' section in the lcov and geninfo man pages.
@@ -374,8 +388,8 @@ LCOV features and capabilities fall into 7 major categories:
374
388
375
389
During coverage data capture, the --build-directory option can be used
376
390
to specify a search path, to find the .gcno (compile-time coverage data)
377
- file corresponding to a particular .gcda runtime coverage data) file.
378
- Similarly, the --source-directory pption can be used to specify a
391
+ file corresponding to a particular .gcda ( runtime coverage data) file.
392
+ Similarly, the --source-directory option can be used to specify a
379
393
search path for source files.
380
394
381
395
See the lcov/geninfo/genhtml man pages for a detailed description of
@@ -392,18 +406,19 @@ LCOV features and capabilities fall into 7 major categories:
392
406
393
407
i) interface with the revision control system
394
408
Sample scripts:
395
- - Perforce: see 'p4diff' and 'p4annotate'
396
- - Git: see 'gitdiff' and 'gitblame'
409
+ - Perforce: see 'p4diff', 'p4annotate.pm', 'p4annotate'
410
+ - Git: see 'gitdiff', 'gitblame.pm', 'gitblame'
397
411
ii) verify that source code versions are compatible, and
398
- Sample scripts: see 'get_signature', 'getp4version'
399
- and 'gitversion'
412
+ Sample scripts: see 'get_signature', 'P4version.pm', ' getp4version',
413
+ 'gitversion', 'gitversion.pm', and 'batchGitVersion.pm '
400
414
iii) enforce a desired code coverage criteria
401
- Sample script: criteria
415
+ Sample script: criteria.pm/criteria
402
416
iv) find source files in more complicated environments - where
403
417
simple substitutions become complicated or unweildy.
404
418
v) select a subset of coverage data to display - e.g., to
405
419
use in a code review which wants to concentrate on only
406
420
the changes caused by a particular commit or range of commits.
421
+ Sample script: select.pm
407
422
vi) keep track of environment and other settings - to aid
408
423
infrastructure debugging in more complicated use cases.
409
424
@@ -479,7 +494,7 @@ LCOV features and capabilities fall into 7 major categories:
479
494
translates XML coverage data to lcov format.
480
495
The XML data may come from Cobertura or similar tools.
481
496
482
- See "xml2lcov --help" fir brief instructions on how to use
497
+ See "xml2lcov --help" for brief instructions on how to use
483
498
the translator.
484
499
See the Coburtura documentation for directions on how to
485
500
generate XML data.
@@ -496,8 +511,8 @@ file. See the lcovrc man page for details.
496
511
-------------------------
497
512
See the included man pages for more information on how to use the LCOV tools.
498
513
499
- In case of further questions, feel free to open a new issue using the issue
500
- tracker on the LCOV code repository site at:
514
+ In case of further questions, feel free to open a new issue or discussion using
515
+ the issue tracker on the LCOV code repository site at:
501
516
502
517
https://github.com/linux-test-project/lcov
503
518
0 commit comments