-
Notifications
You must be signed in to change notification settings - Fork 247
First iteration of coverage reports #762
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
Conversation
For configuring this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good so far...
I'm not sure what the purpose of the |
Thanks @angerman. This is exactly the kind of thing I was looking for. I whipped up the cq tool in half an hour to do what I needed, but I was waiting for someone to tell me I don't need it. |
This looks pretty awesome - when can we use it?
|
|
Just working on doco, I'll have this out soon. |
Hey all :) I'm re-requesting review because the core parts have stabilized and I'd really like your input on how it looks. The documentation I've written might be helpful for understanding how the pieces fit together. I've had separate discussions with a few of you out-of-band about what policy we should adopt towards enabling coverage. Ideally we'd like to get the "do coverage or not" option from the cabal.project/cabal side. Unfortunately, that attribute isn't available to us in the plan.json yet, see haskell/cabal#6343 (comment). So until that is addressed, I'm going for: "if the user asks for a coverage report, force it on". Unfortunately, I'm not quite there yet :( I've outlined the key deficiency in the doco:
I believe this deficiency exists because even though I do this: buildWithCoverage = builtins.map (d: d.covered);
libraryCovered = library.covered;
testsWithCoverage = buildWithCoverage tests; That does not enable coverage on the library dependency that already exists within each test. So that I'm not sure how to fix this, any insight would be amazing! Until then I'll work on doco and a test as much as I can between other things. |
Does it matter if we have coverage enabled permanently? i.e. is it bad if our production builds of things use a library which was built with coverage available? If not, then here's an alternative suggestion: require users to enable coverage explicitly, and assert in the coverage report generation that it's on. Then, yes, you have to set it manually, but at least it tells you what to do. I'm a bit concerned about automatically turning it on in that it may require us to rebuild things unnecessarily (but I guess at least this will only be the libraries in the current project, not dependencies, right?). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good, great doc!
|
||
- The mix files are copied verbatim from the builds with coverage. | ||
- The tix files for each test are copied from the check run verbatim. | ||
- The tix files for each library are generated by summing the tix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a standard thing to do? I would have hoped that maybe there were existing tools for working with tix files out there? Maybe we should consider writing one, and then just calling it? I'm a little uncomfortable having sophisticated logic like this just written in bash in a random Nix builder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This applies to the other clever coverage file handling you mention elsewhere.
@@ -0,0 +1,173 @@ | |||
# Developer Coverage Overview |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great doc
overlays/haskell.nix
Outdated
inherit (callProjectResults) index-state; | ||
}; | ||
in project // { | ||
projectCoverageReport = haskellLib.projectCoverageReport (haskellLib.selectProjectPackages project.hsPkgs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be tempted to make people construct this call themselves, i.e. document projectCoverageReport
and tell people to just pass in the packages they want coverage for. Maybe that's my inner Haskeller preferring functions over magic attributes, but it's harder to work out what to do in Nix land.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed these here: 29ac893
overlays/haskell.nix
Outdated
components = final.lib.mapAttrs (n: v: | ||
if n == "library" || n == "all" | ||
then v // { inherit project package; } | ||
else final.lib.mapAttrs (_: c: c // { inherit project package; }) v | ||
) package'.components; | ||
inherit project; | ||
|
||
coverageReport = haskellLib.coverageReport { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto? although this one is more complex...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed these here: 29ac893
01d061c
to
ee6f069
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks very good, and I generally second Michael's review comments.
I'm happy to see a test case as well.
I did suggest removing any partially complete features, and doing them in another PR. But if it's all done then great.
👍 It seems symptomatic of a design issue that I have to turn on coverage for the entire project permanently to generate the coverage report. I actually want the project to stay the same, but pass some of the packages to a coverage function and have it handle making a copy of those packages with coverage enabled. You will end up compiling the package twice, once with coverage, and once without, but that's only when you exercise a code path involving the coverage report. I doubt we'll make it a required build. At this stage I only foresee it being used by the CI machines in a build step to generate a report which it then sends to I'll pursue turning the |
Thanks :) Here's my first attempt at a test: ee6f069. |
debc841
to
f3a6bdc
Compare
Just re-surfacing this comment as it doesn't appear here:
|
Ditto:
I've fixed this in f3a6bdc, but it's all "convenience" and doesn't ask the user to do much. I'm not sure how to approach asking them to do more, although I agree it'd be more elegant: If I ask the user to enable coverage in their project like this:
I'm dooming that project to have coverage enabled for ALL builds from this point on. I suppose I could ask the user to create a duplicate project for coverage builds, but I'm not sure about the elegance of that. Maybe I want something like:
At the moment, the magic attributes nicely sidestep the above problem (albeit the magic is fairly brittle):
|
I think I've addressed every comment bar creating an external tool. The coverage implementation is now significantly simpler, and I've documented the new usage here. I will work on the external tool to simplify the Nix logic in each builder. I agree that it's a lot of logic in Nix. I'm not sure if it will buy us a lot, but we'll see. |
Feel free to rebase on latest master, fix merge conflicts, and squash @sevanspowell. |
8312f62
to
b1ba5a6
Compare
Thanks @rvl I didn't end up creating an external tool to munge the coverage information. I tried to approach it a couple of ways, but ultimately it didn't buy us enough to justify maintaining a separate tool. So I've simplified the logic in each of the core coverage bash scripts to make things easier to understand and maintain. |
4e07cb0
to
73a1ddc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! have not tested it, though
|
||
runHook preCheck | ||
|
||
${toString component.testWrapper} ${drv}/bin/${drv.exeName} ${lib.concatStringsSep " " component.testFlags} | tee $out | ||
${toString component.testWrapper} ${drv}/bin/${drv.exeName} ${lib.concatStringsSep " " component.testFlags} | tee $out/test-stdout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for test-stdout
lib/cover.nix
Outdated
# main-is: Spec.hs | ||
# still generates a "Main.mix" file with the contents: | ||
# Mix "Spec.hs" ... | ||
# Hence we can hardcode the name "Main" here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
lib/cover.nix
Outdated
testsAsList = lib.attrValues tests; | ||
checks = builtins.map (d: haskellLib.check d) testsAsList; | ||
|
||
# Exclude test modules from tix file. The Main module is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we exclude test modules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lib/cover.nix
Outdated
mixSearchDirs = map (info: if info.searchSubDir == null then info.rootDir else info.rootDir + "/" + info.searchSubDir) mixInfo; | ||
|
||
in pkgs.runCommand (identifier + "-coverage-report") | ||
{ buildInputs = (with pkgs; [ ghc ]); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use the same GHC as the project uses here? Otherwise we might a) incur a dependency on another GHC, which can be expensive, and b) the behaviour of hpc
might be different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lib/cover-project.nix
Outdated
</html> | ||
''; | ||
in pkgs.runCommand "project-coverage-report" | ||
{ buildInputs = (with pkgs; [ghc]); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about choice of GHC here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lib/default.nix
Outdated
}; | ||
|
||
# Do coverage of a project | ||
projectCoverageReport' = import ./cover-project.nix { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the ticks? there aren't unticked versions here that I can see?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are the ones which are attributes on projects, but I think that's clear enough. We use the ticks when they're actually attributes of the same attribute set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2ac9f01
to
b5cbbf9
Compare
Just debugging the tests, I can't get them to build with the new "choose a ghc" test infra yet. |
b5cbbf9
to
ce74990
Compare
Fixed I think. |
@sevanspowell I am trying this branch and the coverage generation is working pretty well 👌. But Edit: also I have found that the |
bbdac76
to
69902c7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome, thanks @sevanspowell.
As it is, the projectCoverageReport
function is not quite suitable for cardano-wallet, but it will work for other projects, so let's merge.
You will need to squash then rebase again of course. What is going on with the CI fails - are they also happening on master?
Long term, I think we should either modify hpc markup
so that it can produce multi-package HTML reports (like stack hpc
does), or make a standalone tool.
7a4e069
to
4807434
Compare
- Added the ability to generate coverage reports for packages and projects. - Outputs mix and tix information, as well as a HTML report. - Added the "doCoverage" module option that allows users to choose packages to enable coverage for. - Added a "doCoverage" flag to the component builder that outputs HPC information when coverage is enabled. - Added the "overrideModules" library function to make it more ergonomic fo users to enable coverage on existing projects. - Modified the "check" builder to also output ".tix" files (if they exist). This information is required to generate the coverage report. - Added a test for coverage.
54d6da6
to
0e3727e
Compare
Includes Samuel's coverage PR. input-output-hk/haskell.nix#762
Includes Samuel's coverage PR. input-output-hk/haskell.nix#762
Includes Samuel's coverage PR. input-output-hk/haskell.nix#762
2124: Add haskell program coverage reports to Hydra tests r=rvl a=rvl ### Issue Number ADP-99 ### Overview This is a bit of an assortment of nix build improvements. 1. Add a code test coverage report for the Hydra build - implemented by PR input-output-hk/haskell.nix#762 2. Add a nix-shell with profiled packages. Profiled packages will be built on Hydra for master branch but not PRs. This means you can download haskell dependencies with profiling enabled, rather than having to build everything yourself. 3. Update versions of build tools in the nix-shell to latest hackage release - ghcide, hlint and stylish-haskell updated. ### Comments - [Hydra jobset](https://hydra.iohk.io/jobset/Cardano/cardano-wallet-pr-2124) - [Coverage report job](https://hydra.iohk.io/job/Cardano/cardano-wallet-pr-2124/musl64.testCoverageReport.x86_64-linux/latest) - [Coverage report from bors try](https://hydra.iohk.io/build/4328848/download/2/hpc_index.html) <details> <summary>Stack coverage report for comparison</summary> #### Command ``` stack build --coverage --fast --test --skip integration --skip jormungandr-integration ``` #### Result: ``` ... Generating unified report 26% expressions used (26186/98111) 44% boolean coverage (136/305) 42% guards (102/240), 72 always True, 7 always False, 59 unevaluated 52% 'if' conditions (33/63), 4 always True, 8 always False, 18 unevaluated 50% qualifiers (1/2), 1 always True 40% alternatives used (849/2108) 58% local declarations used (859/1456) 50% top-level declarations used (1769/3533) The unified report is available at /home/rodney/iohk/cardano-wallet/.stack-work/install/x86_64-linux/2cecc28bf3aab8c8c3e4a07c1c6c1c846ec8861df3d8a5e9247bce185aeb7542/8.6.5/hpc/combined/all/hpc_index.html An index of the generated HTML coverage reports is available at /home/rodney/iohk/cardano-wallet/.stack-work/install/x86_64-linux/2cecc28bf3aab8c8c3e4a07c1c6c1c846ec8861df3d8a5e9247bce185aeb7542/8.6.5/hpc/index.html -- While building package cardano-wallet-2020.9.30 using: /home/rodney/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.4.0.1 build lib:cardano-wallet exe:cardano-wallet test:unit --ghc-options "-hpcdir .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/hpc -fdiagnostics-color=always" Process exited with code: ExitFailure 1 Progress 335/336 ``` </details> Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io> Co-authored-by: Samuel Evans-Powell <mail@sevanspowell.net>
2124: Add haskell program coverage reports to Hydra tests r=rvl a=rvl ### Issue Number ADP-99 ### Overview This is a bit of an assortment of nix build improvements. 1. Add a code test coverage report for the Hydra build - implemented by PR input-output-hk/haskell.nix#762 2. Add a nix-shell with profiled packages. Profiled packages will be built on Hydra for master branch but not PRs. This means you can download haskell dependencies with profiling enabled, rather than having to build everything yourself. 3. Update versions of build tools in the nix-shell to latest hackage release - ghcide, hlint and stylish-haskell updated. ### Comments - [Hydra jobset](https://hydra.iohk.io/jobset/Cardano/cardano-wallet-pr-2124) - [Coverage report job](https://hydra.iohk.io/job/Cardano/cardano-wallet-pr-2124/musl64.testCoverageReport.x86_64-linux/latest) - [Coverage report from bors try](https://hydra.iohk.io/build/4328848/download/2/hpc_index.html) <details> <summary>Stack coverage report for comparison</summary> #### Command ``` stack build --coverage --fast --test --skip integration --skip jormungandr-integration ``` #### Result: ``` ... Generating unified report 26% expressions used (26186/98111) 44% boolean coverage (136/305) 42% guards (102/240), 72 always True, 7 always False, 59 unevaluated 52% 'if' conditions (33/63), 4 always True, 8 always False, 18 unevaluated 50% qualifiers (1/2), 1 always True 40% alternatives used (849/2108) 58% local declarations used (859/1456) 50% top-level declarations used (1769/3533) The unified report is available at /home/rodney/iohk/cardano-wallet/.stack-work/install/x86_64-linux/2cecc28bf3aab8c8c3e4a07c1c6c1c846ec8861df3d8a5e9247bce185aeb7542/8.6.5/hpc/combined/all/hpc_index.html An index of the generated HTML coverage reports is available at /home/rodney/iohk/cardano-wallet/.stack-work/install/x86_64-linux/2cecc28bf3aab8c8c3e4a07c1c6c1c846ec8861df3d8a5e9247bce185aeb7542/8.6.5/hpc/index.html -- While building package cardano-wallet-2020.9.30 using: /home/rodney/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.4.0.1 build lib:cardano-wallet exe:cardano-wallet test:unit --ghc-options "-hpcdir .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/hpc -fdiagnostics-color=always" Process exited with code: ExitFailure 1 Progress 335/336 ``` </details> 2223: Enable 100 wallet scenario in latency benchmark r=Anviking a=Anviking # Issue Number ADP-469, ADP-473 # Overview - [x] Simply enable `Latencies for 100 fixture wallets` - [x] Delete all wallets in between all latency scenarios - [x] Rename DSL helper `tearDown` to `deleteAllWallets`, and re-use it more # Comments ``` $ stack bench cardano-wallet Benchmark latency: RUNNING... Non-cached run getNetworkInfo - 20.7 ms Latencies for 2 fixture wallets scenario listWallets - 1.4 ms getWallet - 0.5 ms getUTxOsStatistics - 0.4 ms listAddresses - 1.0 ms listTransactions - 2.2 ms postTransactionFee - 86.4 ms listStakePools - 1.2 ms getNetworkInfo - 0.0 ms Latencies for 10 fixture wallets scenario listWallets - 4.8 ms getWallet - 0.4 ms getUTxOsStatistics - 0.3 ms listAddresses - 0.9 ms listTransactions - 2.0 ms postTransactionFee - 93.2 ms listStakePools - 1.3 ms getNetworkInfo - 0.0 ms Latencies for 100 fixture wallets listWallets - 59.9 ms getWallet - 0.5 ms getUTxOsStatistics - 0.4 ms listAddresses - 1.2 ms listTransactions - 2.6 ms postTransactionFee - 139.2 ms listStakePools - 1.1 ms getNetworkInfo - 0.0 ms Latencies for 2 fixture wallets with 10 txs scenario listWallets - 1.1 ms getWallet - 0.5 ms getUTxOsStatistics - 0.4 ms listAddresses - 0.9 ms listTransactions - 3.8 ms postTransactionFee - 104.2 ms listStakePools - 1.3 ms getNetworkInfo - 0.1 ms Latencies for 2 fixture wallets with 20 txs scenario listWallets - 1.1 ms getWallet - 0.5 ms getUTxOsStatistics - 0.4 ms listAddresses - 1.0 ms listTransactions - 5.5 ms postTransactionFee - 97.0 ms listStakePools - 1.2 ms getNetworkInfo - 0.1 ms Latencies for 2 fixture wallets with 100 txs scenario listWallets - 1.1 ms getWallet - 0.5 ms getUTxOsStatistics - 0.4 ms listAddresses - 1.0 ms listTransactions - 14.5 ms postTransactionFee - 95.1 ms listStakePools - 1.7 ms getNetworkInfo - 0.1 ms Latencies for 10 fixture wallets with 10 txs scenario listWallets - 4.4 ms getWallet - 0.5 ms getUTxOsStatistics - 0.3 ms listAddresses - 0.9 ms listTransactions - 4.3 ms postTransactionFee - 106.6 ms listStakePools - 1.3 ms getNetworkInfo - 0.0 ms Latencies for 10 fixture wallets with 20 txs scenario listWallets - 4.2 ms getWallet - 0.4 ms getUTxOsStatistics - 0.3 ms listAddresses - 0.9 ms listTransactions - 4.5 ms postTransactionFee - 106.6 ms listStakePools - 1.3 ms getNetworkInfo - 0.1 ms Latencies for 10 fixture wallets with 100 txs scenario listWallets - 4.5 ms getWallet - 0.5 ms getUTxOsStatistics - 0.4 ms listAddresses - 0.9 ms listTransactions - 15.8 ms postTransactionFee - 96.8 ms listStakePools - 1.6 ms getNetworkInfo - 0.1 ms Latencies for 2 fixture wallets with 100 utxos scenario listWallets - 1.7 ms getWallet - 0.5 ms getUTxOsStatistics - 0.4 ms listAddresses - 1.0 ms listTransactions - 12.2 ms postTransactionFee - 95.9 ms listStakePools - 1.4 ms getNetworkInfo - 0.0 ms Latencies for 2 fixture wallets with 200 utxos scenario listWallets - 1.7 ms getWallet - 0.5 ms getUTxOsStatistics - 0.4 ms listAddresses - 1.0 ms listTransactions - 25.1 ms postTransactionFee - 96.6 ms listStakePools - 1.4 ms getNetworkInfo - 0.1 ms Latencies for 2 fixture wallets with 500 utxos scenario listWallets - 1.6 ms getWallet - 0.5 ms getUTxOsStatistics - 0.4 ms listAddresses - 1.0 ms listTransactions - 69.7 ms postTransactionFee - 87.9 ms listStakePools - 1.5 ms getNetworkInfo - 0.0 ms Latencies for 2 fixture wallets with 1000 utxos scenario ``` <!-- Additional comments or screenshots to attach if any --> <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Assign the PR to a corresponding milestone ✓ Acknowledge any changes required to the Wiki --> Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io> Co-authored-by: Samuel Evans-Powell <mail@sevanspowell.net> Co-authored-by: Johannes Lund <johannes.lund@iohk.io>
2124: Add haskell program coverage reports to Hydra tests r=rvl a=rvl ### Issue Number ADP-99 ### Overview This is a bit of an assortment of nix build improvements. 1. Add a code test coverage report for the Hydra build - implemented by PR input-output-hk/haskell.nix#762 2. Add a nix-shell with profiled packages. Profiled packages will be built on Hydra for master branch but not PRs. This means you can download haskell dependencies with profiling enabled, rather than having to build everything yourself. 3. Update versions of build tools in the nix-shell to latest hackage release - ghcide, hlint and stylish-haskell updated. ### Comments - [Hydra jobset](https://hydra.iohk.io/jobset/Cardano/cardano-wallet-pr-2124) - [Coverage report job](https://hydra.iohk.io/job/Cardano/cardano-wallet-pr-2124/musl64.testCoverageReport.x86_64-linux/latest) - [Coverage report from bors try](https://hydra.iohk.io/build/4328848/download/2/hpc_index.html) <details> <summary>Stack coverage report for comparison</summary> #### Command ``` stack build --coverage --fast --test --skip integration --skip jormungandr-integration ``` #### Result: ``` ... Generating unified report 26% expressions used (26186/98111) 44% boolean coverage (136/305) 42% guards (102/240), 72 always True, 7 always False, 59 unevaluated 52% 'if' conditions (33/63), 4 always True, 8 always False, 18 unevaluated 50% qualifiers (1/2), 1 always True 40% alternatives used (849/2108) 58% local declarations used (859/1456) 50% top-level declarations used (1769/3533) The unified report is available at /home/rodney/iohk/cardano-wallet/.stack-work/install/x86_64-linux/2cecc28bf3aab8c8c3e4a07c1c6c1c846ec8861df3d8a5e9247bce185aeb7542/8.6.5/hpc/combined/all/hpc_index.html An index of the generated HTML coverage reports is available at /home/rodney/iohk/cardano-wallet/.stack-work/install/x86_64-linux/2cecc28bf3aab8c8c3e4a07c1c6c1c846ec8861df3d8a5e9247bce185aeb7542/8.6.5/hpc/index.html -- While building package cardano-wallet-2020.9.30 using: /home/rodney/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.4.0.1 build lib:cardano-wallet exe:cardano-wallet test:unit --ghc-options "-hpcdir .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/hpc -fdiagnostics-color=always" Process exited with code: ExitFailure 1 Progress 335/336 ``` </details> Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io> Co-authored-by: Samuel Evans-Powell <mail@sevanspowell.net>
Includes Samuel's coverage PR. input-output-hk/haskell.nix#762
2124: Add haskell program coverage reports to Hydra tests r=KtorZ a=rvl ### Issue Number ADP-99 ### Overview This is a bit of an assortment of nix build improvements. 1. Add a code test coverage report for the Hydra build - implemented by PR input-output-hk/haskell.nix#762 2. Add a nix-shell with profiled packages. Profiled packages will be built on Hydra for master branch but not PRs. This means you can download haskell dependencies with profiling enabled, rather than having to build everything yourself. 3. Update versions of build tools in the nix-shell to latest hackage release - ghcide, hlint and stylish-haskell updated. ### Comments - [Hydra jobset](https://hydra.iohk.io/jobset/Cardano/cardano-wallet-pr-2124) - [Coverage report job](https://hydra.iohk.io/job/Cardano/cardano-wallet-pr-2124/musl64.testCoverageReport.x86_64-linux/latest) - [Coverage report from bors try](https://hydra.iohk.io/build/4328848/download/2/hpc_index.html) <details> <summary>Stack coverage report for comparison</summary> #### Command ``` stack build --coverage --fast --test --skip integration --skip jormungandr-integration ``` #### Result: ``` ... Generating unified report 26% expressions used (26186/98111) 44% boolean coverage (136/305) 42% guards (102/240), 72 always True, 7 always False, 59 unevaluated 52% 'if' conditions (33/63), 4 always True, 8 always False, 18 unevaluated 50% qualifiers (1/2), 1 always True 40% alternatives used (849/2108) 58% local declarations used (859/1456) 50% top-level declarations used (1769/3533) The unified report is available at /home/rodney/iohk/cardano-wallet/.stack-work/install/x86_64-linux/2cecc28bf3aab8c8c3e4a07c1c6c1c846ec8861df3d8a5e9247bce185aeb7542/8.6.5/hpc/combined/all/hpc_index.html An index of the generated HTML coverage reports is available at /home/rodney/iohk/cardano-wallet/.stack-work/install/x86_64-linux/2cecc28bf3aab8c8c3e4a07c1c6c1c846ec8861df3d8a5e9247bce185aeb7542/8.6.5/hpc/index.html -- While building package cardano-wallet-2020.9.30 using: /home/rodney/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.4.0.1 build lib:cardano-wallet exe:cardano-wallet test:unit --ghc-options "-hpcdir .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/hpc -fdiagnostics-color=always" Process exited with code: ExitFailure 1 Progress 335/336 ``` </details> 2213: ADP-455: return unsigned delegation certificate r=KtorZ a=hasufell # Issue Number #2200 # Overview - [x] Added Api types - [x] Refactored some of the Transaction layer (still WIP) - [x] Factored out certificate creation from `joinStakePool` - [x] Added handler for joining stake pool - [x] Add handler for quitting stake pool - [x] serialization of certificates - [x] lots of cleanup - [x] fix jormungandr - [x] fix tests - [ ] add tests # Comments <!-- Additional comments or screenshots to attach if any --> <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Assign the PR to a corresponding milestone ✓ Acknowledge any changes required to the Wiki --> Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io> Co-authored-by: Samuel Evans-Powell <mail@sevanspowell.net> Co-authored-by: Julian Ospald <julian.ospald@iohk.io> Co-authored-by: KtorZ <matthias.benkort@gmail.com> Co-authored-by: Matthias Benkort <5680256+KtorZ@users.noreply.github.com>
- Added the ability to generate coverage reports for packages and projects. - Outputs mix and tix information, as well as a HTML report. - Added the "doCoverage" module option that allows users to choose packages to enable coverage for. - Added a "doCoverage" flag to the component builder that outputs HPC information when coverage is enabled. - Added the "overrideModules" library function to make it more ergonomic fo users to enable coverage on existing projects. - Modified the "check" builder to also output ".tix" files (if they exist). This information is required to generate the coverage report. - Added a test for coverage.
going to do that. Any advice would be appreciated. I know the plan
contains the test modules, but I'm not sure how to get access to
the plan.
nix-build <component>.coverageReport
.just per-component.