Skip to content

Commit

Permalink
Add TraceEngine option (hidden)
Browse files Browse the repository at this point in the history
Added the future TraceEngine option with current options Auto, Llvm and
Ptrace. Check it before doing the coverage instrumentation compiler
flags and warn if the user selects Llvm but they don't have a current
enough compiler
  • Loading branch information
xd009642 committed Feb 17, 2021
1 parent 4bda140 commit 88e2f0d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,9 @@ pub fn rust_flags(config: &Config) -> String {
if config.release {
value.push_str("-C debug-assertions=off ");
}
if config.engine == TraceEngine::Llvm && supports_llvm_coverage() {
if (config.engine == TraceEngine::Auto || config.engine == TraceEngine::Llvm)
&& supports_llvm_coverage()
{
value.push_str("-Z instrument-coverage ");
} else if config.engine == TraceEngine::Llvm {
error!(
Expand Down
4 changes: 2 additions & 2 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ impl Default for Config {
avoid_cfg_tarpaulin: false,
jobs: None,
color: Color::Auto,
engine: TraceEngine::Ptrace,
engine: TraceEngine::Auto,
}
}
}
Expand Down Expand Up @@ -303,7 +303,7 @@ impl<'a> From<&'a ArgMatches<'a>> for ConfigWrapper {
profile: get_profile(args),
metadata: RefCell::new(None),
avoid_cfg_tarpaulin: args.is_present("avoid-cfg-tarpaulin"),
engine: TraceEngine::Ptrace,
engine: TraceEngine::Auto,
};
if args.is_present("ignore-config") {
Self(vec![args_config])
Expand Down
1 change: 1 addition & 0 deletions src/config/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ arg_enum! {
arg_enum! {
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Ord, PartialOrd, Deserialize, Serialize)]
pub enum TraceEngine {
Auto,
Ptrace,
Llvm,
}
Expand Down

0 comments on commit 88e2f0d

Please sign in to comment.