Skip to content

Commit 5a938d1

Browse files
xtask: Add --lcov switch to the coverage action
This will be used to provide raw coverage data for the CI job.
1 parent 23b6d65 commit 5a938d1

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

xtask/src/cargo.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ pub enum CargoAction {
187187
Build,
188188
Clippy,
189189
Coverage {
190+
lcov: bool,
190191
open: bool,
191192
},
192193
Doc {
@@ -254,9 +255,13 @@ impl Cargo {
254255
tool_args.extend(["-D", "warnings"]);
255256
}
256257
}
257-
CargoAction::Coverage { open } => {
258+
CargoAction::Coverage { lcov, open } => {
258259
action = "llvm-cov";
259-
extra_args.push("--html");
260+
if lcov {
261+
extra_args.extend(["--lcov", "--output-path", "target/lcov"]);
262+
} else {
263+
extra_args.push("--html");
264+
}
260265
if open {
261266
extra_args.push("--open");
262267
}

xtask/src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ fn clippy(opt: &ClippyOpt) -> Result<()> {
8989
fn code_coverage(opt: &CovOpt) -> Result<()> {
9090
if has_cmd("cargo-llvm-cov") {
9191
let cargo = Cargo {
92-
action: CargoAction::Coverage { open: opt.open },
92+
action: CargoAction::Coverage {
93+
lcov: opt.lcov,
94+
open: opt.open,
95+
},
9396
features: Feature::more_code(*opt.unstable, false),
9497
// Leave out uefi-macros; the compilation tests will just make
9598
// things slower without contributing anything to the coverage

xtask/src/opt.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ pub struct CovOpt {
113113
#[clap(long, action)]
114114
pub open: bool,
115115

116+
/// Output raw lcov data instead of HTML.
117+
#[clap(long, action, conflicts_with = "open")]
118+
pub lcov: bool,
119+
116120
#[clap(flatten)]
117121
pub unstable: UnstableOpt,
118122
}

0 commit comments

Comments
 (0)