Andy Pekarske
|
Code Coverage doesn't seem right
|
Andy Pekarske
02/21/2008 5:18 PM
post5194
|
Code Coverage doesn't seem right
I have the following piece of code that when compiled with code coverage turned on and run on the target it displays
this coverage in the Momentics Code Coverage perspective. Green is covered, red is not.
green 175 if (-1 != scp->write_fd) {
red 176 close(scp->write_fd);
green 177 scp->write_fd = -1;
red 178 }
I don't see how it is possible to be green for one line inside an if statement, and red for another (line 177 and line
176). I have the build setup as debug and added the -g option to both the compile and link stage. Any ideas why else
my coverage would show up screwy?
|
|
|
Adam Mallory
|
RE: Code Coverage doesn't seem right
|
Adam Mallory
02/21/2008 6:40 PM
post5195
|
RE: Code Coverage doesn't seem right
Andy Pekarske wrote:
> I have the following piece of code that when compiled with
> code coverage turned on and run on the target it displays
> this coverage in the Momentics Code Coverage perspective. Green is
> covered, red is not.
>
> green 175 if (-1 != scp->write_fd) {
> red 176 close(scp->write_fd);
> green 177 scp->write_fd = -1;
> red 178 }
>
>
> I don't see how it is possible to be green for one line
> inside an if statement, and red for another (line 177 and
> line 176). I have the build setup as debug and added the -g
> option to both the compile and link stage. Any ideas why
> else my coverage would show up screwy?
Optimization level can be a problem. Code paths can be refactored, moved
around and even eliminated which can throw off the debug information
co-relation. Try building -O0 with -g and see if that helps.
Cheers,
Adam
QNX Software Systems Ltd.
[ amallory@qnx.com ]
---------------------------------------------------
With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
--Peter J. Schoenster
|
|
|
Andy Pekarske
|
Re: RE: Code Coverage doesn't seem right
|
Andy Pekarske
02/22/2008 10:42 AM
post5209
|
Re: RE: Code Coverage doesn't seem right
I am linking in libraries in this application as well and maybe they have to be compiled with code coverage turned on as
well. The -O0 option didn't seem to change the results.
Thanks for the reply though!
|
|
|
Adam Mallory
|
RE: RE: Code Coverage doesn't seem right
|
Adam Mallory
02/22/2008 10:48 AM
post5210
|
RE: RE: Code Coverage doesn't seem right
If the code snipet you're showing is from the library, then I would agree.
If it's a function from the same compilation unit that is build -O0 -g, then
I'm not sure why the debug info doesn't line up.
Any chance you can post a test case?
--
Cheers,
Adam
QNX Software Systems
[ amallory@harman.com ]
---------------------------------------------------
With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
--Peter J. Schoenster
> -----Original Message-----
> From: Andy Pekarske [mailto:apekarske@zebra.com]
> Sent: Friday, February 22, 2008 10:42 AM
> To: general-toolchain
> Subject: Re: RE: Code Coverage doesn't seem right
>
> I am linking in libraries in this application as well and maybe they have
> to be compiled with code coverage turned on as well. The -O0 option
> didn't seem to change the results.
>
> Thanks for the reply though!
>
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post5209
|
|
|
Mike Zinni
|
Re: RE: RE: Code Coverage doesn't seem right
|
Mike Zinni
02/29/2008 9:16 AM
post5399
|
Re: RE: RE: Code Coverage doesn't seem right
Adam -
I'm working with Andy to get test coverage data on some of our new QNX code, so I figured I'd touch base with you here.
We're still running into this issue and could use some help. Unfortunately, we can't post our production code to the
forum, but I've created a sample workspace that exhibits the same behavior.
The ZIP file containing the workspace (and 2 projects) is about 2MB. What's the best way to get this to you?
Thanks,
Mike Zinni
|
|
|
Alex Chapiro
|
Re: RE: RE: Code Coverage doesn't seem right
|
Alex Chapiro
02/29/2008 10:01 AM
post5404
|
Re: RE: RE: Code Coverage doesn't seem right
You can use mail attachment. Send it to my account achapiro@qnx.com. Please change extension of archive to something
neutral.
Alex
|
|
|
Mike Zinni
|
Re: RE: RE: Code Coverage doesn't seem right
|
Mike Zinni
02/29/2008 10:38 AM
post5411
|
Re: RE: RE: Code Coverage doesn't seem right
Thanks for the reply Alex. I'll be sending you an email shortly with my sample workspace attached...
Mike
|
|
|
Alex Chapiro
|
Re: Code Coverage doesn't seem right
|
Alex Chapiro
03/11/2008 2:41 PM
post5703
|
Re: Code Coverage doesn't seem right
Sorry for delay, at last I can arrange some time to investigate this
issue. Do you still need it?
Best regards,
Alex
Mike Zinni wrote:
>
> Thanks for the reply Alex. I'll be sending you an email shortly with
> my sample workspace attached...
>
> Mike
>
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post5411
>
|
|
|
Mike Zinni
|
RE: Code Coverage doesn't seem right
|
Mike Zinni
03/11/2008 3:00 PM
post5705
|
RE: Code Coverage doesn't seem right
Yea, definitely still interested in what's going on here...
Thanks!
Mike
-----Original Message-----
From: Alex Chapiro [mailto:achapiro@qnx.com]
Sent: Tuesday, March 11, 2008 2:41 PM
To: general-toolchain
Subject: Re: Code Coverage doesn't seem right
Sorry for delay, at last I can arrange some time to investigate this
issue. Do you still need it?
Best regards,
Alex
Mike Zinni wrote:
>
> Thanks for the reply Alex. I'll be sending you an email shortly with
> my sample workspace attached...
>
> Mike
>
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post5411
>
_______________________________________________
General
http://community.qnx.com/sf/go/post5703
- CONFIDENTIAL-
This email and any files transmitted with it are confidential, and may also be legally privileged. If you are not the
intended recipient, you may not review, use, copy, or distribute this message. If you receive this email in error,
please notify the sender immediately by reply email and then delete this email.
|
|
|
Alex Chapiro
|
Re: RE: Code Coverage doesn't seem right
|
Alex Chapiro
03/12/2008 4:15 PM
post5746
|
Re: RE: Code Coverage doesn't seem right
I built your test case on 4.2.1 and ran code coverage session using the latest code. I attached result to this post
(just a screen shot). Do these results make sense?
|
|
|
Mike Zinni
|
RE: RE: Code Coverage doesn't seem right
|
Mike Zinni
03/12/2008 4:37 PM
post5747
|
RE: RE: Code Coverage doesn't seem right
These numbers certainly look better, although I'm not sure they're
completely accurate.
I'm still curious why the constructor and destructor have "uncovered"
code in them, even though I know they're being called. It's contributing
to the coverage number for the Rectangle.cpp file being too low (55%).
From the looks of things, the only function not called is
Rectangle::getWidth(), which should yield a higher coverage number for
the whole file (maybe 80% or so)...
Thanks!
Mike
-----Original Message-----
From: Alex Chapiro [mailto:achapiro@qnx.com]
Sent: Wednesday, March 12, 2008 4:16 PM
To: general-toolchain
Subject: Re: RE: Code Coverage doesn't seem right
I built your test case on 4.2.1 and ran code coverage session using the
latest code. I attached result to this post (just a screen shot). Do
these results make sense?
_______________________________________________
General
http://community.qnx.com/sf/go/post5746
- CONFIDENTIAL-
This email and any files transmitted with it are confidential, and may also be legally privileged. If you are not the
intended recipient, you may not review, use, copy, or distribute this message. If you receive this email in error,
please notify the sender immediately by reply email and then delete this email.
|
|
|
Alex Chapiro
|
Re: Code Coverage doesn't seem right
|
Alex Chapiro
03/13/2008 1:10 PM
post5787
|
Re: Code Coverage doesn't seem right
Yes, I agree, numbers still don't look credible for C++ programs (not
always, I'd like to say:-). I'm working on fixing this problem and hope
next integration build will bring essential improvement
Mike Zinni wrote:
>
> These numbers certainly look better, although I'm not sure they're
> completely accurate.
>
> I'm still curious why the constructor and destructor have "uncovered"
> code in them, even though I know they're being called. It's contributing
> to the coverage number for the Rectangle.cpp file being too low (55%).
> From the looks of things, the only function not called is
> Rectangle::getWidth(), which should yield a higher coverage number for
> the whole file (maybe 80% or so)...
>
> Thanks!
>
> Mike
>
> -----Original Message-----
> From: Alex Chapiro [mailto:achapiro@qnx.com]
> Sent: Wednesday, March 12, 2008 4:16 PM
> To: general-toolchain
> Subject: Re: RE: Code Coverage doesn't seem right
>
> I built your test case on 4.2.1 and ran code coverage session using the
> latest code. I attached result to this post (just a screen shot). Do
> these results make sense?
>
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post5746
>
> - CONFIDENTIAL-
> This email and any files transmitted with it are confidential, and may
> also be legally privileged. If you are not the intended recipient,
> you may not review, use, copy, or distribute this message. If you
> receive this email in error, please notify the sender immediately by
> reply email and then delete this email.
>
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post5747
>
|
|
|
|