Recreating the test coverage results reported on Hackage #689
Replies: 3 comments 7 replies
-
|
For reference: https://www.reddit.com/r/haskell/comments/1oydrv1/comment/np6vhzm/?context=1 |
Beta Was this translation helpful? Give feedback.
-
|
I wish this information were easy to reproduce locally, but unfortunately, it's not quite so. I ended up reading As a running example, let's pick From this information, the 53% figure can be computed by taking the number of things covered (i.e., the sum of the numbers to the left of the The real question is: how does This will generate a On my machine, I accomplished this by running the following command (using Note that I am explicitly enumerating the modules that I want to include in the coverage report by listing each of As far as how to replicate this in a Dockerfile... unfortunately, I think you'll have to do some post-processing of the |
Beta Was this translation helpful? Give feedback.
-
|
A while back I was trying to get this to work and I found this code in Hackage, which is how it calculates the average shown on the main page for each package: getAvgCovg :: Maybe BR.BuildCovg -> (Bool, String, Int)
getAvgCovg Nothing = (False, "", 100)
getAvgCovg (Just c) = do
let l = [
BR.expressions c
, BR.guards (BR.boolean c)
, BR.ifConditions (BR.boolean c)
, BR.qualifiers (BR.boolean c)
, BR.alternatives c
, BR.localDeclarations c
, BR.topLevel c
]
(used,total) = foldl (\(a,b) (x, y) -> (a+x, b+y)) (0,0) l
per | total <= 0 = 100
| otherwise = (used*100) `div` total
if per > 66
then (True, "brightgreen", per)
else if per > 33
then (True, "yellowgreen", per)
else (True, "red", per) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When Hackage runs the tests of this project, it provides coverage results for each of the libraries.
While I can run the tests with coverage enabled, I am failing to reproduce the results that Hackage shows. The numbers I obtain are always off by a bit. I'm more comfortable with
cabal v1-*commands, which are considered outdated, and even running the tests with coverage is hard (I cannot always get HPC to report data regarding new modules and new tests, and I just don't know why).Is there a way to create a Dockerfile that will run the tests of one library,
copilot-core, and produce results that are consistent with what Hackage is reporting (with whatever version of Cabal and whatever commands are needed). As a starting point, there are quite a few Dockerfiles in the comments of the PRs: https://github.com/Copilot-Language/copilot/pulls?q=is%3Apr+is%3AclosedBeta Was this translation helpful? Give feedback.
All reactions