1

I'm parsing the total.info file which is the result of running a few lcov commands on my source code in order to build a service that provides coverage information when needed. lcov also provides a nice html ui to browse code coverage. The problem is that i'm getting different values in terms of function coverage in my service than the html ui of lcov.

I'm calculating code coverage on end to end tests and not on unit tests.

Gcc version is 4.8.5 Red Hat

Lcov version is 1.14

The launched lcov commands are in the following order:

1- time lcov -c -i -d . --rc geninfo_adjust_src_path="{path} => " -o base.info

2- time lcov -c -d . --rc geninfo_adjust_src_path="{path} => " -o test.info

3- time lcov -rc geninfo_adjust_src_path="{path} => " -a base.info -a test.info -o total.info

To make it simpler here are 2 sections from the total.info file.

In this section, the parsing is working correctly There are 5 functions

TN:
SF:{path}/FileOne.hpp
FN:22,_methodName
FN:29,_methodName
FN:31,_methodName
FN:40,_methodName
FN:48,_methodName
FNDA:0,_methodName
FNDA:0,_methodName
FNDA:6,_methodName
FNDA:6,_methodName
FNDA:0,_methodName
FNF:5
FNH:2
DA:22,6
DA:29,12
DA:31,6
DA:33,24
DA:34,0
DA:35,6
DA:36,6
DA:40,0
DA:42,0
DA:43,0
DA:45,0
DA:48,0
DA:50,0
DA:51,0
DA:54,0
LF:15
LH:6
end_of_record

The parsing problems are happening in the section below as some functions appear to have duplicate FN statement (They all start at the same line, so I assume this is referring to the same function)

TN:
SF:{path}/FileTwo.hpp
FN:32,_methodName
FN:39,_methodName
FN:48,_methodName
FN:58,_methodName
FN:64,_methodName
FN:100,_methodName
FN:116,_methodName
FN:116,_methodName
FN:128,_methodName
FN:128,_methodName
FN:128,_methodName
FN:128,_methodName
FN:132,_methodName
FN:138,_methodName
FNDA:0,_methodName
FNDA:0,_methodName
FNDA:0,_methodName
FNDA:0,_methodName
FNDA:0,_methodName
FNDA:0,_methodName
FNDA:0,_methodName
FNDA:0,_methodName
FNDA:0,_methodName
FNDA:0,_methodName
FNDA:0,_methodName
FNDA:0,_methodName
FNDA:0,_methodName
FNDA:0,_methodName
FNF:14
FNH:0
DA:32,0
DA:33,0
DA:39,0
DA:40,0
DA:41,0
DA:44,0
DA:48,0
DA:49,0
DA:51,0
DA:52,0
DA:55,0
DA:56,0
DA:58,0
DA:59,0
DA:60,0
DA:61,0
DA:62,0
DA:64,0
DA:65,0
DA:66,0
DA:68,0
DA:91,0
DA:92,0
DA:96,0
DA:97,0
DA:100,0
DA:101,0
DA:102,0
DA:104,0
DA:105,0
DA:106,0
DA:112,0
DA:116,0
DA:117,0
DA:118,0
DA:121,0
DA:122,0
DA:125,0
DA:128,0
DA:129,0
DA:130,0
DA:132,0
DA:133,0
DA:134,0
DA:135,0
DA:138,0
DA:139,0
DA:140,0
DA:141,0
DA:142,0
DA:145,0
LF:51
LH:0
end_of_record

At lines 116 & 128, the functions are as follows:

     115             :    template <typename UnaryOp>
     116           0 :    void remove_if(UnaryOp op) {
     117           0 :       for (typename Items::iterator it = m_items.begin(), end = m_items.end(); it != end;) {
     118           0 :          if (!op(*it))
     119             :             ++it;
     120             :          else {
     121           0 :             shutItem(*it);
     122           0 :             m_items.erase(it++);
     123             :          }
     124             :       }
     125           0 :    }

     127             :    template <typename Op>
     128           0 :    void for_each(Op &op) {
     129           0 :       std::for_each(m_items.begin(), m_items.end(), op);
     130           0 :    }

My question is why are some functions appearing multiple times (who's "FN:{}" start at the same line)?

Community
  • 1
  • 1
  • What _exactly_ are you running? – einpoklum Mar 14 '20 at 22:09
  • 1- time lcov -c -i -d . --rc geninfo_adjust_src_path="{path} => " -o base.info 2- time lcov -c -d . --rc geninfo_adjust_src_path="{path} => " -o test.info 3- time lcov -rc geninfo_adjust_src_path="{path} => " -a base.info -a test.info -o total.info – Nader Kahwaji Mar 15 '20 at 00:26
  • @einpoklum hello, i’ve added the commands that I’ve launched – Nader Kahwaji Mar 15 '20 at 10:21
  • I don't have any experience with lcov personally, I just noticed the first post and commented to help you improve it. Sorry... – einpoklum Mar 15 '20 at 11:07

0 Answers0