Comments (5)
I use Bullseye Code Coverage http://www.bullseye.com/ with Unity and
it works fine. My script to run the unit tests does the following:
- set the COVFILE so I know where the coverage data is:
export COVFILE=/tmp/test.cov - set the COVDIR directory so I know where my reports will go
export COVDIR=coverage - turn on the code coverage compiler
cov01 --on - select which files I want (and don't want) in the code coverage report
covselect --no-banner -a !test/
... - build and run the unit tests
rake - turn off the code coverage compiler
cov01 --off - generate various coverage reports (by directory, by function, by
file, index of all of the above, and an XSL file for easy data
crunching)
covhtml --no-banner $COVDIR
covdir -v --no-banner --html -o $COVDIR/directory_coverage.html
covfn -v --no-banner --html -s -o $COVDIR/function_coverage.html
covsrc -v --no-banner --html -o $COVDIR/file_coverage.html
covxml --no-banner --xsl -o $COVDIR/coverage.xml
This doesn't require the code to be instrumented manually. Bullseye
replaces the calls to the compiler with their tool which automatically
instruments the code and then calls the original compiler. When the
program is run, the instrumentation dumps the results into the file
given by COVFILE. Later when the reports are generated, they read the
same file to get the data. This is similar to how Coverity works.
Bullseye supports all the mainstream compilers and many embedded ones
and it runs on Linux, UNIX (and derivatives), and Mac OS X. The product
works great. The only downside is the cost and the fact that you have to
purchase a license for each target OS you need to run it on. Their tech
support is good too.
If Bullseye is too expensive for you or you refuse to use something
which isn't open source, you can look into gcov
http://gcc.gnu.org/onlinedocs/gcc/Gcov-Intro.html#Gcov-Intro. Of
course, it only works with gcc. It also isn't as full featured.
Note that ceedling already has plugins for /gcov/ and for /bullseye/.
Look in the /plugins/ directory. Unfortunately, they aren't documented
very well so you pretty much need to understand ceedling and read
through the source of the plugins to figure out how to use them. Look
at issue #3 ThrowTheSwitch/Ceedling#3 for
some info on how to setup the Bullseye plugin.
Christopher Voltz mailto:[email protected], Master Engineer
HP http://www.hp.com, ISS Storage, Linux and VMware Driver Development
voice: 281-514-8369
On 06/04/2013 01:44 PM, Alex Rod wrote:
After working with unity for a while I am seeing that some of my test
are not covering all the cases that I should. So this request is to
include some sort of code coverage infrastructure in Untiy.I don't have any specifics about how to implement this feature, but
what I have seem in the web --wikipedia mainly, by searching for code
coverage-- is some sort of file transformation on the fly to get an
instrumented version of the file that you want to analyze, then run
through your unit test harness, or some sort of this variation.—
Reply to this email directly or view it on GitHub
#40.
from unity.
Spot on
On 4 Jun 2013, at 20:23, Christopher Voltz wrote:
I use Bullseye Code Coverage http://www.bullseye.com/ with Unity and
it works fine. My script to run the unit tests does the following:
- set the COVFILE so I know where the coverage data is:
export COVFILE=/tmp/test.cov- set the COVDIR directory so I know where my reports will go
export COVDIR=coverage- turn on the code coverage compiler
cov01 --on- select which files I want (and don't want) in the code coverage report
covselect --no-banner -a !test/
...- build and run the unit tests
rake- turn off the code coverage compiler
cov01 --off- generate various coverage reports (by directory, by function, by
file, index of all of the above, and an XSL file for easy data
crunching)
covhtml --no-banner $COVDIR
covdir -v --no-banner --html -o $COVDIR/directory_coverage.html
covfn -v --no-banner --html -s -o $COVDIR/function_coverage.html
covsrc -v --no-banner --html -o $COVDIR/file_coverage.html
covxml --no-banner --xsl -o $COVDIR/coverage.xmlThis doesn't require the code to be instrumented manually. Bullseye
replaces the calls to the compiler with their tool which automatically
instruments the code and then calls the original compiler. When the
program is run, the instrumentation dumps the results into the file
given by COVFILE. Later when the reports are generated, they read the
same file to get the data. This is similar to how Coverity works.
Bullseye supports all the mainstream compilers and many embedded ones
and it runs on Linux, UNIX (and derivatives), and Mac OS X. The product
works great. The only downside is the cost and the fact that you have to
purchase a license for each target OS you need to run it on. Their tech
support is good too.If Bullseye is too expensive for you or you refuse to use something
which isn't open source, you can look into gcov
http://gcc.gnu.org/onlinedocs/gcc/Gcov-Intro.html#Gcov-Intro. Of
course, it only works with gcc. It also isn't as full featured.Note that ceedling already has plugins for /gcov/ and for /bullseye/.
Look in the /plugins/ directory. Unfortunately, they aren't documented
very well so you pretty much need to understand ceedling and read
through the source of the plugins to figure out how to use them. Look
at issue #3 ThrowTheSwitch/Ceedling#3 for
some info on how to setup the Bullseye plugin.Christopher Voltz mailto:[email protected], Master Engineer
HP http://www.hp.com, ISS Storage, Linux and VMware Driver Development
voice: 281-514-8369On 06/04/2013 01:44 PM, Alex Rod wrote:
After working with unity for a while I am seeing that some of my test
are not covering all the cases that I should. So this request is to
include some sort of code coverage infrastructure in Untiy.I don't have any specifics about how to implement this feature, but
what I have seem in the web --wikipedia mainly, by searching for code
coverage-- is some sort of file transformation on the fly to get an
instrumented version of the file that you want to analyze, then run
through your unit test harness, or some sort of this variation.—
Reply to this email directly or view it on GitHub
#40.—
Reply to this email directly or view it on GitHub.
from unity.
Yeap, I have looked at several tools, including the one mentioned above ( bullseye ) and cvtool. Pretty much the description provided by Chris is what I have understood about them and the workflow is similar to what I was thinking as a good implementation for it. Also a good reading is the "C unit testing on a shoestring" whitepaper from Ark Khasin.
The intention of this Open item is to highlight the need of such tool embedded in the Unity framework if possible. But also based in Chris comments I will look deeper into bullseye and evaluate it.
from unity.
Existing code invokes cov01 commands through ant. Now I have to exclude few files. covselect is throwing the following error. Could someone provide pointers on this?
error: unknown option "--add \!**/filename.extn1.*/"
//Trying to exclude files with name "filename.extn1.*" in any folder
<exec failonerror="false" failifexecutionfails="false" executable="covselect">
<arg value="--add \!**/filename.extn1.*/"/>
</exec>
//Enabling the coverage
<exec failonerror="false" failifexecutionfails="false" executable="cov01">
<arg value="-1" />
</exec>
//Building the files
....
//Disabling the coverage
<exec failonerror="false" failifexecutionfails="false" executable="cov01">
<arg value="-0" />
</exec>
from unity.
Since the original issue was closed 3 years ago, it would probably be best if your new request was created as a new issue.
from unity.
Related Issues (20)
- mistakenly opened issue
- closed HOT 1
- Issue with comparing the streams. HOT 2
- Possibly typo in test_unity_integers_64.c and test_unity_arrays.c HOT 1
- Avoid running the setup for some specific tests HOT 3
- #529 still unfixed after merge HOT 2
- PlatformIO failing to parse manifest on install.
- Game thing.com HOT 1
- How do I rename the `setUp` and `tearDown` functions? HOT 2
- Build fails with -Werror=missing-declarations when UNITY_USE_COMMAND_LINE_ARGS is enabled HOT 1
- XML/JSON based report generating? HOT 2
- Errr how u use this HOT 1
- Can you code on iPad using this app?
- I'm in secondary school first grade sooo i have no idea what I'm doing (I'm trying to tell but not expose my age) HOT 1
- Can you use this app to code on iPad?
- ssize_t asserts are missing
- Add Example for Testing using CMake
- Build fails when not using UNITY_USE_COMMAND_LINE_ARGS
- Feature Request: Support asymmetric range assertions HOT 2
- Some codes failed `-Werror=float-equal` compiler flag, please fix it.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unity.