-
Notifications
You must be signed in to change notification settings - Fork 17
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
Possibility to merge results from several test binaries? #17
Comments
Hello, I am a bit unsure what you mean exactly, is this a public project I can look at maybe? But I mean you can have any number of test binaries, that is not what matters. You add each in CMake using the add_test cmake command. https://github.com/JoakimSoderberg/coveralls-cmake-example/blob/master/CMakeLists.txt#L37 Then when the coverage is calculated, cmake will run each executable in turn and calculate the coverage and all that should be gathered in the output. I mean this is how my Cmake script runs the actual tests: coveralls-cmake/cmake/Coveralls.cmake Line 68 in 3717770
Which is just a fancy way to run https://cmake.org/Wiki/CMake/Testing_With_CTest CTest is a test runner which is independent from CMake itself... it will simply take a bunch of tests and run them. It does not care how many executables there are, it just has a list of tests
What step 3 above cares about is not the executables, but the source files you want the coverage from (you specify these as per the instructions for this project in your CMake file). Hope all that made sense :) P.S. I'd also recommend looking into https://codecov.io/ it's also free. And from my experience more stable + has more features. And is simpler to use :) |
Oh yea, this does the meat of the collection business. As you see there, all it does is look for gcov files, nothing related to specific test executables. |
Hi there, thanks for the quick response! The project is nlohmann/json, and I added a feature branch (see https://github.com/nlohmann/json/tree/feature/cmake_cleanup) to move the build system to Cmake. See https://travis-ci.org/nlohmann/json/jobs/186321152 for the Travis job. It uses the same C++ sources than the 100% covered develop-branch (see https://coveralls.io/builds/9376166), but instead of having one large binary, the test suite is split into several binaries. All are added via If you need any further information, please let me know. I shall try not to run any tests before executing |
You forgot the important part. The coveralls that does not have 100% coverage :) Because what is interesting is the build output: Anyway if you look in that output you see that GCOV is rewriting teh
Your last test happens to cover 83.45% of the file, and that's what ends up on coveralls. I cannot say I have noticed this behavior myself, but maybe I never ran this with multiple test EXEs come to think of it. Or... your gcov version is old and does So just quickly googling I found this thread from 2007 about fixing this behavior.
The
So this might depend on the I can't say I know the reason for this. If it's at the Codecov also supports pushing multiple reports for a single commit. Even from different OS versions and so on, as I said it has more features and is simpler to use. So look at that as an alternative. Here is how easy it is to include. Since my cmake script has compiled + generated all coverage files it simply finds those and does a bunch of magic. So try that and see if it solves your issues: I am not really enough invested in this script to hunt down this bug. But if you can fix this a Pull Request is always welcome :) |
Thanks for the response! |
Solves issue where coverage results overwrote each other. Fixes JoakimSoderberg#17
Solves issue where coverage results overwrote each other. Fixes JoakimSoderberg#17
I have a test suite of multiple test binaries. The cmake files work so far, but they only seem to determine the coverage of one (first or last) test binary. Is there a way to merge the coverage results from multiple tests?
The text was updated successfully, but these errors were encountered: