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 a set of regression tests for common GCOV and LCOV workflows #147

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

LAHumphreys
Copy link

@LAHumphreys LAHumphreys commented Oct 26, 2019

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?

@LAHumphreys LAHumphreys force-pushed the ProposedRegressionsTests branch from 6908864 to 758b675 Compare October 28, 2019 12:06
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.
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.

1 participant