Skip to content

Hook up Codecov for coverage reporting on C code #2

Description

@brettcannon

See https://github.com/brettcannon/cpython-ci-test/blob/master/codecov.yml for an initial configuration (only differs from the default thanks to the new config for comments).

Activity

  1. tiran commented on Dec 10, 2016

    @tiran
    Member

    I have been running lcov regularly. gcov / lcov coverage of C code is a bit tricky for some modules. Some tests require a real terminal (ncurses), X server (tkinter, idle), root privileges (spwd) or special system configuration (yp for nis). The make coverage-lcov target ignores coverage of 3rd party code, too.

            @ # remove 3rd party modules, system headers and internal files with
            @ # debug, test or dummy functions.
            @lcov --remove $(COVERAGE_INFO) \
                '*/Modules/_blake2/impl/*' \
                '*/Modules/_ctypes/libffi*/*' \
                '*/Modules/_decimal/libmpdec/*' \
                '*/Modules/_sha3/kcp/*' \
                '*/Modules/expat/*' \
                '*/Modules/zlib/*' \
                '*/Include/*' \
                '*/Modules/xx*.c' \
                '*/Parser/listnode.c' \
                '*/Python/pyfpe.c' \
                '*/Python/pystrcmp.c' \
                '/usr/include/*' \
                '/usr/local/include/*' \
                '/usr/lib/gcc/*' \
                --output-file $(COVERAGE_INFO)
    
  2. brettcannon commented on Dec 10, 2016

    @brettcannon
    MemberAuthor

    Would we run lcov as a separate coverage step from coverage.py? Or somehow run them simultaneously? I don't know what kind of slowdown we're looking at here if we had both on and if we might run afoul of Travis' free tier limitations.

  3. tiran commented on Dec 10, 2016

    @tiran
    Member

    On my machine it takes almost 10 minutes to run Python's test suite with a gcov instrumented build of Python. My laptop is pretty fast (8 cores i7-4900MQ CPU @ 2.80GHz, 16 GB RAM). I'm able to utilze all cores with 10 parallel test process. It's going to be hard enough to get lcov finish on Travis without coverage.py.

    $ make coverage
    $ time make test
    ...
    real    9m40.226s
    user    56m49.298s
    sys     1m17.350s
    
  4. brettcannon commented on Dec 10, 2016

    @brettcannon
    MemberAuthor

    OK, then we can look at running it as a separate test. If you want to try and get this working now then send a PR at https://github.com/brettcannon/cpython-ci-test as that's where I plan to pull the initial config files for Travis and Codecov.

  5. tiran commented on Dec 10, 2016

    @tiran
    Member

    I have to look into it. I'd like to use a service that can use lcov database so we can re-use out-of-tree build and lcov excludes from make coverage-lcov.

  6. brettcannon commented on Dec 11, 2016

    @brettcannon
    MemberAuthor

    It looks like lcov is supported by Codecov: https://github.com/codecov/codecov-bash/blob/master/codecov#L822

  7. brettcannon commented on Feb 10, 2017

    @brettcannon
    MemberAuthor

    Did you want me to leave this open for you, @tiran to look into lcov?

  8. abalkin commented on Feb 13, 2017

    @abalkin
    Member

    Please take a look at https://github.com/abalkin/cpython/tree/ci or specifically at https://codecov.io/gh/abalkin/cpython/branch/ci. @brettcannon is that the "appropriate merging" that you are looking for?

  9. brettcannon commented on Feb 13, 2017

    @brettcannon
    MemberAuthor

    @abalkin unfortunately no as there's no coverage for the Lib/ directory. If you include coverage runs for both lcov and coverage.py do the results show up in Codecov as if they were run together?

  10. abalkin commented on Feb 13, 2017

    @abalkin
    Member

    Right. I thought I've seen both, but clearly my focus was on C coverage.

    We are evaluating codecov's commercial offering in my firm at the moment, so I should have a working setup "soon".

  11. added a commit that references this issue on Mar 15, 2017
  12. changed the title [-]Hook up Codecov for coverage reporting[/-] [+]Hook up Codecov for coverage reporting on C code[/+] on Apr 10, 2017
  13. brettcannon commented on Apr 10, 2017

    @brettcannon
    MemberAuthor

    Tweaked the title in hopes that someone is able to look into getting C code coverage working.

  14. added a commit that references this issue on Jun 18, 2018
  15. ammaraskar commented on Jun 18, 2018

    @ammaraskar
    Member

    Looked into this. Got it working on my fork here: https://codecov.io/gh/ammaraskar/cpython

    Codecov makes this incredibly simple, they support auto merging of multiple reports, so both the python and C parts show up in the coverage report.

    Some disadvantages, the coverage instrumented build takes longer to test on travis than without coverage. My build ran for ~40 minutes compared to ~20 minutes currently. This isn't too big of a concern since the coverage build is optional and does not block the travis status but its something to consider.

  16. ammaraskar commented on Jun 18, 2018

    @ammaraskar
    Member
  17. brettcannon commented on Jun 18, 2018

    @brettcannon
    MemberAuthor

    Great work! Hopefully one of us will be able to review python/cpython#7773 shortly.

  18. brettcannon commented on Jun 22, 2018

    @brettcannon
    MemberAuthor

    This is now merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions