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

Generating a coverage report with hpc. #745

Closed
emmabastas opened this issue Jul 20, 2021 · 3 comments
Closed

Generating a coverage report with hpc. #745

emmabastas opened this issue Jul 20, 2021 · 3 comments
Assignees
Milestone

Comments

@emmabastas
Copy link
Contributor

emmabastas commented Jul 20, 2021

This issue is intended as a place to describe how I generate coverage reports for elm-format using hpc, for future reference.

Code commits in emmabastas/elm-format:coverage-report

The gist of it

ghc is instructed to compile with coverage tracking using the -fhpc compiler flag. This flag is appended to ghc-options in all five of the <package-name>.cabal files.

A new script, coverage-report.sh is run to generate a report in html. The script basically wraps a call to hpc markup with some additional options.

Other approaches

Cabal has support for adding coverage tracking via a config option. To add coverage tracking at the cabal level instead of compiler level might appear more natural for elm-format, but after failed attempts and reading haskell/cabal#3902 I came to the conclusion that elm-format's setup with multiple local cabal packages and integration tests probably falls outside the scope of cabals support for hpc.

@razzeee
Copy link
Contributor

razzeee commented Jul 20, 2021

The issue link is broken should probably be haskell/cabal#3902

@avh4 avh4 self-assigned this Jul 20, 2021
@emmabastas
Copy link
Contributor Author

@avh4 avh4 added this to the 0.8.6 milestone Dec 7, 2021
@avh4 avh4 modified the milestones: 0.8.6, 0.8.7 Feb 25, 2023
@avh4
Copy link
Owner

avh4 commented Mar 15, 2023

Thanks! I followed your approach and added some build scripts in #808. Now dev/build.sh serve:coverage will show the coverage report for the integration tests.

@avh4 avh4 closed this as completed Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants