Skip to content

[build] Add support for code coverage - #12259

Closed
ejgallego wants to merge 2 commits into
rocq-prover:masterfrom
ejgallego:dune+bisect
Closed

[build] Add support for code coverage#12259
ejgallego wants to merge 2 commits into
rocq-prover:masterfrom
ejgallego:dune+bisect

Conversation

@ejgallego

@ejgallego ejgallego commented May 6, 2020

Copy link
Copy Markdown
Contributor

Closes #10267

This PR went into a few iterations due to build system changes; it is in final form now. A couple of notes:

  • the instrumentation support we use requires Dune 2.7, I don't think this is a problem [2.8 is]
  • when the instrumentation is not enabled, the whole of it is a no-op

Integration with some coverage tool so we can actually see progress among releases, and extended weekly builds is desired, but not necessary to do here.

@ejgallego ejgallego added kind: infrastructure CI, build tools, development tools. part: build The build system. needs: independent fix The PR reveals an independent bug. needs: progress Work in progress: awaiting action from the author. labels May 6, 2020
@ejgallego
ejgallego force-pushed the dune+bisect branch 9 times, most recently from 53d4f3f to a1a58fa Compare May 6, 2020 13:24
@ejgallego

Copy link
Copy Markdown
Contributor Author

@SkySkimmer

Copy link
Copy Markdown
Contributor

What's the perf impact of running the coverage? Is it small enough to activate it for the 3rd party jobs (fiat-crypto etc)?

@ejgallego

Copy link
Copy Markdown
Contributor Author

What's the perf impact of running the coverage? Is it small enough to activate it for the 3rd party jobs (fiat-crypto etc)?

I think it is around 2x / 3x time.

@ejgallego

Copy link
Copy Markdown
Contributor Author

@SkySkimmer certainly at every commit this could be too much, but we could run a weekly deeper coverage testing run indeed.

@aantron

aantron commented May 11, 2020

Copy link
Copy Markdown

I think it is around 2x / 3x time.

Is this based on a measurement? I would not have expected the impact to be such, though I suppose it's plausible for very CPU-bound work.

@JasonGross

Copy link
Copy Markdown
Member

I'd be quite interested in seeing the code coverage diff between, say, all of the current CI vs all of the current CI + fiat-crypto-legacy (which I've been maintaining compatible with master for, even though it's been removed from the CI). If there's any diff, we might be able to extract some useful new test-cases.

@aantron

aantron commented May 11, 2020

Copy link
Copy Markdown

We would probably need to restore the old "combine expressions" for this (arithmetic/diffs on coverage output). If there is indeed interest in this, I can add them to Bisect_ppx.

@ejgallego

Copy link
Copy Markdown
Contributor Author

Is this based on a measurement? I would not have expected the impact to be such, though I suppose it's plausible for very CPU-bound work.

@aantron it is based on CI timings, bisect job: 73 mins, regular job ~ 40 mins.

@JasonGross hopefully we do indeed start doing stuff like that once the setup is more stable.

@aantron

aantron commented May 11, 2020

Copy link
Copy Markdown

it is based on CI timings, bisect job: 73 mins, regular job ~ 40 mins.

Ok. Just want to note: that difference would not be only from the instrumentation inserted into the code, but also due to the time taken to generate the report at the end.

@ejgallego

Copy link
Copy Markdown
Contributor Author

Ok. Just want to note: that difference would not be only from the instrumentation inserted into the code, but also due to the time taken to generate the report at the end.

Indeed; I was maybe a bit pessimistic but also note that in the above job OCaml compilation time itself is a significant part so the current numbers are around a bit more than 2x ; Coq is likely worst case in this sense as some instrumented code paths are called dozens of millions of times as they are in critical loops [such as conversion]

Would we tweak the instrumentation to leave out these hot paths, I'd bet the slowdown would be much less severe.

@jfehrle

jfehrle commented Jul 15, 2020

Copy link
Copy Markdown
Member

