Skip to content

Commit e741842

Browse files
committed
Improve instructions
1 parent d88ee10 commit e741842

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
A wrapper around [`anchor test`] for computing test coverage
44

5+
`anchor-coverage` requires a patched Solana test validator (see below). The patch is known to work with Agave commit [cd29142](https://github.com/anza-xyz/agave/commit/cd291424d3d71c1a3be0c2c919916dcaa272d162).
6+
57
## Steps to use
68

7-
1. Install the Agave validator [from source] after adding the following to the `[patch.crates-io]` section near the end of its Cargo.toml:
9+
1. Clone the [Agave repository] and checkout the commit named above.
10+
11+
2. Add the following to the `[patch.crates-io]` section near the end of Agave's Cargo.toml, and install Agave [from source]:
812

913
```toml
1014
solana-sbpf = { git = "https://github.com/trail-of-forks/sbpf-coverage" }
@@ -18,23 +22,23 @@ A wrapper around [`anchor test`] for computing test coverage
1822
export PATH=$PWD/bin:$PATH
1923
```
2024

21-
2. Add the following to the `[profile.release]` section of your Anchor project's root Cargo.toml:
25+
3. Add the following to the `[profile.release]` section of your Anchor project's root Cargo.toml:
2226

2327
```toml
2428
debug = true
2529
```
2630

2731
This tells Cargo to build with debug information.
2832

29-
3. Run `anchor-coverage` as follows:
33+
4. Run `anchor-coverage` as follows:
3034

3135
```sh
3236
anchor-coverage [ANCHOR_TEST_ARGS]...
3337
```
3438

3539
This will create an `sbf_trace_dir` directory with an LCOV file for each executable run.
3640

37-
4. Run the following command to generate and open an HTML coverage report:
41+
5. Run the following command to generate and open an HTML coverage report:
3842

3943
```sh
4044
genhtml --output-directory coverage sbf_trace_dir/*.lcov && open coverage/index.html
@@ -72,6 +76,7 @@ The following is an example. The line with the assignment to `signer` is hit onl
7276

7377
- Useful reference re LCOV: https://github.com/linux-test-project/lcov/issues/113#issuecomment-762335134
7478

79+
[Agave repository]: https://github.com/anza-xyz/agave
7580
[LLVM instrumentation-based coverage]: https://llvm.org/docs/CoverageMappingFormat.html
7681
[`anchor test`]: https://www.anchor-lang.com/docs/references/cli#test
7782
[from source]: https://docs.anza.xyz/cli/install#building-from-source

0 commit comments

Comments
 (0)