Skip to content

Commit 5dee68c

Browse files
authored
Remove reference to Rust gcda coverage (since it's now removed) (#1403)
Fixes #1240
1 parent 743a0b9 commit 5dee68c

File tree

1 file changed

+2
-53
lines changed

1 file changed

+2
-53
lines changed

README.md

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ This is a project initiated by Mozilla to gather code coverage results on Firefo
1919
- [Usage](#usage)
2020
- [Example: How to generate source-based coverage for a Rust project](#example-how-to-generate-source-based-coverage-for-a-rust-project)
2121
- [Example: How to generate .gcda files for C/C++](#example-how-to-generate-gcda-files-for-cc)
22-
- [Example: How to generate .gcda files for a Rust project](#example-how-to-generate-gcda-files-for-a-rust-project)
2322
- [Generate a coverage report from coverage artifacts](#generate-a-coverage-report-from-coverage-artifacts)
2423
- [LCOV output](#lcov-output)
2524
- [Coveralls output](#coveralls-output)
@@ -223,37 +222,12 @@ you can run `cargo install grcov`.
223222

224223
In the CWD, you will see a `.profraw` file has been generated. This contains the profiling information that grcov will parse, alongside with your binaries.
225224

225+
Note that gcov coverage using the `-Zprofile` flag is no longer supported in Rust (details [here](https://github.com/rust-lang/rust/pull/131829)). Use source based coverage and the `-Cinstrument-coverage` flag instead.
226+
226227
### Example: How to generate .gcda files for C/C++
227228

228229
Pass `--coverage` to `clang` or `gcc` (or for older gcc versions pass `-ftest-coverage` and `-fprofile-arcs` options (see [gcc docs](https://gcc.gnu.org/onlinedocs/gcc/Gcov-Data-Files.html)).
229230

230-
### Example: How to generate .gcda files for a Rust project
231-
232-
**Nightly Rust is required** to use grcov for Rust gcov-based coverage. Alternatively, you can `export
233-
RUSTC_BOOTSTRAP=1`, which basically turns your stable rustc into a Nightly one.
234-
235-
1. Ensure that the following environment variables are set up:
236-
237-
```sh
238-
export CARGO_INCREMENTAL=0
239-
export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
240-
export RUSTDOCFLAGS="-Cpanic=abort"
241-
```
242-
243-
These will ensure that things like dead code elimination do not skew the coverage.
244-
245-
2. Build your code:
246-
247-
`cargo build`
248-
249-
If you look in `target/debug/deps` dir you will see `.gcno` files have appeared. These are the locations that could be covered.
250-
251-
3. Run your tests:
252-
253-
`cargo test`
254-
255-
In the `target/debug/deps/` dir you will now also see `.gcda` files. These contain the hit counts on which of those locations have been reached. Both sets of files are used as inputs to `grcov`.
256-
257231
### Generate a coverage report from coverage artifacts
258232

259233
Generate a html coverage report like this:
@@ -310,31 +284,6 @@ script:
310284
- bash <(curl -s https://codecov.io/bash) -f lcov.info
311285
```
312286
313-
Here is an example of .travis.yml file:
314-
315-
```yaml
316-
language: rust
317-
318-
before_install:
319-
- curl -L https://github.com/mozilla/grcov/releases/latest/download/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf -
320-
321-
matrix:
322-
include:
323-
- os: linux
324-
rust: stable
325-
326-
script:
327-
- export CARGO_INCREMENTAL=0
328-
- export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
329-
- export RUSTDOCFLAGS="-Cpanic=abort"
330-
- cargo build --verbose $CARGO_OPTIONS
331-
- cargo test --verbose $CARGO_OPTIONS
332-
- |
333-
zip -0 ccov.zip `find . \( -name "YOUR_PROJECT_NAME*.gc*" \) -print`;
334-
./grcov ccov.zip -s . -t lcov --llvm --branch --ignore-not-existing --ignore "/*" -o lcov.info;
335-
bash <(curl -s https://codecov.io/bash) -f lcov.info;
336-
```
337-
338287
#### grcov with Gitlab
339288
340289
Here is an example `.gitlab-ci.yml` which will build your project, then collect coverage data in a format that Gitlab understands. It is assumed that you'll use an image which already has relevant tools installed, if that's not the case put the appropriate commands at the beginning of the `script` stanza.

0 commit comments

Comments
 (0)