@ejgallego The example artifact is long gone. Perhaps you could rerun the build for the PR so I can look at the output? I'd like to see how usable the output is for parser statistics as you suggested on the Coq call. I expect the 2x-3x overhead to run code coverage is far more expensive than generating the parser statistics in my PR, which should have a negligible effect on run time.

@Zimmi48 Zimmi48 added the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Jul 16, 2020
@ejgallego

Copy link
Copy Markdown
Contributor Author

Rebased in case someone wants to have a look.

@aantron

aantron commented Jun 27, 2023

Copy link
Copy Markdown

Does this need help from Bisect upstream?

@ejgallego

Copy link
Copy Markdown
Contributor Author

Does this need help from Bisect upstream?

Thanks a lot @aantron , for now we are stuck on the coverage data upload (some problems with tokens in our CI setup)

We are having a look, will let you know if we have feedback for upstream (maybe documenting our setup could be useful for others, so we may do a doc PR)

@coqbot-app

coqbot-app Bot commented Jul 31, 2023

Copy link
Copy Markdown
Contributor

The "needs: rebase" label was set more than 30 days ago. If the PR is not rebased in 30 days, it will be automatically closed.

@coqbot-app

coqbot-app Bot commented Aug 30, 2023

Copy link
Copy Markdown
Contributor

This PR was not rebased after 30 days despite the warning, it is now closed.

@ejgallego

ejgallego commented Mar 19, 2024

Copy link
Copy Markdown
Contributor Author

Reopened after the discussion in today's call, maybe we can debug / discuss what's missing here on Zulip?

Comment thread .gitlab-ci.yml
- chmod +x codecov
- ./codecov -t ${CODECOV_TOKEN} -f coverage.json
# Bah bisect-ppx doesn't support gitlab CI
# - bisect-ppx-report send-to --source-path=_build/coverage --coverage-path=_build/coverage Codecov

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.

Should this be uncommented to test?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think the line just above ./codecov .... should do the same trick, but I forgot about how the process looks like.

Maybe we should check if the bisect-ppx-report has support for gitlab CI already in the newer version.

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.

It looks like not https://github.com/aantron/bisect_ppx/blob/e30265643e77bcf2c9eba7322429c779122106fc/src/report/coveralls.ml#L148-L152

But it also shouldn't be too hard to add, it's just a matter of figuring out what variables live where. Or you can spoof it by setting variables appropriately

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.

@aantron is there any obstacle to supporting gitlab upstream?

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.

@JasonGross JasonGross Mar 20, 2024

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.

What about doing

Suggested change
# - bisect-ppx-report send-to --source-path=_build/coverage --coverage-path=_build/coverage Codecov
- bisect-ppx-report send-to --source-path=_build/coverage --coverage-path=_build/coverage Codecov --git --service-name="github" --service-pull-request="${CI_COMMIT_BRANCH#pr-}" --service-job-id="$CI_JOB_ID"
- bisect-ppx-report send-to --source-path=_build/coverage --coverage-path=_build/coverage Coveralls --git --service-name="github" --service-pull-request="${CI_COMMIT_BRANCH#pr-}" --service-job-id="$CI_JOB_ID"

?

@ejgallego

Copy link
Copy Markdown
Contributor Author

Hi folks, a few points:

  • this needs a new assignee, I think @maximedenes won't have time to handle this PR (I understand, feel free to correct me if I'm wrong.
  • I wonder if we should merge this without uploading the coverage data to some service, just generating the artifact with the report and leaving the upload to future work. Unfortunately, that doesn't allow us to check what the delta between coverage, which is the most important.
  • The real nice coverage data would be data that is generated for all of the CI, I wonder how to handle this. In my computer I was able to do using the ci-all make target. We could have a weekly run that does that (or combines the coverage artifacts from all jobs)

Unfortunately I have limited time to work on this in the upcoming weeks, but I'm happy to do my best to help if someone would like to try.

@SkySkimmer

Copy link
Copy Markdown
Contributor

I wonder if we should merge this without uploading the coverage data to some service, just generating the artifact with the report and leaving the upload to future work.

