Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - How to start code coverage using command line options?: (5 Items)
   
How to start code coverage using command line options?  
Hello, 

I have an executable built with code coverage enabled in it. If I launch this executable from the QNX IDE's code 
coverage perspective, then I can see that code coverage data is being collected in my target (i.e. there are few *.da 
files that get created). 

However, if I run the executable using command line, then I dont see any *.da files being created. This should mean that
 the code coverage data is not being collected (correct me if I am wrong). 

What are the command line options that I must provide to start code coverage? I need this info so that I can make use of
 code coverage in my project.

Thanks 
Sunil
Re: How to start code coverage using command line options?  
Sunil Keshava wrote:
> Hello, 
> 
> I have an executable built with code coverage enabled in it. If I launch this executable from the QNX IDE's code 
coverage perspective, then I can see that code coverage data is being collected in my target (i.e. there are few *.da 
files that get created). 
> 
> However, if I run the executable using command line, then I dont see any *.da files being created. This should mean 
that the code coverage data is not being collected (correct me if I am wrong). 
> 
> What are the command line options that I must provide to start code coverage? I need this info so that I can make use 
of code coverage in my project.

You need to compile with -ftest-coverage -fprofile-arcs.

For example:

$ qcc -ftest-coverage -fprofile-arcs hw.c
$  ./a.out
hello world
$ ls hw.da
hw.da

Regards,

Ryan Mansfield
Re: How to start code coverage using command line options?  
Thanks for the information Ryan.

But as I said in my post, I have already built my executable with the necessary code coverage changes made to the make 
files, i.e. ftest-coverage -fprofile-arcs is being used during compilation.

But when I run the executable on my target, I do not see any files created on my target which indicate the code coverage
 information is being collected (no *.da files are being created).

I am wondering if some kind of arguments have be specified when I run the executable so that the OS knows that code 
coverage information needs to captured.

Also please note that, if I launch the executable using the Code coverage perspective in the IDE, then I am able to see 
code coverage info being captured. I am interested in seeing the code coverage info without having to use the IDE as a 
launcher.

I hope I am more clear now. Please let me know if you need any other information to understand/solve my problem.

Thanks
Sunil
Re: How to start code coverage using command line options?  
Sunil Keshava wrote:
> I am wondering if some kind of arguments have be specified when I run the executable so that the OS knows that code 
coverage information needs to captured.

As my example shows no options or arguments have to be specified when 
running the executable for the code coverage information to be generated.

Does your program exit? Are you able to try a simple test like my 
example? Are you using gcc 2.95.3 or 3.3.5? Can you provide an example?

Regards,

Ryan Mansfield
Re: How to start code coverage using command line options?  
I have not tried your example, let me try that and see how it goes. May be that will give some info which might help me 
with my program.

Will get back to you soon.

Sunil