SourceForge has been redesigned. Learn more.
Close

#9 lcov: source files matching during *.info files creation

open
nobody
Tools (6)
5
2012-08-02
2012-08-02
No

Hi

geninfo iterates in the following loop over all files generated by gcov:
foreach $gcov_file (sort(@gcov_list))
{
my $i;
my $num;

($source, $object) = read_gcov_header($gcov_file);
if (defined($source))
{
$source = solve_relative_path($base_dir, $source);

It would be nice if geninfo would have an option to ignore $source that does not match certain file name pattern, i.e. if the next line would be something like
next unless matches_requested_filename_patterns($source)

This obvoiusly work similar quite to --extract option of lcov, but I belive it would result in a big performance improvement, as gcov tends to generate lots of useless (from our point of view) files containg coverage data for system or external library headers. Then geninfo reads all the files, and wastes time and processor cycles to generate huge info file, most of which will be removed by lcov --extract. For a big C++ project the whole process of generating unit test coverage data takes several hours. I hope using the proposed approach will reduce the time significantly.
The simillar thing can be done for reading gcno files for gathering initial coverage data.

I can try to create a patch, if you are interested in.

Thanks a lot,
robert

Discussion

  • Robert Luberda

    Robert Luberda - 2012-08-03

    I've just discovered that new --source-prefix and --relative-only options has been introduced in gcov 4.7 (see http://gcc.gnu.org/onlinedocs/gcc/Invoking-Gcov.html#Invoking-Gcov\). This would suffer my needs, unfortunatelly I don't think we can migrate to gcc 4.7 in predictable future at work :(
    So my suggestion is: add those to options to lcov and geninfo. Then pass them to gcov if gcov supports them or simulate theirs behaviour in geninfo otherwise. Would it make sense to you?

    Regards,
    robert

     
  • Peter Oberparleiter

    Please give option --no-external a try. This option was introduced with the new (as of yet unreleased) version of lcov that can be found in the lcov CVS. It instructs lcov to ignore data for files which are not part of the main source directory.

     

Log in to post a comment.