New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding test coverage #705
Adding test coverage #705
Conversation
* Using gcov and lcov to calculate test coverage * Added as cmake cmake option BUILD_WITH_COVERAGE * Added cmake target mlpack_coverage
Adding coverage results of my latest run. Line coverage: 88.9%, functional coverage: 93.3% |
Interesting idea, I'm not sure if this works, however, do you think we could use coveralls.io for this. I think that would make things a lot easier and probably less complex. It basically comes down to:
|
I have improved the coverage to accommodate the inline functions. @zoq Yes coveralls.io is a good idea but I thought its just for posting coverage. But I will take a look at it. Adding improved coverage - the values have decreased a little but the coverage calculation is improved :) |
I found this on coveralls.io documentation for C/C++ code. https://github.com/eddyxu/cpp-coveralls . It also suggests gcov for coverage calculation. |
So, we could build with |
I think cpp-coveralls script is for uploading the result to the coveralls server. Their instructions says -
|
@zoq Ohh I looked more into cpp-coveralls. I was wrong. It also runs gcov internally and uploads. So we need to build library with gcov support and run coveralls. But I think we also should keep the mlpack_coverage script, so as to generate the report locally. Coveralls with dryrun only generates .gcov files, the visual view is only available online, but there might be a situation where we need to see the results locally. Currently I am trying to configure cpp-coveralls for mlpack. |
…with BinarizeTest.
* lcov will be used for local coverage computation.
236ea07
to
3d34028
Compare
Changes Unknown when pulling 3d34028 on sumedhghaisas:test_coverage into * on mlpack:master*. |
b452aa1
to
d8da0a2
Compare
Hm, I like this idea, it could be nice to add. It seems to me like it should not be necessary to keep the It looks like coveralls is not displaying correct results quite yet, I will take another look and dig around when that is working. :) |
- sudo apt-get install lcov | ||
- sudo apt-get install ruby | ||
- sudo gem install coveralls-lcov | ||
- printf "Y\n" > apt_input.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line shouldn't be necessary anymore. :) You can also use apt-get -y
if you need, or even yes | apt-get install ...
.
Another thought is, we can set up a Jenkins job specifically to do coverage testing, to avoid making Travis do too much. Compiling with debugging symbols will make the tests take longer and might put us over the 1hr time limit. But there is no limit for Jenkins, so we can just run on Jenkins and submit those results to coveralls.io, I think. I am not 100% clear on how the service works at this time. |
Currently the problem is with gcov version. Gcc 4.8 does not work with gcov 4.6. I am trying to upgrade the gcov version. The problem with cpp-coveralls is, it is not getting the header file coverage correct. I don;t know if its a known issue. I also looked at the shogun coverage, as they also use cpp-coveralls. It seems they are just ignoring the header files. I don;t think thats a good idea. Its better to use mlpack_coverage.sh with coveralls-lcov which can upload the lcov info file to coveralls. I like the jenkins idea, but there is no harm in keeping mlpack_coverage in cmake configuration. Its not for users but for developers, like a developer can test the coverage for his specific module before sending in the PR. |
4a616a0
to
92c63e9
Compare
Changes Unknown when pulling 92c63e9 on sumedhghaisas:test_coverage into * on mlpack:master*. |
86b840d
to
e682b52
Compare
The test coverage is not complete though the basic framework is ready.
Completed things are -
TODO list:
Opening this pull request for discussion.