Bcov coverage rate statistics

Source: Internet
Author: User
Tags gcov

Kcov is implemented on the basis of bcov, which has not been maintained for a long time;

First, download the dependent library libdwraft and specify it in configure:

./Configure -- With-libdwarf =/usr/local/lib

Then make; make install

(1) Sadly, errors occurred during compilation.

'Ptrace _ o_traceclone 'was not declared in this scope

Add a header file <sys/ptrace>

At the same time, the place where ptrace is called is forced type conversion, for example, the original is

Ptrace (ptrace_getregs, activechild, 0, & regs );

Then change

Ptrace (_ ptrace_request) ptrace_getregs, activechild, 0, & regs );

Compilation is successful;

(2) You can use it after installation. You need to add the-G parameter to the source program compilation; otherwise, no information is collected.

g++ t.cpp -O0 -g

 

Use bcov to start the program:

bcov ./a.out  & 

  

Startup will display

probing debug information...found active lines in 1 source filesset 11 breakpoints

Then killall

killall -9 a.out 

Display

program terminatedcoverage info written to .bcovdump

  

In this case, the coverage file. bcovdump is generated

bcov-report ./.bcovdump ~/httpd/htdocs/bcov-report.DhblLi

View:

 

 

Statistical analysis of service-type test coverage compared with gcov

(1) bcov does not need to add compilation parameters and connection parameters, but needs to add the-G option;

(2) gcov needs to set environment variables during startup, while bcov needs to use the bcov command to start the program under test;

(3) Merge multiple files. We can see that the bcov output file is. bcovdump is a bunch of numbers and it seems easier to edit.:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.