Skip to content

Commit

Permalink
Fix code coverage measurements tasks to avoid overwriting the same fi…
Browse files Browse the repository at this point in the history
…le with profiling data. The different executables called by cargo test were fighting and replacing their recorded coverage data. See also rust-lang/rust#79899 for details. Also added tasks to delete any existing coverage data and reports to avoid conflicts with existing files.
  • Loading branch information
cry-inc committed Oct 16, 2023
1 parent fd72ea3 commit 0da9e9b
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,25 @@
],
"problemMatcher": []
},
{
"label": "Clean Coverage Data",
"type": "shell",
"command": "rm",
"args": [
"*.profraw"
],
"problemMatcher": []
},
{
"label": "Clean Coverage Report",
"type": "shell",
"command": "rm",
"args": [
"target/coverage_*",
"-R"
],
"problemMatcher": []
},
{
"label": "Measure Coverage",
"command": "cargo",
Expand All @@ -79,7 +98,7 @@
"env": {
"CARGO_INCREMENTAL": "0",
"RUSTFLAGS": "-Cinstrument-coverage",
"LLVM_PROFILE_FILE": "coverage.profraw"
"LLVM_PROFILE_FILE": "%m.profraw"
}
},
"problemMatcher": [
Expand All @@ -90,17 +109,15 @@
"label": "Export Coverage",
"command": "grcov",
"args": [
"coverage.profraw",
".",
"--binary-path",
"target/debug/deps/",
"target/debug",
"--source-dir",
".",
"src",
"--output-type",
"html",
"--output-path",
"target/coverage_html",
"--keep-only",
"src/**/*"
"target/coverage_html"
],
"problemMatcher": []
},
Expand All @@ -114,6 +131,8 @@
"label": "Code Coverage",
"dependsOrder": "sequence",
"dependsOn": [
"Clean Coverage Data",
"Clean Coverage Report",
"Measure Coverage",
"Export Coverage",
"Show Coverage"
Expand Down

0 comments on commit 0da9e9b

Please sign in to comment.