Skip to content

Add Code Coverage and codecov.io integration - #2928

Merged
ggerganov merged 15 commits into
ggml-org:masterfrom
alonfaraj:add-code-coverage
Sep 3, 2023
Merged

ggerganov merged 15 commits into
ggml-org:masterfrom
alonfaraj:add-code-coverage

Conversation

@alonfaraj

@alonfaraj alonfaraj commented Aug 31, 2023 •

Copy link
Copy Markdown
Contributor

This PR add code coverage utilize lcov, gcov and gcovr, based on the project tests and publish the result to codecov.io.
I think the project rapidly evolved and it might be a good way to track the tests coverage.
Example of my llama.cpp fork on codecov.

  • add code-coverage.yml workflow
  • add coverage, lcov-report, gcovr-report to makefile
  • disabled by default, enable by setting LLAMA_CODE_COVERAGE
  • upon PR - codecov will post a report comment to indicate if the coverage increased/decrease/none (need to be tested if everything configured correctly)

How to use locally:

make clean
make LLAMA_CODE_COVERAGE=1 tests -j 
make test
make coverage 
make lcov-report
make gcovr-report

make lcov-report generate the report files.
make gcovr-report generate gcovr-report/coverage.html which can be opened locally (example gcovr-report.zip).

Those commands are independents.

Dependencies:

lcov-report - apt install lcov
gcovr-report - pip install gcovr

@ggerganov
If you find it useful, you might need to login to codecov.io and setup the repo and the CODECOV_TOKEN secret.
Seems like you already have one.

We can also have a code coverage badge afterwards 😁

@codecov-commenter

codecov-commenter commented Aug 31, 2023 •

Copy link
Copy Markdown

Codecov Report

❗ No coverage uploaded for pull request base (master@ca82cf7). Click here to learn what that means.
Patch has no changes to coverable lines.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #2928   +/-   ##
=========================================
  Coverage          ?   37.41%           
=========================================
  Files             ?       14           
  Lines             ?     4175           
  Branches          ?        0           
=========================================
  Hits              ?     1562           
  Misses            ?     2613           
  Partials          ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ggerganov ggerganov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Whooping 37.4% coverage 😄

image

I'm actually curious to see how this will integrate with our workflow, so let's merge it.
If it gets too annoying, we'll have to remove it though.

Is there something I need to do to enable this?

Comment thread Makefile Resolved
@alonfaraj

Copy link
Copy Markdown
Contributor Author

@ggerganov
On second thought, CodeCov report comment for each PR might be very annoying.
We can disable this feature but still monitor the coverage for PRs on codecov.io if we need.
Much less unnecessary comments etc.
What do you think?

Beside that, I think we good to go, nothing else we need to enable as far as I know (gonna make sure after merge along the way).

@ggerganov
ggerganov merged commit afc43d5 into ggml-org:master Sep 3, 2023
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
* update .gitignore

* makefile: add coverage support (lcov, gcovr)

* add code-coverage workflow

* update code coverage workflow

* wun on ubuntu 20.04

* use gcc-8

* check why the job hang

* add env vars

* add LLAMA_CODE_COVERAGE=1 again

* - add CODECOV_TOKEN
- add missing make lcov-report

* install lcov

* update make file -pb flag

* remove unused  GGML_NITER from workflows

* wrap coverage output files in COV_TARGETS
phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
* update .gitignore

* makefile: add coverage support (lcov, gcovr)

* add code-coverage workflow

* update code coverage workflow

* wun on ubuntu 20.04

* use gcc-8

* check why the job hang

* add env vars

* add LLAMA_CODE_COVERAGE=1 again

* - add CODECOV_TOKEN
- add missing make lcov-report

* install lcov

* update make file -pb flag

* remove unused  GGML_NITER from workflows

* wrap coverage output files in COV_TARGETS
ljubomirj pushed a commit to ljubomirj/llama.cpp that referenced this pull request May 6, 2026
* update .gitignore

* makefile: add coverage support (lcov, gcovr)

* add code-coverage workflow

* update code coverage workflow

* wun on ubuntu 20.04

* use gcc-8

* check why the job hang

* add env vars

* add LLAMA_CODE_COVERAGE=1 again

* - add CODECOV_TOKEN
- add missing make lcov-report

* install lcov

* update make file -pb flag

* remove unused  GGML_NITER from workflows

* wrap coverage output files in COV_TARGETS
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
* update .gitignore

* makefile: add coverage support (lcov, gcovr)

* add code-coverage workflow

* update code coverage workflow

* wun on ubuntu 20.04

* use gcc-8

* check why the job hang

* add env vars

* add LLAMA_CODE_COVERAGE=1 again

* - add CODECOV_TOKEN
- add missing make lcov-report

* install lcov

* update make file -pb flag

* remove unused  GGML_NITER from workflows

* wrap coverage output files in COV_TARGETS
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
* update .gitignore

* makefile: add coverage support (lcov, gcovr)

* add code-coverage workflow

* update code coverage workflow

* wun on ubuntu 20.04

* use gcc-8

* check why the job hang

* add env vars

* add LLAMA_CODE_COVERAGE=1 again

* - add CODECOV_TOKEN
- add missing make lcov-report

* install lcov

* update make file -pb flag

* remove unused  GGML_NITER from workflows

* wrap coverage output files in COV_TARGETS
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.

3 participants