Add a set of regression tests for common GCOV and LCOV workflows#147
Open
LAHumphreys wants to merge 3 commits intoeddyxu:masterfrom
Open
Add a set of regression tests for common GCOV and LCOV workflows#147LAHumphreys wants to merge 3 commits intoeddyxu:masterfrom
LAHumphreys wants to merge 3 commits intoeddyxu:masterfrom
Conversation
6908864 to
758b675
Compare
The existing test.bash script has been converted to a regression test
that:
- Verifies that in default mode (GCOV) we calcualte the correct
coverage for a simple c binary
- Verifies that in lcov mode we correctly parse the .info file for a
simple c binary
Additional tests can be created by copying the "test-src/simple"
directory and:
- Updating the source file & Makefile with the new test code
- Updating the expected.json with the expected coverage.
NOTE: If gcov and lcov provide different results, this can be
configured in the config.sh by specifying separate
expected.json files
- [optional] Providing a config.sh file in the directory to configure
optional flags. (See valid options listed at the top of
test-utils/testDir.sh)
- Adding the directory to test.bash
- Simple static library, which requires to .gcov files to be merged
in the GCOV workflow, and for multiple records to be merged in the
LCOV workflow
- Simple template library, which requires to .gcov files to be merged
in the GCOV workflow, and for multiple records to be merged in the
LCOV workflow
- Out of tree test, where --root is used to specify a separate source
directory as the base file path
- Missing files test - which ensures that files are reported as
missing, even if it hasn't been linked into any test
- File / directory exlcusion patterns (gcov only)
- File / directory explicit inclusions (gcov only)
Whilst investigating issues with dodgey coverage being reported to coveralls, it was found that the issue was dependent on the version of g++/gcov used. Extending the existing test suite to multiple gcc versions shows this up. The issue is that in version 8, gcov changed the format of its output, which makes the assumptions made in the current parser invalid. Tools such as LCOV have already migrated to use gcov's new JSON format to work around this issue. For now the affected tests are marked as known failure to prevent a failing build.
758b675 to
b4c120a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Over the past week I ran into a bunch of issues with incorrect coverage being reported - most of which ended up being my fault for failing to follow the instructions on the README and provide
--gcov-options '\-lp'.Originally thinking I was going to need a pull-request to make a change to cpp-coveralls I wrote a bunch of regression tests covering common lcov / gcov flows to validate my changes.
Whilst they're not comprehensive, I believe they'd add some value for anyone making a future functional enhancement - particularly as they're highlighting an issue with parsing the output of late gcov versions...
Is there any interesting in merging them into the main project?