Skip to content
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

Once again, code coverage #305

Merged
merged 7 commits into from
Mar 12, 2017
Merged

Once again, code coverage #305

merged 7 commits into from
Mar 12, 2017

Conversation

tezeb
Copy link
Contributor

@tezeb tezeb commented Mar 12, 2017

Previous pull request message is below. Test are run for all platforms, and coverage is measured on linux only.

We now have an ability to measure code coverage(stunning 2% right now ;)). This closes #298.

While the commit may seem a bit complicated at first, everything boils down to compilation with --coverage. Basically this have to be a new 'flavour' of build as coverage measurements is built into application as a shared library, so it's unusable for end-users. Due to the way make/qmake works, enabling/disabling coverage requires make distclean before changing flavour(ie. from release to coverage) so that all object files are rebuild(alternatively one can run make clean and qmake -r, which will update Makefiles).
There are 4 frontends for displaying code coverage added as make targets. Those are: gcov, lcov, codecov and coveralls. First two create code-coverage report locally, either as text-files(gcov, files are located in src/ with .gcov extension) or html report(lcov, located in src/lcov). The other two uploads code coverage to external services(respectively codecov and coveralls). Please note that codecov does not include files with no coverage(due to the bug in gcov), so the total coverage percentage is quite misleading.
In order to be able to see current code coverage:

  1. Start with clean repo
    $ make distclean
  2. Reconfigure qmake to create coverage build
    $ qmake CONFIG+=coverage qtpro.pro
  3. Build, run tests and create coverage report
    $ make lcov
  4. View report :)

Also from now, all tests can be run with make check.

Travis creates code-coverage report using linux build, as I don't know how to install required stuff(lcov, coveralls-lcov(this is ruby gem)) on osx. Build steps shall be the same.

@annejan annejan merged commit 6c6a579 into IJHack:master Mar 12, 2017
@tezeb
Copy link
Contributor Author

tezeb commented Mar 12, 2017

That's weird. I turned off comments, but the "Status API" was set up in coveralls so it should be displayed here. Does those checks(travis, linthub) required some additional configuration?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Measure unit-test code coverage
2 participants