I think we should, it would at least reduce rebase pain when working on the rest.

@ejgallego

Copy link
Copy Markdown
Contributor Author

@SkySkimmer I'll prepare a non-draft version ASAP.

@JasonGross

Copy link
Copy Markdown
Member

I see:
This job is stuck because of one of the following problems. There are no active runners online, no runners for the protected branch , or no runners that match all of the job's tags: docker

@SkySkimmer

Copy link
Copy Markdown
Contributor

This job is stuck because of one of the following problems. There are no active runners online, no runners for the protected branch , or no runners that match all of the job's tags: docker

Yes we need to enable the inria custom runners for docker-boot, it's a pain.
(we don't keep them enabled because they're unreliable)

@SkySkimmer

Copy link
Copy Markdown
Contributor

in fact they're currently down

@ejgallego

Copy link
Copy Markdown
Contributor Author

Something I was thinking was about running coverage on Github actions, however that doesn't scale in the case we'd eventually like to run the coverage for the full CI.

Another option is actually to run the full CI "offline", in one of our servers, and them push the reports to a static website.

@JasonGross

Copy link
Copy Markdown
Member

Something I was thinking was about running coverage on Github actions, however that doesn't scale in the case we'd eventually like to run the coverage for the full CI.

What is the issue? Presumably running coverage on the full CI could happen, say, on a schedule (once a week?) and when requested (like the bench), and there'd be no problem with using GitHub Actions then (other than having to duplicate everything in .gitlab.yml, which is maybe the lack of scaling you're talking about?)

@SkySkimmer

Copy link
Copy Markdown
Contributor

We now use the gitlab.inria.fr shared runners for docker-boot so if you rebase we may be able to get this merged

@ejgallego

Copy link
Copy Markdown
Contributor Author

Ok rebased, still not sure how to run the CI tho.

Comment thread plugins/micromega/sos.ml

let decimal =
let ( || ) = parser_or in
let ( ||| ) = parser_or in

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Bisect got confused with this overloading, I guess we should see if that's the case and submit a bug there (and remove this change)

Comment thread .gitlab-ci.yml
@JasonGross

This comment was marked as outdated.

@JasonGross

Copy link
Copy Markdown
Member

@coqbot run light ci

@JasonGross

Copy link
Copy Markdown
Member
$ opam switch set -y "${COMPILER}${OPAM_VARIANT}"
[ERROR] No switch 4.09.0+flambda is currently installed. Did you mean 'opam switch create 4.09.0+flambda'?
        Installed switches are:
          - 4.09.0+32bit
          - 4.09.0

@ejgallego Do you need some extra setup somewhere?

Comment thread .gitlab-ci.yml
@ejgallego

Copy link
Copy Markdown
Contributor Author

This failed due to the complexity tests...

I cannot wait for the day these tests are removed from Coq, they only get in the way (pretty often in my case)

@coqbot-app

coqbot-app Bot commented Jun 6, 2024

Copy link
Copy Markdown
Contributor

The "needs: rebase" label was set more than 30 days ago. If the PR is not rebased in 30 days, it will be automatically closed.

@coqbot-app

coqbot-app Bot commented Aug 5, 2024

Copy link
Copy Markdown
Contributor

The "needs: rebase" label was set more than 30 days ago. If the PR is not rebased in 30 days, it will be automatically closed.

@coqbot-app

coqbot-app Bot commented Sep 4, 2024

Copy link
Copy Markdown
Contributor

This PR was not rebased after 30 days despite the warning, it is now closed.

@aantron

aantron commented Sep 4, 2024

Copy link
Copy Markdown

Is this something the Coq project wants? What is necessary from the Bisect side? aantron/bisect_ppx#436?

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

Labels

help wanted kind: infrastructure CI, build tools, development tools. needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. needs: squashing Some commits should be squashed together. needs: test-suite update Test case should be added to / updated in the test-suite. part: build The build system. stale This PR will be closed unless it is rebased.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Coverage support

9 participants