Andy Jin(deleted)
06/21/2010 3:10 PM
post57331
|
Hi, Wim,
You are on the right track but there are still some minor setup issues.
Here is what I did to test your program.
1) Ceate an empty IDE C++ project called "coverage". This is to facility
the below steps. Note you need to pre-define the location of the source
file before you build the program because "gcc" writes the absolute path
of your source file to the output ".gcno" note file. You can't relocate
the source file after the build.
2) Build the program using command line "gcc".
3) The build creates the ".gcno" file. If you view it in IDE text editor
you should see the correct absolute path to your source file
4) Transfer the output program to remote target under "/tmp". Define the
two env vars "GCOV_PREFIX" and "GCOV_PREFIX_STRIP". Note the definition
of the env vars is optional - they allow you to relocate the ".gcda"
file. If you don't define them you still get the ".gcda" file in a
directory mirrored to your host setup as outlined in No. 1 above.
5) Run the program and copy the ".gcda" file to the host to the same
directory as where the ".gcno" file is. Note this is important to put
the two meta-data at the same directory as the IDE assumes they are
locate together (as you can see if you run the Code Coverage in IDE)
6) Use the IDE "import" wizard to import the Code Coverage data and
create a new session. I can see the correct coverage percentage (72.73%)
and can open the source file with the correct coverage annotations.
Try again to see if it works for you now.
As to your second question on how to save the report in HTML format with
links to the source files, unfortunately the IDE can only save the
report in xml format now and it does not preserve the links to the
sources (as discussed earlier in this thread). We can look into this as
a potential feature to add to the future release. For now here is a
work-around for you:
- In the IDE "Preferences -> General -> Web Browser" switch to "Use
external browser".
- In the IDE Code Coverage Sessions view, right click on the session and
select "Generate Report".
- IDE will open the external browser with the HTML report and links to
the source files.
- In the browser you can now save the report to your hard drive.
I use Mozilla Firefox and it works fine for me.
Hope this help, Thanks,
Andy
-----Original Message-----
From: Wim Hellenthal [mailto:community-noreply@qnx.com]
Sent: June 21, 2010 3:36 AM
To: general-toolchain
Subject: Re: Code Coverage
Hi Any,
I've attached the small example already used earlier during a previous
session we had. These are the step I take:
1) build the stuff on the win32 host (from the command line)
2) copy the executable from the obj dir and the .gcno file from the
source dir to the user home directory on the target.
3) Set the environment variables GCOV_PREFIX and GCOV_PREFIX_STRIP
(for some reason the stripping variable works now) such that the
resulting .gcno file shows up in the /var/coverage directory.
4) try to import the .gcda file into the IDE. This step fails. First of
all I need to define a project name. What if the project is not part of
the IDE environment which is the case for the small test program. I
choose an existing project that has nothing to do with the test program,
just to be able to continue with the import command. Anyway, when I
choose the directory where the .gcda file resides the tool pops up with
the window saying:
" No coverag file and/or coverage notes file found"
Has this something to do with the tool not being able to find the .gcno
file?
5) Wen I copy the gcda file to the host, into the same directory as
where the .gcno file resides, I can retrieve the coverage data with the
ntox86-gcov program. However I would like to use graphical interface
provided by Momentics.
Furthermore I would like to build a report file in html format with
links into the source files
|
|
|