Skip to content

Commit

Permalink
xtask: Add --lcov switch to the coverage action
Browse files Browse the repository at this point in the history
This will be used to provide raw coverage data for the CI job.
  • Loading branch information
nicholasbishop committed Oct 8, 2024
1 parent 23b6d65 commit b99322d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 7 additions & 2 deletions xtask/src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ pub enum CargoAction {
Build,
Clippy,
Coverage {
lcov: bool,
open: bool,
},
Doc {
Expand Down Expand Up @@ -254,9 +255,13 @@ impl Cargo {
tool_args.extend(["-D", "warnings"]);
}
}
CargoAction::Coverage { open } => {
CargoAction::Coverage { lcov, open } => {
action = "llvm-cov";
extra_args.push("--html");
if lcov {
extra_args.extend(["--lcov", "--output-path", "target/llvm-cov/lcov"]);
} else {
extra_args.push("--html");
}
if open {
extra_args.push("--open");
}
Expand Down
2 changes: 1 addition & 1 deletion xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn clippy(opt: &ClippyOpt) -> Result<()> {
fn code_coverage(opt: &CovOpt) -> Result<()> {
if has_cmd("cargo-llvm-cov") {
let cargo = Cargo {
action: CargoAction::Coverage { open: opt.open },
action: CargoAction::Coverage { lcov: opt.lcov, open: opt.open },
features: Feature::more_code(*opt.unstable, false),
// Leave out uefi-macros; the compilation tests will just make
// things slower without contributing anything to the coverage
Expand Down
4 changes: 4 additions & 0 deletions xtask/src/opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ pub struct CovOpt {
#[clap(long, action)]
pub open: bool,

/// Output raw lcov data instead of HTML.
#[clap(long, action, conflicts_with = "open")]
pub lcov: bool,

#[clap(flatten)]
pub unstable: UnstableOpt,
}
Expand Down

0 comments on commit b99322d

Please sign in to comment.