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

Increase test coverage for statement-distribution #2329

Open
Sophia-Gold opened this issue Nov 14, 2023 · 2 comments
Open

Increase test coverage for statement-distribution #2329

Sophia-Gold opened this issue Nov 14, 2023 · 2 comments
Assignees

Comments

@Sophia-Gold
Copy link
Contributor

We should run code coverage on statement-distribution and add more tests for branches that aren't already covered.

@github-actions github-actions bot added the I10-unconfirmed Issue might be valid, but it's not yet known. label Nov 14, 2023
@Sophia-Gold Sophia-Gold removed the I10-unconfirmed Issue might be valid, but it's not yet known. label Nov 14, 2023
@mrcnski
Copy link
Contributor

mrcnski commented Nov 16, 2023

Coverage results

I managed to get some results with cargo llvm-cov:

https://app.codecov.io/gh/mrcnski/polkadot-sdk/blob/master/polkadot%2Fnode%2Fnetwork%2Fstatement-distribution%2Fsrc%2Fv2%2Fmod.rs (ignore the gum lines, don't know how to disable those.)

The results are worrying... There are some big untested paths, even entire untested functions:

This is using LLVM instrumentation which is supposed to provide the most accurate profiling.

Adding coverage for repo?

The profiling chokes on wasm, I guess that's why we don't use it. AFAICT it must be run on a per-crate basis. For example, it works on pvf-common but not on pvf, which has rococo-runtime as a dependency.

It does seem useful to run manually in targeted situations.

Instructions

These are the commands I ran:

cargo install cargo-llvm-cov
# runs `cargo test` with coverage profiling and opens report
cargo llvm-cov --open

To upload to codecov:

  1. Make a fork of polkadot-sdk
  2. Find the fork on codecov.io and follow instructions for setting up "Other CI"
  3. Run:
cargo llvm-cov --codecov --output-path codecov.json
bash <(curl -s https://codecov.io/bash) -f codecov.json

@mrcnski
Copy link
Contributor

mrcnski commented Nov 27, 2023

I also ran profiling for prospective-parachains and the coverage there is really good! We could just add a test for the remove_candidate function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Review in progress
Development

No branches or pull requests

2 participants