You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-53Lines changed: 2 additions & 53 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,6 @@ This is a project initiated by Mozilla to gather code coverage results on Firefo
19
19
-[Usage](#usage)
20
20
-[Example: How to generate source-based coverage for a Rust project](#example-how-to-generate-source-based-coverage-for-a-rust-project)
21
21
-[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)
23
22
-[Generate a coverage report from coverage artifacts](#generate-a-coverage-report-from-coverage-artifacts)
24
23
-[LCOV output](#lcov-output)
25
24
-[Coveralls output](#coveralls-output)
@@ -223,37 +222,12 @@ you can run `cargo install grcov`.
223
222
224
223
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.
225
224
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
+
226
227
### Example: How to generate .gcda files for C/C++
227
228
228
229
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)).
229
230
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:
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
-
257
231
### Generate a coverage report from coverage artifacts
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