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

Add support for generating coverage statistics for tests #1712

Closed
wants to merge 3 commits into from

Conversation

nyalldawson
Copy link
Collaborator

Build option ENABLE_COVERAGE must be set. There's also a secondary
option GENERATE_COVERAGE_DOCS which requires lcov and will generate
html docs of unit test coverage.

To generate coverage, first enable the cmake options, then build
QGIS. From the build directory, run "make qgis_coverage".

You can also add command line arguments to "make qgis_coverage" which
are forwarded on to ctest. This allows for skipping failing tests
which prevent generation of coverage docs. This is done by adding
the command line argument CMD_ARGS= to the "make qgis_coverage"
command. Eg,

make qgis_coverage CMD_ARGS="-E "PalLabeling|LocalServer|AppStartup"

will skip tests which match the listed expressions.

@m-kuhn
Copy link
Member

m-kuhn commented Dec 1, 2014

Is this only for local usage or is this supposed to be used by nightlies/ci?
What are the current results?

@nyalldawson
Copy link
Collaborator Author

@m-kuhn either I guess, but ideally it would be included in Travis builds and published automatically to a dashboard (orfeo? Coveralls?). From what I read this setup should be safe to use with clang builds too.

It works really well locally, and I think it will be valuable for directing testing efforts. Especially if it gets integrated with Travis so that we can see coverage of pull requests prior to merging...

Build option ENABLE_COVERAGE must be set. There's also a secondary
option GENERATE_COVERAGE_DOCS which requires lcov and will generate
html docs of unit test coverage.

To generate coverage, first enable the cmake options, then build
QGIS. From the build directory, run "make qgis_coverage".

You can also add command line arguments to "make qgis_coverage" which
are forwarded on to ctest. This allows for skipping failing tests
which prevent generation of coverage docs. This is done by adding
the command line argument CMD_ARGS= to the "make qgis_coverage"
command. Eg,

make qgis_coverage CMD_ARGS="-E \"PalLabeling|LocalServer|AppStartup\"

will skip tests which match the listed expressions.
@nyalldawson
Copy link
Collaborator Author

@m-kuhn Here's a sample of the output: http://nyalldawson.net/qgis/coverage/

# whether coverage tests should be performed
SET (ENABLE_COVERAGE FALSE CACHE BOOL "Perform coverage tests?")

# whether coverage tests should be performed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment should probably be adjusted?

@m-kuhn
Copy link
Member

m-kuhn commented Dec 3, 2014

It's all opt-in, so it shouldn't break anything. Good to merge I'd say.

You included the cmake module for clang support, right?
I think in the long run it will be good to resort to the cmake integrated coverager style to keep maintenance effort lower.

@nyalldawson
Copy link
Collaborator Author

Manually merged in a435441 . I'll keep refining this in an attempt to get automated generation working with Travis.

@nyalldawson nyalldawson closed this Dec 3, 2014
@nyalldawson nyalldawson deleted the coverage branch January 8, 2021 21:36
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.

2 participants