From 546493ed96dede3fb4e2638c9487607aee866e23 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 15 Feb 2021 10:35:43 +0400 Subject: [PATCH 01/48] Bump quote from 1.0.8 to 1.0.9 (#685) Bumps [quote](https://github.com/dtolnay/quote) from 1.0.8 to 1.0.9. - [Release notes](https://github.com/dtolnay/quote/releases) - [Commits](https://github.com/dtolnay/quote/compare/1.0.8...1.0.9) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 29b9d2f373..07a864ac66 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -614,9 +614,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ "proc-macro2", ] From 435cf4d30636d79200c8e8bc39169abb19638e60 Mon Sep 17 00:00:00 2001 From: xd009642 Date: Mon, 15 Feb 2021 18:57:29 +0400 Subject: [PATCH 02/48] Update readme Removed mention of being in early development, as I think we've progressed past that. Also removed things that are done from the roadmap and added some new things --- README.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b3e1b174f0..90a7111d18 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,12 @@ [![Docker](https://img.shields.io/docker/automated/xd009642/tarpaulin.svg)](https://hub.docker.com/r/xd009642/tarpaulin/) [![Developers Wiki](https://img.shields.io/badge/development-wiki-yellowgreen.svg)](https://github.com/xd009642/tarpaulin/wiki/Developers) -Tarpaulin is designed to be a code coverage reporting tool for the Cargo build -system, named for a waterproof cloth used to cover cargo on a ship. Currently, -tarpaulin provides working line coverage but is still in the early development -stage and therefore may contain some bugs. A lot of work has been done to get it -working on some example projects and smaller crates so please report anything +Tarpaulin is a code coverage reporting tool for the Cargo build system, named +for a waterproof cloth used to cover cargo on a ship. Currently, tarpaulin +provides working line coverage and while fairly reliable may still contain +minor inaccuracies in the results. A lot of work has been done to get it +working on a wide range of projects, but often unique combinations of packages +and build features can cause issues so please report anything you find that's wrong. Also, check out our roadmap for planned features. **Tarpaulin only supports x86_64 processors running Linux.** This is because @@ -530,14 +531,11 @@ accuracy. If you see missing lines or files, check your compiler version. ## Roadmap -* [x] Line coverage for tests * [ ] Branch coverage for tests * [ ] Condition coverage for tests -* [x] Annotated coverage reports -* [x] Coverage reports in the style of existing tools (i.e. kcov) -* [x] Integration with 3rd party tools like coveralls or codecov -* [x] Optional coverage statistics for doctests (nightly only [tracking issue](https://github.com/rust-lang/rust/issues/56925)) * [ ] MCDC coverage reports +* [ ] LLVM coverage support +* [ ] Support for embedded targets * [ ] OSX support * [ ] Windows support From 9b4396a8c7dee94050ac87d8d85b1b25bf0569c7 Mon Sep 17 00:00:00 2001 From: xd009642 Date: Wed, 17 Feb 2021 00:01:22 +0400 Subject: [PATCH 03/48] Fixes #601 (#687) This detects if the user has set -Cdebuginfo in their rustflags and removes this as tarpaulin sets it and requires it to get debug info for traces. --- CHANGELOG.md | 1 + src/cargo.rs | 7 ++++++- tests/line_coverage.rs | 21 +++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ac7ee8d24..cdeaf36b2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ file. - Added `--color` option matching cargo arg - `--follow-exec` option making exec tracing non-default - `--jobs` option matching the one in cargo test +- Check if user sets -Cdebuginfo and remove it #601 ### Changed - Check through memory map for the first entry belonging to the executable [FIX] diff --git a/src/cargo.rs b/src/cargo.rs index 5eb826d7c4..2a69b84886 100644 --- a/src/cargo.rs +++ b/src/cargo.rs @@ -2,6 +2,8 @@ use crate::config::*; use crate::errors::RunError; use crate::path_utils::get_source_walker; use cargo_metadata::{diagnostic::DiagnosticLevel, CargoOpt, Message, Metadata, MetadataCommand}; +use lazy_static::lazy_static; +use regex::Regex; use serde::{Deserialize, Serialize}; use std::collections::{HashMap, HashSet}; use std::env; @@ -479,7 +481,10 @@ pub fn rust_flags(config: &Config) -> String { value = format!("{}-C debug-assertions=off ", value); } if let Ok(vtemp) = env::var(RUSTFLAGS) { - value.push_str(vtemp.as_ref()); + lazy_static! { + static ref DEBUG_INFO: Regex = Regex::new(r#"\-C\s*debuginfo=\d"#).unwrap(); + } + value.push_str(&DEBUG_INFO.replace_all(&vtemp, " ")); } value } diff --git a/tests/line_coverage.rs b/tests/line_coverage.rs index 2c7fe1ad54..425f7caabb 100644 --- a/tests/line_coverage.rs +++ b/tests/line_coverage.rs @@ -45,3 +45,24 @@ fn simple_project_coverage() { } } } + +#[test] +fn debug_info_0() { + // From issue #601 + let mut config = Config::default(); + let restore_dir = env::current_dir().unwrap(); + let test_dir = get_test_path("simple_project"); + env::set_current_dir(&test_dir).unwrap(); + config.manifest = test_dir.clone(); + config.manifest.push("Cargo.toml"); + let backup_flag = env::var("RUSTFLAGS").ok(); + env::set_var("RUSTFLAGS", "-Cdebuginfo=0"); + let (res, ret) = launch_tarpaulin(&config, &None).unwrap(); + match backup_flag { + None => env::remove_var("RUSTFLAGS"), + Some(s) => env::set_var("RUSTFLAGS", s), + }; + assert_eq!(ret, 0); + assert!(!res.is_empty()); + env::set_current_dir(restore_dir).unwrap(); +} From 837ca1f23595538c9d09b76568f805ba0ccd61e7 Mon Sep 17 00:00:00 2001 From: xd009642 Date: Wed, 17 Feb 2021 22:42:08 +0400 Subject: [PATCH 04/48] Attempt to fix doctests (#688) * Attempt to fix doctests Once again the binary naming scheme has changed. Hopefully this is generic enough without being too generic so it works. I also thought there was a need to know the version but scrapped that but the code is nice and useful for other things so keeping it * Fix old design left in * Update changelog --- .github/workflows/rust.yml | 2 ++ CHANGELOG.md | 1 + src/cargo.rs | 44 +++++++++++++++++++++++++++++++++++--- 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 6609aecefc..0c1ff48c99 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -15,6 +15,8 @@ jobs: - stable - beta - nightly + - nightly-2021-02-11 + - nightly-2021-01-25 target: - x86_64-unknown-linux-gnu - x86_64-unknown-linux-musl diff --git a/CHANGELOG.md b/CHANGELOG.md index cdeaf36b2c..96f4325ca1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ file. - Hidden file filtering only applied for folders inside project directory not any folder on path. Fixes #682 - Removed unimplemented `toml` report +- Make doctest prefix matching less specific as the naming convention changed again ### Removed diff --git a/src/cargo.rs b/src/cargo.rs index 2a69b84886..7d4477c29a 100644 --- a/src/cargo.rs +++ b/src/cargo.rs @@ -15,6 +15,15 @@ use std::process::{Command, Stdio}; use tracing::{error, trace, warn}; use walkdir::{DirEntry, WalkDir}; +#[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] +struct CargoVersionInfo { + major: usize, + minor: usize, + year: usize, + month: usize, + day: usize, +} + #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Deserialize, Serialize)] pub struct TestBinary { path: PathBuf, @@ -97,6 +106,37 @@ impl DocTestBinaryMeta { } } +lazy_static! { + static ref CARGO_VERSION_INFO: Option = { + let version_info = + Regex::new(r"cargo (\d)\.(\d+)\.\d+\-nightly \([[:alnum:]]+ (\d{4})-(\d{2})-(\d{2})\)") + .unwrap(); + Command::new("cargo") + .arg("--version") + .output() + .map(|x| { + let s = String::from_utf8_lossy(&x.stdout); + if let Some(cap) = version_info.captures(&s) { + let major = cap[1].parse().unwrap(); + let minor = cap[2].parse().unwrap(); + let year = cap[3].parse().unwrap(); + let month = cap[4].parse().unwrap(); + let day = cap[5].parse().unwrap(); + Some(CargoVersionInfo { + major, + minor, + year, + month, + day, + }) + } else { + None + } + }) + .unwrap_or(None) + }; +} + pub fn get_tests(config: &Config) -> Result, RunError> { let mut result = vec![]; let manifest = match config.manifest.as_path().to_str() { @@ -201,7 +241,6 @@ fn run_cargo( .filter_map(|e| e.ok()) .filter(|e| matches!(e.metadata(), Ok(ref m) if m.is_file() && m.len() != 0)) .collect::>(); - let should_panics = get_panic_candidates(&dir_entries, config); for dt in &dir_entries { let mut tb = TestBinary::new(dt.path().to_path_buf(), ty); @@ -245,7 +284,7 @@ fn convert_to_prefix(p: &Path) -> Option { fn is_prefix_match(prefix: &str, entry: &Path) -> bool { convert_to_prefix(entry) - .map(|s| prefix.ends_with(&s)) + .map(|s| s.contains(prefix)) .unwrap_or(false) } @@ -271,7 +310,6 @@ fn get_panic_candidates(tests: &[DirEntry], config: &Config) -> HashMap Date: Thu, 18 Feb 2021 10:09:41 +0400 Subject: [PATCH 05/48] Bump tracing from 0.1.23 to 0.1.24 (#690) Bumps [tracing](https://github.com/tokio-rs/tracing) from 0.1.23 to 0.1.24. - [Release notes](https://github.com/tokio-rs/tracing/releases) - [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.23...tracing-0.1.24) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 07a864ac66..84f757e742 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -843,9 +843,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d40a22fd029e33300d8d89a5cc8ffce18bb7c587662f54629e94c9de5487f3" +checksum = "f77d3842f76ca899ff2dbcf231c5c65813dea431301d6eb686279c15c4464f12" dependencies = [ "cfg-if 1.0.0", "pin-project-lite", @@ -855,9 +855,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f080ea7e4107844ef4766459426fa2d5c1ada2e47edba05dc7fa99d9629f47" +checksum = "a8a9bd1db7706f2373a190b0d067146caa39350c486f3d455b0e33b431f94c07" dependencies = [ "proc-macro2", "quote", From b2b8801b981d0271256eeac1d0672c7e2808d7a1 Mon Sep 17 00:00:00 2001 From: xd009642 Date: Thu, 18 Feb 2021 23:23:26 +0400 Subject: [PATCH 06/48] llvm-cov support pt1 (#653) * Build tests with llvm cov instr * Better detection of support and report naming Report naming clashes would cause issues with reports being overwritten so now add the process PID into the report filename. Also use a regex to get the version of rust being used and make sure it's >= 1.50.0-nightly * fix tests * Add doctest llvm coverage * Add a TraceEngine arg It's currently hardcoded to Ptrace to enable this to be merged but it will allow switching between the two and eventual smart default selection * Add TraceEngine option (hidden) 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 * Remove llvm cov flag from doctest * Add channel to version info Rework LLVM cov detection to be contained within the CargoVersionInfo type and refactor tests. Improve version regex to handle stable and beta * Disable LLVM pre-merge Remove llvm args and set engine pre-release * Update changelog and fix last two entries --- .gitignore | 1 + CHANGELOG.md | 14 ++++++- src/cargo.rs | 97 +++++++++++++++++++++++++++++++++++++++++---- src/config/mod.rs | 4 ++ src/config/types.rs | 9 +++++ src/lib.rs | 4 ++ 6 files changed, 119 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 5c62a69768..15d9b351e0 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,6 @@ target/ *.log *.profdata *.profraw +*.profdata # Generated by IntelliJ IDEs .idea diff --git a/CHANGELOG.md b/CHANGELOG.md index 96f4325ca1..4c2f341c70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,12 +3,23 @@ From 2019 onwards, all notable changes to tarpaulin will be documented in this file. +## [Unreleased] +### Added +- Check if user sets -Cdebuginfo and remove it #601 +- INTERNAL Added ability to build with LLVM coverage instrumentation and detect +compiler support. This isn't enabled so should have no effect it's just the +start of the support work. + +### Changed +- Make doctest prefix matching less specific as the naming convention changed again + +### Removed + ## [0.18.0-alpha1] 2021-02-14 ### Added - Added `--color` option matching cargo arg - `--follow-exec` option making exec tracing non-default - `--jobs` option matching the one in cargo test -- Check if user sets -Cdebuginfo and remove it #601 ### Changed - Check through memory map for the first entry belonging to the executable [FIX] @@ -21,7 +32,6 @@ file. - Hidden file filtering only applied for folders inside project directory not any folder on path. Fixes #682 - Removed unimplemented `toml` report -- Make doctest prefix matching less specific as the naming convention changed again ### Removed diff --git a/src/cargo.rs b/src/cargo.rs index 7d4477c29a..031fbe27de 100644 --- a/src/cargo.rs +++ b/src/cargo.rs @@ -15,15 +15,29 @@ use std::process::{Command, Stdio}; use tracing::{error, trace, warn}; use walkdir::{DirEntry, WalkDir}; +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] +enum Channel { + Stable, + Beta, + Nightly, +} + #[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] struct CargoVersionInfo { major: usize, minor: usize, + channel: Channel, year: usize, month: usize, day: usize, } +impl CargoVersionInfo { + fn supports_llvm_cov(&self) -> bool { + self.minor >= 50 && self.channel == Channel::Nightly + } +} + #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Deserialize, Serialize)] pub struct TestBinary { path: PathBuf, @@ -108,9 +122,10 @@ impl DocTestBinaryMeta { lazy_static! { static ref CARGO_VERSION_INFO: Option = { - let version_info = - Regex::new(r"cargo (\d)\.(\d+)\.\d+\-nightly \([[:alnum:]]+ (\d{4})-(\d{2})-(\d{2})\)") - .unwrap(); + let version_info = Regex::new( + r"cargo (\d)\.(\d+)\.\d+([\-betanightly]*) \([[:alnum:]]+ (\d{4})-(\d{2})-(\d{2})\)", + ) + .unwrap(); Command::new("cargo") .arg("--version") .output() @@ -119,12 +134,20 @@ lazy_static! { if let Some(cap) = version_info.captures(&s) { let major = cap[1].parse().unwrap(); let minor = cap[2].parse().unwrap(); - let year = cap[3].parse().unwrap(); - let month = cap[4].parse().unwrap(); - let day = cap[5].parse().unwrap(); + // We expect a string like `cargo 1.50.0-nightly (a0f433460 2020-02-01) + // the version number either has `-nightly` `-beta` or empty for stable + let channel = match &cap[3] { + "-nightly" => Channel::Nightly, + "-beta" => Channel::Beta, + _ => Channel::Stable, + }; + let year = cap[4].parse().unwrap(); + let month = cap[5].parse().unwrap(); + let day = cap[6].parse().unwrap(); Some(CargoVersionInfo { major, minor, + channel, year, month, day, @@ -493,6 +516,16 @@ fn clean_doctest_folder>(doctest_dir: P) { } } +fn handle_llvm_flags(value: &mut String, config: &Config) { + 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!("unable to utilise llvm coverage, due to compiler support. Falling back to Ptrace"); + } +} + pub fn rustdoc_flags(config: &Config) -> String { const RUSTDOC: &str = "RUSTDOCFLAGS"; let common_opts = " -C link-dead-code -C debuginfo=2 --cfg=tarpaulin "; @@ -506,6 +539,7 @@ pub fn rustdoc_flags(config: &Config) -> String { value.push_str(vtemp.as_ref()); } } + handle_llvm_flags(&mut value, config); value } @@ -513,11 +547,12 @@ pub fn rust_flags(config: &Config) -> String { const RUSTFLAGS: &str = "RUSTFLAGS"; let mut value = " -C link-dead-code -C debuginfo=2 ".to_string(); if !config.avoid_cfg_tarpaulin { - value = format!("{}--cfg=tarpaulin ", value); + value.push_str("--cfg=tarpaulin "); } if config.release { - value = format!("{}-C debug-assertions=off ", value); + value.push_str("-C debug-assertions=off "); } + handle_llvm_flags(&mut value, config); if let Ok(vtemp) = env::var(RUSTFLAGS) { lazy_static! { static ref DEBUG_INFO: Regex = Regex::new(r#"\-C\s*debuginfo=\d"#).unwrap(); @@ -538,3 +573,49 @@ fn setup_environment(cmd: &mut Command, config: &Config) { trace!("Setting RUSTDOCFLAGS='{}'", value); cmd.env(rustdoc, value); } + +fn supports_llvm_coverage() -> bool { + if let Some(version) = CARGO_VERSION_INFO.as_ref() { + version.supports_llvm_cov() + } else { + false + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn llvm_cov_compatible_version() { + let version = CargoVersionInfo { + major: 1, + minor: 50, + channel: Channel::Nightly, + year: 2020, + month: 12, + day: 22, + }; + assert!(version.supports_llvm_cov()); + } + + #[test] + fn llvm_cov_incompatible_version() { + let mut version = CargoVersionInfo { + major: 1, + minor: 48, + channel: Channel::Stable, + year: 2020, + month: 10, + day: 14, + }; + assert!(!version.supports_llvm_cov()); + version.channel = Channel::Beta; + assert!(!version.supports_llvm_cov()); + version.minor = 50; + assert!(!version.supports_llvm_cov()); + version.minor = 58; + version.channel = Channel::Stable; + assert!(!version.supports_llvm_cov()); + } +} diff --git a/src/config/mod.rs b/src/config/mod.rs index 7bf3d74022..721d959934 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -165,6 +165,8 @@ pub struct Config { pub follow_exec: bool, /// Number of jobs used for building the tests pub jobs: Option, + /// Engine to use to collect coverage + pub engine: TraceEngine, } fn default_test_timeout() -> Duration { @@ -227,6 +229,7 @@ impl Default for Config { avoid_cfg_tarpaulin: false, jobs: None, color: Color::Auto, + engine: TraceEngine::Ptrace, } } } @@ -300,6 +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, }; if args.is_present("ignore-config") { Self(vec![args_config]) diff --git a/src/config/types.rs b/src/config/types.rs index 2ccb7d1d8e..c529ecf8f6 100644 --- a/src/config/types.rs +++ b/src/config/types.rs @@ -12,6 +12,15 @@ arg_enum! { } } +arg_enum! { + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Ord, PartialOrd, Deserialize, Serialize)] + pub enum TraceEngine { + Auto, + Ptrace, + Llvm, + } +} + arg_enum! { #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Ord, PartialOrd, Deserialize, Serialize)] pub enum Mode { diff --git a/src/lib.rs b/src/lib.rs index ad8a0a015e..901ad092a2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -329,6 +329,10 @@ fn execute_test(test: &TestBinary, ignored: bool, config: &Config) -> Result<(), envars .push(CString::new(format!("CARGO_MANIFEST_DIR={}", s.display())).unwrap_or_default()); } + if config.engine == TraceEngine::Llvm || config.engine == TraceEngine::Auto { + // Used for llvm coverage to avoid report naming clashes + envars.push(CString::new("LLVM_PROFILE_FILE=default_%p.profraw").unwrap_or_default()); + } execute(exec_path, &argv, envars.as_slice()) } From 33afa53895208b1a55b797be47a086f2ad9a1ec6 Mon Sep 17 00:00:00 2001 From: xd009642 Date: Fri, 19 Feb 2021 19:48:30 +0400 Subject: [PATCH 07/48] Feature/fail under report (#692) * report if under failure threshold I found one path where the failure threshold wasn't done if it wasn't met * Update changelog --- CHANGELOG.md | 1 + src/lib.rs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c2f341c70..fa6189fc4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ start of the support work. ### Changed - Make doctest prefix matching less specific as the naming convention changed again +- Ensure report is always generated if coverage is below failure threshold ### Removed diff --git a/src/lib.rs b/src/lib.rs index 901ad092a2..11e61a9629 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -111,7 +111,10 @@ pub fn trace(configs: &[Config]) -> Result { match launch_tarpaulin(config, &logger) { Ok((t, r)) => { ret |= r; - bad_threshold = check_fail_threshold(&t, config); + if configs.len() > 1 { + // Otherwise threshold is a global one and we'll let the caller handle it + bad_threshold = check_fail_threshold(&t, config); + } tracemap.merge(&t); } Err(e) => { @@ -122,6 +125,8 @@ pub fn trace(configs: &[Config]) -> Result { } tracemap.dedup(); if let Some(bad_limit) = bad_threshold { + // Failure threshold probably more important than reporting failing + let _ = report_coverage(&configs[0], &tracemap); Err(bad_limit) } else if ret == 0 { tarpaulin_result.map(|_| tracemap) @@ -153,6 +158,9 @@ pub fn run(configs: &[Config]) -> Result<(), RunError> { if configs.len() == 1 { if !configs[0].no_run { report_coverage(&configs[0], &tracemap)?; + if let Some(e) = check_fail_threshold(&tracemap, &configs[0]) { + return Err(e); + } } } else if !configs.is_empty() { let mut reported = false; @@ -167,6 +175,9 @@ pub fn run(configs: &[Config]) -> Result<(), RunError> { } if !configs[0].no_run && !reported { report_coverage(&configs[0], &tracemap)?; + if let Some(e) = check_fail_threshold(&tracemap, &configs[0]) { + return Err(e); + } } } From 670c31af2a5d8d82b462ce38b43d60607478222d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 22 Feb 2021 10:05:22 +0400 Subject: [PATCH 08/48] Bump nix from 0.19.1 to 0.20.0 (#693) Bumps [nix](https://github.com/nix-rust/nix) from 0.19.1 to 0.20.0. - [Release notes](https://github.com/nix-rust/nix/releases) - [Changelog](https://github.com/nix-rust/nix/blob/master/CHANGELOG.md) - [Commits](https://github.com/nix-rust/nix/commits) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 84f757e742..d92cb69eb2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -484,9 +484,9 @@ dependencies = [ [[package]] name = "nix" -version = "0.19.1" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ccba0cfe4fdf15982d1674c69b1fd80bad427d293849982668dfe454bd61f2" +checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" dependencies = [ "bitflags", "cc", diff --git a/Cargo.toml b/Cargo.toml index 7366aff6b2..643a3fc7d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ libc = "0.2.86" tracing = { version = "0.1", default-features = false } tracing-subscriber = {version = "0.2.15", default-features = false, features = ["env-filter", "fmt", "chrono", "ansi", "smallvec", "tracing-log"]} memmap = "0.7.0" -nix = "0.19.1" +nix = "0.20.0" object = "0.23" procfs = "0.9" proc-macro2 = { version = "1.0", features = ["span-locations"] } From 8cffbbc8f960dbfa8e600e2d5feb4f70b61bee8a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 22 Feb 2021 10:05:34 +0400 Subject: [PATCH 09/48] Bump tracing-subscriber from 0.2.15 to 0.2.16 (#694) Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.2.15 to 0.2.16. - [Release notes](https://github.com/tokio-rs/tracing/releases) - [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.2.15...tracing-subscriber-0.2.16) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 20 ++++---------------- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d92cb69eb2..42981c10d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -849,21 +849,9 @@ checksum = "f77d3842f76ca899ff2dbcf231c5c65813dea431301d6eb686279c15c4464f12" dependencies = [ "cfg-if 1.0.0", "pin-project-lite", - "tracing-attributes", "tracing-core", ] -[[package]] -name = "tracing-attributes" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a9bd1db7706f2373a190b0d067146caa39350c486f3d455b0e33b431f94c07" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "tracing-core" version = "0.1.17" @@ -875,9 +863,9 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e0f8c7178e13481ff6765bd169b33e8d554c5d2bbede5e32c356194be02b9b9" +checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3" dependencies = [ "lazy_static", "log", @@ -886,9 +874,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1fa8f0c8f4c594e4fc9debc1990deab13238077271ba84dd853d54902ee3401" +checksum = "8ab8966ac3ca27126141f7999361cc97dd6fb4b71da04c02044fa9045d98bb96" dependencies = [ "ansi_term 0.12.1", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 643a3fc7d7..4b5fd79c11 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ indexmap = { version = "1.6.1", features = ["serde-1"] } lazy_static = "1.0" libc = "0.2.86" tracing = { version = "0.1", default-features = false } -tracing-subscriber = {version = "0.2.15", default-features = false, features = ["env-filter", "fmt", "chrono", "ansi", "smallvec", "tracing-log"]} +tracing-subscriber = {version = "0.2.16", default-features = false, features = ["env-filter", "fmt", "chrono", "ansi", "smallvec", "tracing-log"]} memmap = "0.7.0" nix = "0.20.0" object = "0.23" From 3ec6ed8e3f14abd4d3cc38036734907dc8f96f7a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 24 Feb 2021 10:57:37 +0400 Subject: [PATCH 10/48] Bump quick-xml from 0.21.0 to 0.22.0 (#695) Bumps [quick-xml](https://github.com/tafia/quick-xml) from 0.21.0 to 0.22.0. - [Release notes](https://github.com/tafia/quick-xml/releases) - [Changelog](https://github.com/tafia/quick-xml/blob/master/Changelog.md) - [Commits](https://github.com/tafia/quick-xml/compare/v0.21.0...v0.22.0) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 42981c10d0..efbd5562cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -605,9 +605,9 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0452695941410a58c8ce4391707ba9bad26a247173bd9886a05a5e8a8babec75" +checksum = "8533f14c8382aaad0d592c812ac3b826162128b65662331e1127b45c3d18536b" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index 4b5fd79c11..26016107bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ nix = "0.20.0" object = "0.23" procfs = "0.9" proc-macro2 = { version = "1.0", features = ["span-locations"] } -quick-xml = "0.21" +quick-xml = "0.22" quote = "1.0" regex = "1.4" rustc-demangle = "0.1.18" From 9782d0395dc09cebbc3db655e56ece21c952e95c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 24 Feb 2021 10:58:36 +0400 Subject: [PATCH 11/48] Bump tracing from 0.1.24 to 0.1.25 (#696) Bumps [tracing](https://github.com/tokio-rs/tracing) from 0.1.24 to 0.1.25. - [Release notes](https://github.com/tokio-rs/tracing/releases) - [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.24...tracing-0.1.25) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index efbd5562cd..8e57d12e0a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -843,9 +843,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.24" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f77d3842f76ca899ff2dbcf231c5c65813dea431301d6eb686279c15c4464f12" +checksum = "01ebdc2bb4498ab1ab5f5b73c5803825e60199229ccba0698170e3be0e7f959f" dependencies = [ "cfg-if 1.0.0", "pin-project-lite", From b2611b80cc1f857b1b2827ab5a2448aba86bd888 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 26 Feb 2021 11:04:27 +0400 Subject: [PATCH 12/48] Bump serde_json from 1.0.62 to 1.0.63 (#697) Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.62 to 1.0.63. - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.62...v1.0.63) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8e57d12e0a..d703e058da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -730,9 +730,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.62" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea1c6153794552ea7cf7cf63b1231a25de00ec90db326ba6264440fa08e31486" +checksum = "43535db9747a4ba938c0ce0a98cc631a46ebf943c9e1d604e091df6007620bf6" dependencies = [ "itoa", "ryu", From 7d5f37f624e5ce68a7b91f2a0fb04553bcb93862 Mon Sep 17 00:00:00 2001 From: xd009642 Date: Fri, 26 Feb 2021 21:35:31 +0400 Subject: [PATCH 13/48] Feature/fix cross compilation (#698) * Start working on making cross compilation work * Made parts of the event logger that took linuxy types cfg(unix) * Make ptrace_control cfg(unix) * Make nix errors cfg(unix) * Make libc, nix and procfs unix only dependencies * Reshuffle and move to target_os instead of unix * The unix feature would lead to things being compiled on macos and BSDs that doesn't work so moved to more specific target_os = linux. * Moved breakpoint and ptrace to the process_handling module * Move some Pid usage to a ProcessHandle type * Add windows and mac to CI * Make it look like CI passes Why doesn't github actions have allow-failures as a tag smh * Get tarpaulin compiling on windows * Added a bunch of stub functions that currently do nothing. * So many warnings * Hopefully fix apple compilation. Remove the old apple executing code. It has nae function and we're going llvm for apple anyway instead of fucking around with it's stupid system APIs. * Rearrange further I didn't like calling into process_handling module, then back into things in the root then back into process_handling. So a bit of a tidy up. More tidying up will be needed at some point, however I see a lot of this changing as I add in the ability to switch between engines so I'm okay with leaving it in this state * fix multiple imports * Add a dummy step so I can see the logging * remove dummy * Update changelog --- .github/workflows/rust.yml | 48 ++++++- CHANGELOG.md | 3 + Cargo.lock | 1 + Cargo.toml | 9 +- src/errors/mod.rs | 4 + src/event_log.rs | 25 ++-- src/lib.rs | 131 +------------------ src/{ => process_handling}/breakpoint.rs | 0 src/process_handling/linux.rs | 49 +++++++ src/process_handling/mac.rs | 38 ------ src/process_handling/mod.rs | 126 ++++++++++++++++-- src/{ => process_handling}/ptrace_control.rs | 0 src/statemachine/linux.rs | 3 +- src/statemachine/mod.rs | 57 ++++++-- src/test_loader.rs | 8 ++ 15 files changed, 300 insertions(+), 202 deletions(-) rename src/{ => process_handling}/breakpoint.rs (100%) delete mode 100644 src/process_handling/mac.rs rename src/{ => process_handling}/ptrace_control.rs (100%) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0c1ff48c99..94cf88a573 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -7,7 +7,7 @@ on: pull_request: jobs: - build: + linux: runs-on: ubuntu-latest strategy: matrix: @@ -31,7 +31,7 @@ jobs: - name: clean run: cargo clean - name: build - run: cargo build --verbose + run: cargo build env: RUST_BACKTRACE: 1 - name: test @@ -52,3 +52,47 @@ jobs: --data '{"build": true}' \ https://registry.hub.docker.com/u/xd009642/tarpaulin/trigger/${{ secrets.DOCKER_TOKEN }}/ if: github.ref == 'ref/heads/master' || github.ref == 'refs/heads/develop' + windows: + runs-on: windows-latest + strategy: + matrix: + version: + - nightly + target: + - x86_64-pc-windows-gnu + - x86_64-pc-windows-msvc + fail-fast: false + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.version }} + override: true + - name: build + run: cargo build + - name: test + run: cargo test -- --test-threads 1 || true + env: + RUST_BACKTRACE: 1 + mac: + runs-on: macos-latest + strategy: + matrix: + version: + - nightly + target: + - x86_64-pc-windows-gnu + - x86_64-pc-windows-msvc + fail-fast: false + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.version }} + override: true + - name: build + run: cargo build + - name: test + run: cargo test -- --test-threads 1 || true + env: + RUST_BACKTRACE: 1 diff --git a/CHANGELOG.md b/CHANGELOG.md index fa6189fc4d..f8197354c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ start of the support work. ### Changed - Make doctest prefix matching less specific as the naming convention changed again - Ensure report is always generated if coverage is below failure threshold +- Rearrange crate internals and enable cross compilation for windows and macos. +This doesn't allow tarpaulin to work on these Operating Systems but it will +print an error and exit instead of failing to build ### Removed diff --git a/Cargo.lock b/Cargo.lock index d703e058da..df4ec078a2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -82,6 +82,7 @@ name = "cargo-tarpaulin" version = "0.18.0-alpha1" dependencies = [ "cargo_metadata", + "cfg-if 1.0.0", "chrono", "clap", "coveralls-api", diff --git a/Cargo.toml b/Cargo.toml index 26016107bd..bec0255def 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,13 +30,10 @@ git2 = "0.13" humantime-serde = "1" indexmap = { version = "1.6.1", features = ["serde-1"] } lazy_static = "1.0" -libc = "0.2.86" tracing = { version = "0.1", default-features = false } tracing-subscriber = {version = "0.2.16", default-features = false, features = ["env-filter", "fmt", "chrono", "ansi", "smallvec", "tracing-log"]} memmap = "0.7.0" -nix = "0.20.0" object = "0.23" -procfs = "0.9" proc-macro2 = { version = "1.0", features = ["span-locations"] } quick-xml = "0.22" quote = "1.0" @@ -47,6 +44,12 @@ serde_json = "1.0" syn = { version = "1.0", features = ["full"]} toml = "0.5" walkdir = "2.3.1" +cfg-if = "1.0.0" + +[target.'cfg(target_os = "linux")'.dependencies] +libc = "0.2.86" +nix = "0.20.0" +procfs = "0.9" [features] default = [] diff --git a/src/errors/mod.rs b/src/errors/mod.rs index f39a277416..a08fb6e5c5 100644 --- a/src/errors/mod.rs +++ b/src/errors/mod.rs @@ -1,5 +1,6 @@ use crate::report::cobertura; use std::fmt::{self, Display, Formatter}; + /// Error states that could be returned from tarpaulin #[derive(Debug)] pub enum RunError { @@ -23,6 +24,7 @@ pub enum RunError { OutFormat(String), IO(std::io::Error), StateMachine(String), + #[cfg(target_os = "linux")] NixError(nix::Error), Html(String), XML(cobertura::Error), @@ -50,6 +52,7 @@ impl Display for RunError { Self::OutFormat(e) => write!(f, "{}", e), Self::IO(e) => write!(f, "{}", e), Self::StateMachine(e) => write!(f, "Error running test: {}", e), + #[cfg(target_os = "linux")] Self::NixError(e) => write!(f, "{}", e), Self::Html(e) => write!(f, "Failed to generate HTML report! Error: {}", e), Self::XML(e) => write!(f, "Failed to generate XML report! Error: {}", e), @@ -69,6 +72,7 @@ impl From for RunError { } } +#[cfg(target_os = "linux")] impl From for RunError { fn from(e: nix::Error) -> Self { RunError::NixError(e) diff --git a/src/event_log.rs b/src/event_log.rs index f08dc01181..db00808577 100644 --- a/src/event_log.rs +++ b/src/event_log.rs @@ -1,9 +1,14 @@ use crate::cargo::TestBinary; +#[cfg(target_os = "linux")] use crate::ptrace_control::*; -use crate::statemachine::{ProcessInfo, TracerAction}; +#[cfg(target_os = "linux")] +use crate::statemachine::ProcessInfo; +use crate::statemachine::TracerAction; use crate::traces::{Location, TraceMap}; use chrono::offset::Local; +#[cfg(target_os = "linux")] use nix::libc::*; +#[cfg(target_os = "linux")] use nix::sys::{signal::Signal, wait::WaitStatus}; use serde::{Deserialize, Serialize}; use std::cell::RefCell; @@ -20,8 +25,8 @@ pub enum Event { #[derive(Clone, Default, Eq, PartialEq, PartialOrd, Ord, Hash, Serialize, Deserialize)] pub struct TraceEvent { - pid: Option, - child: Option, + pid: Option, + child: Option, signal: Option, addr: Option, return_val: Option, @@ -30,27 +35,28 @@ pub struct TraceEvent { } impl TraceEvent { + #[cfg(target_os = "linux")] pub(crate) fn new_from_action(action: &TracerAction) -> Self { match *action { TracerAction::TryContinue(t) => TraceEvent { - pid: Some(t.pid.as_raw()), + pid: Some(t.pid.as_raw().into()), signal: t.signal.map(|x| x.to_string()), description: "Try continue child".to_string(), ..Default::default() }, TracerAction::Continue(t) => TraceEvent { - pid: Some(t.pid.as_raw()), + pid: Some(t.pid.as_raw().into()), signal: t.signal.map(|x| x.to_string()), description: "Continue child".to_string(), ..Default::default() }, TracerAction::Step(t) => TraceEvent { - pid: Some(t.pid.as_raw()), + pid: Some(t.pid.as_raw().into()), description: "Step child".to_string(), ..Default::default() }, TracerAction::Detach(t) => TraceEvent { - pid: Some(t.pid.as_raw()), + pid: Some(t.pid.as_raw().into()), description: "Detach child".to_string(), ..Default::default() }, @@ -61,8 +67,9 @@ impl TraceEvent { } } + #[cfg(target_os = "linux")] pub(crate) fn new_from_wait(wait: &WaitStatus, offset: u64, traces: &TraceMap) -> Self { - let pid = wait.pid().map(|p| p.as_raw()); + let pid = wait.pid().map(|p| p.as_raw().into()); let mut event = TraceEvent { pid, ..Default::default() @@ -94,7 +101,7 @@ impl TraceEvent { PTRACE_EVENT_CLONE => { event.description = "Ptrace Clone".to_string(); if *sig == Signal::SIGTRAP { - event.child = get_event_data(*pid).ok().map(|x| x as pid_t); + event.child = get_event_data(*pid).ok(); } } PTRACE_EVENT_FORK => { diff --git a/src/lib.rs b/src/lib.rs index 11e61a9629..e56c55b425 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,20 +6,13 @@ use crate::path_utils::*; use crate::process_handling::*; use crate::report::report_coverage; use crate::source_analysis::{LineAnalysis, SourceAnalysis}; -use crate::statemachine::*; use crate::test_loader::*; use crate::traces::*; -use nix::unistd::*; -use std::collections::HashMap; -use std::env; -use std::ffi::CString; use std::fs::create_dir_all; -use std::path::{Path, PathBuf}; -use tracing::{debug, error, info, trace_span, warn}; +use tracing::{debug, error, info, warn}; use tracing_subscriber::{filter::LevelFilter, EnvFilter}; pub mod branching; -pub mod breakpoint; pub mod cargo; pub mod config; pub mod errors; @@ -32,8 +25,6 @@ mod statemachine; pub mod test_loader; pub mod traces; -mod ptrace_control; - const RUST_LOG_ENV: &str = "RUST_LOG"; pub fn setup_logging(color: Color, debug: bool, verbose: bool) { @@ -227,123 +218,3 @@ pub fn launch_tarpaulin( } Ok((result, return_code)) } - -/// Returns the coverage statistics for a test executable in the given workspace -pub fn get_test_coverage( - test: &TestBinary, - analysis: &HashMap, - config: &Config, - ignored: bool, - logger: &Option, -) -> Result, RunError> { - if !test.path().exists() { - return Ok(None); - } - if let Err(e) = limit_affinity() { - warn!("Failed to set processor affinity {}", e); - } - if let Some(log) = logger.as_ref() { - log.push_binary(test.clone()); - } - unsafe { - match fork() { - Ok(ForkResult::Parent { child }) => { - match collect_coverage(test.path(), child, analysis, config, logger) { - Ok(t) => Ok(Some(t)), - Err(e) => Err(RunError::TestCoverage(e.to_string())), - } - } - Ok(ForkResult::Child) => { - info!("Launching test"); - execute_test(test, ignored, config)?; - Ok(None) - } - Err(err) => Err(RunError::TestCoverage(format!( - "Failed to run test {}, Error: {}", - test.path().display(), - err.to_string() - ))), - } - } -} - -/// Collects the coverage data from the launched test -fn collect_coverage( - test_path: &Path, - test: Pid, - analysis: &HashMap, - config: &Config, - logger: &Option, -) -> Result<(TraceMap, i32), RunError> { - let mut ret_code = 0; - let mut traces = generate_tracemap(test_path, analysis, config)?; - { - let span = trace_span!("Collect coverage", pid=%test); - let _enter = span.enter(); - let (mut state, mut data) = - create_state_machine(test, &mut traces, analysis, config, logger); - loop { - state = state.step(&mut data, config)?; - if state.is_finished() { - if let TestState::End(i) = state { - ret_code = i; - } - break; - } - } - } - Ok((traces, ret_code)) -} - -/// Launches the test executable -fn execute_test(test: &TestBinary, ignored: bool, config: &Config) -> Result<(), RunError> { - let exec_path = CString::new(test.path().to_str().unwrap()).unwrap(); - info!("running {}", test.path().display()); - let _ = match test.manifest_dir() { - Some(md) => env::set_current_dir(&md), - None => env::set_current_dir(&config.root()), - }; - - let mut envars: Vec = Vec::new(); - - for (key, value) in env::vars() { - let mut temp = String::new(); - temp.push_str(key.as_str()); - temp.push('='); - temp.push_str(value.as_str()); - envars.push(CString::new(temp).unwrap()); - } - let mut argv = if ignored { - vec![exec_path.clone(), CString::new("--ignored").unwrap()] - } else { - vec![exec_path.clone()] - }; - if config.verbose { - envars.push(CString::new("RUST_BACKTRACE=1").unwrap()); - } - for s in &config.varargs { - argv.push(CString::new(s.as_bytes()).unwrap_or_default()); - } - argv.push(CString::new("--color").unwrap_or_default()); - argv.push(CString::new(config.color.to_string().to_ascii_lowercase()).unwrap_or_default()); - - if let Some(s) = test.pkg_name() { - envars.push(CString::new(format!("CARGO_PKG_NAME={}", s)).unwrap_or_default()); - } - if let Some(s) = test.pkg_version() { - envars.push(CString::new(format!("CARGO_PKG_VERSION={}", s)).unwrap_or_default()); - } - if let Some(s) = test.pkg_authors() { - envars.push(CString::new(format!("CARGO_PKG_AUTHORS={}", s.join(":"))).unwrap_or_default()); - } - if let Some(s) = test.manifest_dir() { - envars - .push(CString::new(format!("CARGO_MANIFEST_DIR={}", s.display())).unwrap_or_default()); - } - if config.engine == TraceEngine::Llvm || config.engine == TraceEngine::Auto { - // Used for llvm coverage to avoid report naming clashes - envars.push(CString::new("LLVM_PROFILE_FILE=default_%p.profraw").unwrap_or_default()); - } - - execute(exec_path, &argv, envars.as_slice()) -} diff --git a/src/breakpoint.rs b/src/process_handling/breakpoint.rs similarity index 100% rename from src/breakpoint.rs rename to src/process_handling/breakpoint.rs diff --git a/src/process_handling/linux.rs b/src/process_handling/linux.rs index 4276e5603d..a2be597151 100644 --- a/src/process_handling/linux.rs +++ b/src/process_handling/linux.rs @@ -1,11 +1,21 @@ +use crate::collect_coverage; use crate::errors::*; +use crate::event_log::*; +use crate::process_handling::execute_test; use crate::ptrace_control::*; +use crate::source_analysis::LineAnalysis; +use crate::traces::*; +use crate::Config; +use crate::TestBinary; use nix::errno::Errno; use nix::libc::{c_int, c_long}; use nix::sched::*; use nix::unistd::*; use nix::Error; +use std::collections::HashMap; use std::ffi::{CStr, CString}; +use std::path::PathBuf; +use tracing::{info, warn}; #[cfg(any(target_arch = "x86", target_arch = "x86_64", target_arch = "arm"))] type Persona = c_long; @@ -21,6 +31,45 @@ mod ffi { } } +/// Returns the coverage statistics for a test executable in the given workspace +pub fn get_test_coverage( + test: &TestBinary, + analysis: &HashMap, + config: &Config, + ignored: bool, + logger: &Option, +) -> Result, RunError> { + if !test.path().exists() { + return Ok(None); + } + if let Err(e) = limit_affinity() { + warn!("Failed to set processor affinity {}", e); + } + if let Some(log) = logger.as_ref() { + log.push_binary(test.clone()); + } + unsafe { + match fork() { + Ok(ForkResult::Parent { child }) => { + match collect_coverage(test.path(), child, analysis, config, logger) { + Ok(t) => Ok(Some(t)), + Err(e) => Err(RunError::TestCoverage(e.to_string())), + } + } + Ok(ForkResult::Child) => { + info!("Launching test"); + execute_test(test, ignored, config)?; + Ok(None) + } + Err(err) => Err(RunError::TestCoverage(format!( + "Failed to run test {}, Error: {}", + test.path().display(), + err.to_string() + ))), + } + } +} + fn personality(persona: Persona) -> nix::Result { let ret = unsafe { Errno::clear(); diff --git a/src/process_handling/mac.rs b/src/process_handling/mac.rs deleted file mode 100644 index ade1366408..0000000000 --- a/src/process_handling/mac.rs +++ /dev/null @@ -1,38 +0,0 @@ -use crate::errors::*; -use nix::libc::*; -use std::ffi::CString; -use std::{mem::uninitialized, ptr}; - -fn execute(program: CString, argv: &[CString], envar: &[CString]) -> Result<(), RunError> { - let mut attr: posix_spawnattr_t = uninitialized(); - let mut res = posix_spawn_attr_init(&mut attr); - if res != 0 { - trace!("Can't initialise posix_spawnattr_t"); - } - - let flags = (POSIX_SPAWN_START_SUSPENDED | POSIX_SPAWN_SETEXEC | 0x0100) as i16; - - res = posix_spawnattr_setflags(&mut attr, flags); - if res != 0 { - trace!("Failed to set spawn flags"); - } - - let args: Vec<*mut c_char> = argv.iter().map(|s| s.clone().into_raw()).collect(); - - args.push(ptr::null_mut()); - - let mut envs: Vec<*mut c_char> = envar.iter().map(|s| s.clone().into_raw()).collect(); - - envs.push(ptr::null_mut()); - - posix_spawnp( - ptr::nullptr(), - program.into_raw(), - ptr::null_mut(), - &attr, - args.as_ptr(), - envs.as_ptr(), - ); - - Err(RunError::Internal) -} diff --git a/src/process_handling/mod.rs b/src/process_handling/mod.rs index daac650004..482f304308 100644 --- a/src/process_handling/mod.rs +++ b/src/process_handling/mod.rs @@ -1,11 +1,121 @@ -#[cfg(target_os = "linux")] -pub mod linux; +use crate::generate_tracemap; +use crate::statemachine::{create_state_machine, TestState}; +use crate::traces::*; +use crate::{Config, EventLog, LineAnalysis, RunError, TestBinary, TraceEngine}; +use std::collections::HashMap; +use std::env; +use std::ffi::CString; +use std::path::{Path, PathBuf}; +use tracing::{info, trace_span}; -#[cfg(target_os = "linux")] -pub use linux::*; +cfg_if::cfg_if! { + if #[cfg(target_os= "linux")] { + pub mod linux; + pub use linux::*; -#[cfg(target_os = "macos")] -pub mod mac; + pub mod breakpoint; + pub mod ptrace_control; -#[cfg(target_os = "macos")] -pub use mac::*; + pub type ProcessHandle = nix::unistd::Pid; + } else { + pub type ProcessHandle = u64; + + /// Returns the coverage statistics for a test executable in the given workspace + pub fn get_test_coverage( + test: &TestBinary, + analysis: &HashMap, + config: &Config, + ignored: bool, + logger: &Option, + ) -> Result, RunError> { + tracing::error!("Tarpaulin does not support executing tests on this platform"); + Err(RunError::TestCoverage("Unsupported OS".to_string())) + } + + pub fn execute(program: CString, argv: &[CString], envar: &[CString]) -> Result<(), RunError> { + tracing::error!("Tarpaulin does not support executing tests on this platform"); + Err(RunError::TestCoverage("Unsupported OS".to_string())) + } + } +} + +/// Collects the coverage data from the launched test +pub(crate) fn collect_coverage( + test_path: &Path, + test: ProcessHandle, + analysis: &HashMap, + config: &Config, + logger: &Option, +) -> Result<(TraceMap, i32), RunError> { + let mut ret_code = 0; + let mut traces = generate_tracemap(test_path, analysis, config)?; + { + let span = trace_span!("Collect coverage", pid=%test); + let _enter = span.enter(); + let (mut state, mut data) = + create_state_machine(test, &mut traces, analysis, config, logger); + loop { + state = state.step(&mut data, config)?; + if state.is_finished() { + if let TestState::End(i) = state { + ret_code = i; + } + break; + } + } + } + Ok((traces, ret_code)) +} + +/// Launches the test executable +fn execute_test(test: &TestBinary, ignored: bool, config: &Config) -> Result<(), RunError> { + let exec_path = CString::new(test.path().to_str().unwrap()).unwrap(); + info!("running {}", test.path().display()); + let _ = match test.manifest_dir() { + Some(md) => env::set_current_dir(&md), + None => env::set_current_dir(&config.root()), + }; + + let mut envars: Vec = Vec::new(); + + for (key, value) in env::vars() { + let mut temp = String::new(); + temp.push_str(key.as_str()); + temp.push('='); + temp.push_str(value.as_str()); + envars.push(CString::new(temp).unwrap()); + } + let mut argv = if ignored { + vec![exec_path.clone(), CString::new("--ignored").unwrap()] + } else { + vec![exec_path.clone()] + }; + if config.verbose { + envars.push(CString::new("RUST_BACKTRACE=1").unwrap()); + } + for s in &config.varargs { + argv.push(CString::new(s.as_bytes()).unwrap_or_default()); + } + argv.push(CString::new("--color").unwrap_or_default()); + argv.push(CString::new(config.color.to_string().to_ascii_lowercase()).unwrap_or_default()); + + if let Some(s) = test.pkg_name() { + envars.push(CString::new(format!("CARGO_PKG_NAME={}", s)).unwrap_or_default()); + } + if let Some(s) = test.pkg_version() { + envars.push(CString::new(format!("CARGO_PKG_VERSION={}", s)).unwrap_or_default()); + } + if let Some(s) = test.pkg_authors() { + envars.push(CString::new(format!("CARGO_PKG_AUTHORS={}", s.join(":"))).unwrap_or_default()); + } + if let Some(s) = test.manifest_dir() { + envars + .push(CString::new(format!("CARGO_MANIFEST_DIR={}", s.display())).unwrap_or_default()); + } + if config.engine == TraceEngine::Llvm || config.engine == TraceEngine::Auto { + // Used for llvm coverage to avoid report naming clashes + envars.push(CString::new("LLVM_PROFILE_FILE=default_%p.profraw").unwrap_or_default()); + } + + execute(exec_path, &argv, envars.as_slice()) +} diff --git a/src/ptrace_control.rs b/src/process_handling/ptrace_control.rs similarity index 100% rename from src/ptrace_control.rs rename to src/process_handling/ptrace_control.rs diff --git a/src/statemachine/linux.rs b/src/statemachine/linux.rs index 362171b31b..f8563e6e15 100644 --- a/src/statemachine/linux.rs +++ b/src/statemachine/linux.rs @@ -1,8 +1,9 @@ +use crate::breakpoint::*; use crate::cargo::rust_flags; use crate::config::Config; use crate::errors::RunError; -use crate::event_log::*; use crate::generate_tracemap; +use crate::ptrace_control::*; use crate::source_analysis::LineAnalysis; use crate::statemachine::*; use nix::errno::Errno; diff --git a/src/statemachine/mod.rs b/src/statemachine/mod.rs index 5860a85ec7..901445a9ba 100644 --- a/src/statemachine/mod.rs +++ b/src/statemachine/mod.rs @@ -1,7 +1,6 @@ -use crate::breakpoint::*; use crate::config::Config; use crate::errors::RunError; -use crate::ptrace_control::*; +use crate::event_log::*; use crate::traces::*; use std::time::Instant; use tracing::error; @@ -9,8 +8,27 @@ use tracing::error; #[cfg(target_os = "linux")] pub mod linux; -#[cfg(target_os = "linux")] -pub use linux::*; +cfg_if::cfg_if! { + if #[cfg(target_os = "linux")] { + pub use linux::*; + } else { + use std::collections::HashMap; + use std::path::PathBuf; + use crate::LineAnalysis; + + pub fn create_state_machine<'a>( + test: crate::ProcessHandle, + traces: &'a mut TraceMap, + source_analysis: &'a HashMap, + config: &'a Config, + event_log: &'a Option, + ) -> (TestState, ()) { + error!("Tarpaulin is not currently supported on this system"); + (TestState::End(1), ()) + } + + } +} #[derive(Debug, Copy, Clone, Eq, PartialEq)] pub enum TestState { @@ -83,6 +101,29 @@ pub trait StateData { fn stop(&mut self) -> Result; } +impl StateData for () { + fn start(&mut self) -> Result, RunError> { + Err(RunError::StateMachine( + "No valid coverage collector".to_string(), + )) + } + fn init(&mut self) -> Result { + Err(RunError::StateMachine( + "No valid coverage collector".to_string(), + )) + } + fn wait(&mut self) -> Result, RunError> { + Err(RunError::StateMachine( + "No valid coverage collector".to_string(), + )) + } + fn stop(&mut self) -> Result { + Err(RunError::StateMachine( + "No valid coverage collector".to_string(), + )) + } +} + impl TestState { /// Convenience function used to check if the test has finished or errored pub fn is_finished(self) -> bool { @@ -130,13 +171,7 @@ impl TestState { } } TestState::Stopped => data.stop(), - _ => { - // Unhandled - if config.verbose { - error!("Tarpaulin error: unhandled test state"); - } - Ok(TestState::End(-1)) - } + TestState::End(e) => Ok(TestState::End(e)), } } } diff --git a/src/test_loader.rs b/src/test_loader.rs index 12e653e02d..f529315fcb 100644 --- a/src/test_loader.rs +++ b/src/test_loader.rs @@ -359,6 +359,14 @@ fn open_symbols_file(test: &Path) -> io::Result { File::open(&d_sym) } +#[cfg(target_os = "windows")] +fn open_symbols_file(test: &Path) -> io::Result { + Err(io::Error::new( + io::ErrorKind::Other, + "Windows is not currently supported", + )) +} + pub fn generate_tracemap( test: &Path, analysis: &HashMap, From 89a593a01aa6813be11ffa74606343e1a27e6f8a Mon Sep 17 00:00:00 2001 From: xd009642 Date: Sat, 27 Feb 2021 15:05:33 +0400 Subject: [PATCH 14/48] Fix path comparison in windows (#700) * Fix path comparison in windows Comparing path equality with strings wasn't smart now was it * remove ./ prefix on relative paths * Add an assert It looks like paths on windows don't work how I anticipate so adding a lil assert just to see if I'm right * Forgive me for what I'm doing So I want absolute paths from root and relative paths in tests... To achieve this I'm using cfg_if to optionally insert a C: to the start of absolute paths from root in windows * Add a system header test for windows Path utils ignoring files and things --- src/config/mod.rs | 34 +++++++++++++++++++++------------- src/path_utils.rs | 11 +++++++++++ 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/config/mod.rs b/src/config/mod.rs index 721d959934..4ea9741dad 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -820,31 +820,39 @@ mod tests { #[test] fn relative_path_test() { - let path_a = Path::new("/this/should/form/a/rel/path/"); - let path_b = Path::new("/this/should/form/b/rel/path/"); + cfg_if::cfg_if! { + if #[cfg(windows)] { + let root_base = "C:"; + } else { + let root_base = ""; + } + } + let path_a = PathBuf::from(format!("{}/this/should/form/a/rel/path/", root_base)); + let path_b = PathBuf::from(format!("{}/this/should/form/b/rel/path/", root_base)); - let rel_path = path_relative_from(path_b, path_a); + let rel_path = path_relative_from(&path_b, &path_a); assert!(rel_path.is_some()); assert_eq!( - rel_path.unwrap().to_str().unwrap(), - "../../../b/rel/path", + rel_path.unwrap(), + Path::new("../../../b/rel/path"), "Wrong relative path" ); - let path_a = Path::new("/this/should/not/form/a/rel/path/"); - let path_b = Path::new("./this/should/not/form/a/rel/path/"); - - let rel_path = path_relative_from(path_b, path_a); + let path_a = PathBuf::from(format!("{}/this/should/not/form/a/rel/path/", root_base)); + let path_b = Path::new("this/should/not/form/a/rel/path/"); + assert!(!path_b.is_absolute()); + assert!(path_a.is_absolute()); + let rel_path = path_relative_from(path_b, &path_a); assert_eq!(rel_path, None, "Did not expect relative path"); - let path_a = Path::new("./this/should/form/a/rel/path/"); - let path_b = Path::new("./this/should/form/b/rel/path/"); + let path_a = Path::new("this/should/form/a/rel/path/"); + let path_b = Path::new("this/should/form/b/rel/path/"); let rel_path = path_relative_from(path_b, path_a); assert!(rel_path.is_some()); assert_eq!( - rel_path.unwrap().to_str().unwrap(), - "../../../b/rel/path", + rel_path.unwrap(), + Path::new("../../../b/rel/path"), "Wrong relative path" ); } diff --git a/src/path_utils.rs b/src/path_utils.rs index 5bbcc49541..14c59b9d61 100644 --- a/src/path_utils.rs +++ b/src/path_utils.rs @@ -80,6 +80,7 @@ mod tests { use super::*; #[test] + #[cfg(unix)] fn system_headers_not_coverable() { assert!(!is_coverable_file_path( "/usr/include/c++/9/iostream", @@ -88,6 +89,16 @@ mod tests { )); } + #[test] + #[cfg(windows)] + fn system_headers_not_coverable() { + assert!(!is_coverable_file_path( + "C:/Program Files/Visual Studio/include/c++/9/iostream", + "C:/User/ferris/rust/project", + "C:/User/ferris/rust/project/target" + )); + } + #[test] fn basic_coverable_checks() { assert!(is_coverable_file_path( From ea308fdcc2e35937f3a7390fa56e1599aad5506a Mon Sep 17 00:00:00 2001 From: ruari-almost <72026762+ruari-almost@users.noreply.github.com> Date: Sun, 28 Feb 2021 20:01:20 +0000 Subject: [PATCH 15/48] 528 - rough version of fix. (#578) Fixes #528 - first cut at fixing the missing RUSTFLAGS issue. * changes after running cargo fmt * Fixed PathBuf handling and corrected config file name * changes after running cargo fmt * Update cargo.rs get rid of unwrap() * Update cargo.rs streamlined vec_of_flags creation and added logic to look for both flavours of config file. * Update cargo.rs Reworked for target/cfg support. * Get rid of config stuff after review. * Minor tweak after review. * Test stab at test for #528. Co-authored-by: bmorrow --- CHANGELOG.md | 1 + src/cargo.rs | 94 +++++++++++++++++++++++-- tests/data/rustflags/.cargo/config.toml | 2 + tests/data/rustflags/Cargo.lock | 5 ++ tests/data/rustflags/Cargo.toml | 5 ++ tests/data/rustflags/src/lib.rs | 11 +++ tests/mod.rs | 24 ++++++- 7 files changed, 137 insertions(+), 5 deletions(-) create mode 100644 tests/data/rustflags/.cargo/config.toml create mode 100644 tests/data/rustflags/Cargo.lock create mode 100644 tests/data/rustflags/Cargo.toml create mode 100644 tests/data/rustflags/src/lib.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index f8197354c1..57a931c1c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ file. - INTERNAL Added ability to build with LLVM coverage instrumentation and detect compiler support. This isn't enabled so should have no effect it's just the start of the support work. +- Now factors in rustflags from toml files #528 ### Changed - Make doctest prefix matching less specific as the naming convention changed again diff --git a/src/cargo.rs b/src/cargo.rs index 031fbe27de..892869acea 100644 --- a/src/cargo.rs +++ b/src/cargo.rs @@ -7,11 +7,13 @@ use regex::Regex; use serde::{Deserialize, Serialize}; use std::collections::{HashMap, HashSet}; use std::env; -use std::fs::{read_dir, remove_dir_all, File}; +use std::fs::{read_dir, read_to_string, remove_dir_all, File}; use std::io; use std::io::{BufRead, BufReader}; use std::path::{Component, Path, PathBuf}; use std::process::{Command, Stdio}; + +use toml::Value; use tracing::{error, trace, warn}; use walkdir::{DirEntry, WalkDir}; @@ -543,6 +545,87 @@ pub fn rustdoc_flags(config: &Config) -> String { value } +fn look_for_rustflags_in_table(value: &Value) -> String { + let table = value.as_table().unwrap(); + + if let Some(rustflags) = table.get("rustflags") { + let vec_of_flags: Vec = rustflags + .as_array() + .unwrap() + .into_iter() + .filter_map(|x| x.as_str()) + .map(|x| x.to_string()) + .collect(); + + vec_of_flags.join(" ") + } else { + String::new() + } +} + +fn look_for_rustflags_in_file(path: &Path) -> Option { + if let Ok(contents) = read_to_string(path) { + let value = contents.parse::().ok()?; + + let rustflags_in_file: Vec = value + .as_table()? + .into_iter() + .map(|(s, v)| { + if s.as_str() == "build" { + look_for_rustflags_in_table(v) + } else { + String::new() + } + }) + .collect(); + + Some(rustflags_in_file.join(" ")) + } else { + None + } +} + +fn look_for_rustflags_in(path: &Path) -> Option { + let mut config_path = path.join("config"); + + let rustflags = look_for_rustflags_in_file(&config_path); + if rustflags.is_some() { + return rustflags; + } + + config_path.pop(); + config_path.push("config.toml"); + + let rustflags = look_for_rustflags_in_file(&config_path); + if rustflags.is_some() { + return rustflags; + } + + None +} + +fn build_config_path(base: impl AsRef) -> PathBuf { + let mut config_path = PathBuf::from(base.as_ref()); + config_path.push(base); + config_path.push(".cargo"); + + config_path +} + +fn gather_config_rust_flags(config: &Config) -> String { + if let Some(rustflags) = look_for_rustflags_in(&build_config_path(&config.root())) { + return rustflags; + } + + if let Ok(cargo_home_config) = env::var("CARGO_HOME") { + if let Some(rustflags) = look_for_rustflags_in(&PathBuf::from(cargo_home_config)) { + return rustflags; + } + } + + String::new() +} + pub fn rust_flags(config: &Config) -> String { const RUSTFLAGS: &str = "RUSTFLAGS"; let mut value = " -C link-dead-code -C debuginfo=2 ".to_string(); @@ -553,10 +636,13 @@ pub fn rust_flags(config: &Config) -> String { value.push_str("-C debug-assertions=off "); } handle_llvm_flags(&mut value, config); + lazy_static! { + static ref DEBUG_INFO: Regex = Regex::new(r#"\-C\s*debuginfo=\d"#).unwrap(); + } if let Ok(vtemp) = env::var(RUSTFLAGS) { - lazy_static! { - static ref DEBUG_INFO: Regex = Regex::new(r#"\-C\s*debuginfo=\d"#).unwrap(); - } + value.push_str(&DEBUG_INFO.replace_all(&vtemp, " ")); + } else { + let vtemp = gather_config_rust_flags(config); value.push_str(&DEBUG_INFO.replace_all(&vtemp, " ")); } value diff --git a/tests/data/rustflags/.cargo/config.toml b/tests/data/rustflags/.cargo/config.toml new file mode 100644 index 0000000000..90197adca6 --- /dev/null +++ b/tests/data/rustflags/.cargo/config.toml @@ -0,0 +1,2 @@ + [build] + rustflags = ["-C", "target-cpu=native"] \ No newline at end of file diff --git a/tests/data/rustflags/Cargo.lock b/tests/data/rustflags/Cargo.lock new file mode 100644 index 0000000000..7a81fb3eb6 --- /dev/null +++ b/tests/data/rustflags/Cargo.lock @@ -0,0 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "rustflags" +version = "0.1.0" diff --git a/tests/data/rustflags/Cargo.toml b/tests/data/rustflags/Cargo.toml new file mode 100644 index 0000000000..e54385262c --- /dev/null +++ b/tests/data/rustflags/Cargo.toml @@ -0,0 +1,5 @@ +[package] +name = "rustflags" +version = "0.1.0" + +[dependencies] diff --git a/tests/data/rustflags/src/lib.rs b/tests/data/rustflags/src/lib.rs new file mode 100644 index 0000000000..7e58ece4af --- /dev/null +++ b/tests/data/rustflags/src/lib.rs @@ -0,0 +1,11 @@ +#![allow(dead_code)] + +use std::env; + +#[test] +fn ensure_rustflags_are_set() { + + let rust_flags: &'static str = env!("RUSTFLAGS"); + + assert!(rust_flags.to_string().contains("-C target-cpu=native")) +} diff --git a/tests/mod.rs b/tests/mod.rs index f27b22b17c..1dbb60aa3b 100644 --- a/tests/mod.rs +++ b/tests/mod.rs @@ -64,7 +64,8 @@ pub fn check_percentage_with_config( // tarpaulin logs //cargo_tarpaulin::setup_logging(true, true); - let (res, _) = launch_tarpaulin(&config, &None).unwrap(); + let (res, ret) = launch_tarpaulin(&config, &None).unwrap(); + assert_eq!(ret, 0); env::set_current_dir(restore_dir).unwrap(); if has_lines { @@ -272,6 +273,27 @@ fn cargo_home_filtering() { } #[test] +fn rustflags_handling() { + check_percentage("rustflags", 1.0f64, true); + env::set_var("RUSTFLAGS", "--cfg=foo"); + let mut config = Config::default(); + + let restore_dir = env::current_dir().unwrap(); + let test_dir = get_test_path("rustflags"); + env::set_current_dir(&test_dir).unwrap(); + config.manifest = test_dir; + config.manifest.push("Cargo.toml"); + + let (_, ret) = launch_tarpaulin(&config, &None).unwrap(); + env::set_current_dir(&restore_dir).unwrap(); + env::remove_var("RUSTFLAGS"); + assert_ne!(ret, 0); + + let (_, ret) = launch_tarpaulin(&config, &None).unwrap(); + env::set_current_dir(&restore_dir).unwrap(); + assert_eq!(ret, 0); +} + fn follow_exes_down() { let mut config = Config::default(); config.follow_exec = true; From 74dc19eae5d2f8788f8b2177cb674caea4205d16 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 1 Mar 2021 11:49:37 +0400 Subject: [PATCH 16/48] Bump serde_json from 1.0.63 to 1.0.64 (#702) Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.63 to 1.0.64. - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.63...v1.0.64) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index df4ec078a2..7b54d1a0f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -731,9 +731,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43535db9747a4ba938c0ce0a98cc631a46ebf943c9e1d604e091df6007620bf6" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ "itoa", "ryu", From 5f34208ff2b8f9f66d111d763b00db059b887e90 Mon Sep 17 00:00:00 2001 From: xd009642 Date: Mon, 1 Mar 2021 23:16:46 +0400 Subject: [PATCH 17/48] Clean on --force-clean --- CHANGELOG.md | 1 + src/cargo.rs | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57a931c1c2..d95e4864b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ start of the support work. - Rearrange crate internals and enable cross compilation for windows and macos. This doesn't allow tarpaulin to work on these Operating Systems but it will print an error and exit instead of failing to build +- Fixed `--force-clean` so it actually cleans the project ### Removed diff --git a/src/cargo.rs b/src/cargo.rs index 892869acea..574c5b0024 100644 --- a/src/cargo.rs +++ b/src/cargo.rs @@ -14,7 +14,7 @@ use std::path::{Component, Path, PathBuf}; use std::process::{Command, Stdio}; use toml::Value; -use tracing::{error, trace, warn}; +use tracing::{error, info, trace, warn}; use walkdir::{DirEntry, WalkDir}; #[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] @@ -197,6 +197,15 @@ fn run_cargo( ty: Option, result: &mut Vec, ) -> Result<(), RunError> { + if config.force_clean { + if let Ok(clean) = Command::new("cargo").arg("clean").output() { + info!("Cleaning project"); + if !clean.status.success() { + error!("Cargo clean failed:"); + println!("{}", std::str::from_utf8(&clean.stderr).unwrap_or_default()); + } + } + } let mut cmd = create_command(manifest, config, ty); if ty != Some(RunType::Doctests) { cmd.stdout(Stdio::piped()); From d66c6b3f4c007bbe1e368b617a301e4fadb39678 Mon Sep 17 00:00:00 2001 From: xd009642 Date: Tue, 2 Mar 2021 23:47:44 +0400 Subject: [PATCH 18/48] Measure time of events in seconds during run (#706) * Measure time of events in seconds during run * Update changelog --- CHANGELOG.md | 1 + src/event_log.rs | 43 ++++++++++++++++++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d95e4864b8..71d1b35ad6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ start of the support work. This doesn't allow tarpaulin to work on these Operating Systems but it will print an error and exit instead of failing to build - Fixed `--force-clean` so it actually cleans the project +- Change event log to now contain a time for each event ### Removed diff --git a/src/event_log.rs b/src/event_log.rs index db00808577..2544d3ab03 100644 --- a/src/event_log.rs +++ b/src/event_log.rs @@ -14,6 +14,7 @@ use serde::{Deserialize, Serialize}; use std::cell::RefCell; use std::fs::File; use std::path::Path; +use std::time::Instant; use tracing::{info, warn}; #[derive(Clone, Eq, PartialEq, PartialOrd, Ord, Hash, Serialize, Deserialize)] @@ -23,6 +24,21 @@ pub enum Event { Trace(TraceEvent), } +#[derive(Clone, PartialEq, PartialOrd, Serialize, Deserialize)] +pub struct EventWrapper { + #[serde(flatten)] + event: Event, + // The time this was created in seconds + created: f64, +} + +impl EventWrapper { + fn new(event: Event, since: Instant) -> Self { + let created = Instant::now().duration_since(since).as_secs_f64(); + Self { event, created } + } +} + #[derive(Clone, Default, Eq, PartialEq, PartialOrd, Ord, Hash, Serialize, Deserialize)] pub struct TraceEvent { pid: Option, @@ -135,28 +151,45 @@ impl TraceEvent { } } -#[derive(Clone, Eq, PartialEq, PartialOrd, Ord, Serialize, Deserialize)] +#[derive(Clone, PartialEq, PartialOrd, Serialize, Deserialize)] pub struct EventLog { - events: RefCell>, + events: RefCell>, + #[serde(skip)] + start: Option, +} + +impl Default for EventLog { + fn default() -> Self { + Self::new() + } } impl EventLog { pub fn new() -> Self { Self { events: RefCell::new(vec![]), + start: Some(Instant::now()), } } pub fn push_binary(&self, binary: TestBinary) { - self.events.borrow_mut().push(Event::BinaryLaunch(binary)); + self.events.borrow_mut().push(EventWrapper::new( + Event::BinaryLaunch(binary), + self.start.unwrap(), + )); } pub fn push_trace(&self, event: TraceEvent) { - self.events.borrow_mut().push(Event::Trace(event)); + self.events + .borrow_mut() + .push(EventWrapper::new(Event::Trace(event), self.start.unwrap())); } pub fn push_config(&self, name: String) { - self.events.borrow_mut().push(Event::ConfigLaunch(name)); + self.events.borrow_mut().push(EventWrapper::new( + Event::ConfigLaunch(name), + self.start.unwrap(), + )); } } From 814d77bb48ea003651e0b4eb91e88cb17aeea0da Mon Sep 17 00:00:00 2001 From: xd009642 Date: Wed, 3 Mar 2021 11:52:23 +0400 Subject: [PATCH 19/48] Rustc now errors on unsupported attrs on rustdoc (#709) Fix dependencies so this no longer bothers my CI --- tests/data/all_test_types/Cargo.lock | 514 ------------------ tests/data/all_test_types/Cargo.toml | 3 - tests/data/all_test_types/benches/bench_fn.rs | 11 +- tests/data/futures/Cargo.lock | 219 +++++--- tests/data/futures/Cargo.toml | 2 +- 5 files changed, 135 insertions(+), 614 deletions(-) diff --git a/tests/data/all_test_types/Cargo.lock b/tests/data/all_test_types/Cargo.lock index de7a4c865a..042ec8ea3a 100644 --- a/tests/data/all_test_types/Cargo.lock +++ b/tests/data/all_test_types/Cargo.lock @@ -3,517 +3,3 @@ [[package]] name = "all_test_types" version = "0.1.0" -dependencies = [ - "criterion 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "atty" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "autocfg" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bitflags" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bstr" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "byteorder" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cast" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "clap" -version = "2.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "criterion" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", - "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "criterion-plot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "csv 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_xoshiro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", - "tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "criterion-plot" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-deque" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-epoch 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-queue" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-utils" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-utils" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "csv" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bstr 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "csv-core" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "either" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "getrandom" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "hermit-abi" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "itertools" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "itoa" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "libc" -version = "0.2.65" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "memchr" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "memoffset" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-traits" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num_cpus" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc-macro2" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quote" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_os" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_xoshiro" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rayon" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon-core 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rayon-core" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex-automata" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ryu" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "same-file" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "scopeguard" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "serde" -version = "1.0.102" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "serde_derive" -version = "1.0.102" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_json" -version = "1.0.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syn" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tinytemplate" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "unicode-width" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "walkdir" -version = "2.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasi" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi-util" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" -"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" -"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -"checksum bstr 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8d6c2c5b58ab920a4f5aeaaca34b4488074e8cc7596af94e6f8c6ff247c60245" -"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" -"checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" -"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" -"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" -"checksum criterion 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "938703e165481c8d612ea3479ac8342e5615185db37765162e762ec3523e2fc6" -"checksum criterion-plot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eccdc6ce8bbe352ca89025bee672aa6d24f4eb8c53e3a8b5d1bc58011da072a2" -"checksum crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3aa945d63861bfe624b55d153a39684da1e8c0bc8fba932f7ee3a3c16cea3ca" -"checksum crossbeam-epoch 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5064ebdbf05ce3cb95e45c8b086f72263f4166b29b97f6baff7ef7fe047b55ac" -"checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" -"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" -"checksum crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce446db02cdc3165b94ae73111e570793400d0794e46125cc4056c81cbb039f4" -"checksum csv 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "37519ccdfd73a75821cac9319d4fce15a81b9fcf75f951df5b9988aa3a0af87d" -"checksum csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9b5cadb6b25c77aeff80ba701712494213f4a8418fcda2ee11b6560c3ad0bf4c" -"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" -"checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407" -"checksum hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "307c3c9f937f38e3534b1d6447ecf090cafcc9744e4a6360e8b037b2cf5af120" -"checksum itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "87fa75c9dea7b07be3138c49abbb83fd4bea199b5cdc76f9804458edc5da0d6e" -"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" -"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8" -"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" -"checksum memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "75189eb85871ea5c2e2c15abbdd541185f63b408415e5051f5cac122d8c774b9" -"checksum num-traits 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "443c53b3c3531dfcbfa499d8893944db78474ad7a1d87fa2d94d1a2231693ac6" -"checksum num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76dac5ed2a876980778b8b85f75a71b6cbf0db0b1232ee12f826bccb00d09d72" -"checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -"checksum rand_os 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a788ae3edb696cfcba1c19bfd388cc4b8c21f8a408432b199c072825084da58a" -"checksum rand_xoshiro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0e18c91676f670f6f0312764c759405f13afb98d5d73819840cf72a518487bff" -"checksum rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "83a27732a533a1be0a0035a111fe76db89ad312f6f0347004c220c57f209a123" -"checksum rayon-core 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "98dcf634205083b17d0861252431eb2acbfb698ab7478a2d20de07954f47ec7b" -"checksum regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "92b73c2a1770c255c240eaa4ee600df1704a38dc3feaa6e949e7fcd4f8dc09f9" -"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" -"checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" -"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" -"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4b39bd9b0b087684013a792c59e3e07a46a01d2322518d8a1104641a0b1be0" -"checksum serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)" = "ca13fc1a832f793322228923fbb3aba9f3f44444898f835d31ad1b74fa0a2bf8" -"checksum serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "2f72eb2a68a7dc3f9a691bfda9305a1c017a6215e5a4545c258500d2099a37c2" -"checksum syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "661641ea2aa15845cddeb97dad000d22070bb5c1fb456b96c1cba883ec691e92" -"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -"checksum tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4574b75faccaacddb9b284faecdf0b544b80b6b294f3d062d325c5726a209c20" -"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" -"checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" -"checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d" -"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/tests/data/all_test_types/Cargo.toml b/tests/data/all_test_types/Cargo.toml index cdf1f2d652..a30a5e2f9d 100644 --- a/tests/data/all_test_types/Cargo.toml +++ b/tests/data/all_test_types/Cargo.toml @@ -6,10 +6,7 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -[dependencies] -criterion = "0.3" [[bench]] name = "bench_fn" -harness = false diff --git a/tests/data/all_test_types/benches/bench_fn.rs b/tests/data/all_test_types/benches/bench_fn.rs index fe0de59677..5b6e4f5d71 100644 --- a/tests/data/all_test_types/benches/bench_fn.rs +++ b/tests/data/all_test_types/benches/bench_fn.rs @@ -1,11 +1,6 @@ use all_test_types::only_bench::*; -use criterion::{criterion_group, criterion_main, Criterion}; -fn check_speed(c: &mut Criterion) { - c.bench_function("some_fn", |b| { - b.iter(|| only_ran_in_benches(vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10])) - }); +#[test] +fn check_speed() { + only_ran_in_benches(vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); } - -criterion_group!(benches, check_speed); -criterion_main!(benches); diff --git a/tests/data/futures/Cargo.lock b/tests/data/futures/Cargo.lock index 85a9def986..bef5df2890 100644 --- a/tests/data/futures/Cargo.lock +++ b/tests/data/futures/Cargo.lock @@ -1,154 +1,197 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "either" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "futures" version = "0.1.0" dependencies = [ - "futures-preview 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.13", ] [[package]] -name = "futures-async-runtime-preview" -version = "0.2.3" +name = "futures" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f55667319111d593ba876406af7c409c0ebb44dc4be6132a783ccf163ea14c1" dependencies = [ - "futures-core-preview 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-stable-preview 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", ] [[package]] -name = "futures-channel-preview" -version = "0.2.2" +name = "futures-channel" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c2dd2df839b57db9ab69c2c9d8f3e8c81984781937fe2807dc6dcf3b2ad2939" dependencies = [ - "futures-core-preview 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core", + "futures-sink", ] [[package]] -name = "futures-core-preview" -version = "0.2.3" +name = "futures-core" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "15496a72fabf0e62bdc3df11a59a3787429221dd0710ba8ef163d6f7a9112c94" [[package]] -name = "futures-executor-preview" -version = "0.2.2" +name = "futures-executor" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891a4b7b96d84d5940084b2a37632dd65deeae662c114ceaa2c879629c9c0ad1" dependencies = [ - "futures-channel-preview 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core-preview 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util-preview 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core", + "futures-task", + "futures-util", + "num_cpus", ] [[package]] -name = "futures-io-preview" -version = "0.2.2" +name = "futures-io" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-core-preview 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "d71c2c65c57704c32f5241c1223167c2c3294fd34ac020c807ddbe6db287ba59" [[package]] -name = "futures-preview" -version = "0.2.2" +name = "futures-macro" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea405816a5139fb39af82c2beb921d52143f556038378d6db21183a5c37fbfb7" dependencies = [ - "futures-async-runtime-preview 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-channel-preview 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core-preview 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-executor-preview 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io-preview 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink-preview 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-stable-preview 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util-preview 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "futures-sink-preview" -version = "0.2.2" +name = "futures-sink" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85754d98985841b7d4f5e8e6fbfa4a4ac847916893ec511a2917ccd8525b8bb3" + +[[package]] +name = "futures-task" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa189ef211c15ee602667a6fcfe1c1fd9e07d42250d2156382820fba33c9df80" + +[[package]] +name = "futures-util" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1812c7ab8aedf8d6f2701a43e1243acdbcc2b36ab26e2ad421eb99ac963d96d1" dependencies = [ - "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-channel-preview 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core-preview 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", ] [[package]] -name = "futures-stable-preview" -version = "0.2.3" +name = "hermit-abi" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ - "futures-core-preview 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-executor-preview 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] -name = "futures-util-preview" -version = "0.2.2" +name = "libc" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "265d751d31d6780a3f956bb5b8022feba2d94eeee5a84ba64f4212eedca42213" + +[[package]] +name = "memchr" +version = "2.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" + +[[package]] +name = "num_cpus" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ - "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-channel-preview 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core-preview 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io-preview 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink-preview 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", ] [[package]] -name = "iovec" -version = "0.1.2" +name = "pin-project-lite" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cf491442e4b033ed1c722cb9f0df5fcfcf4de682466c46469c36bc47dc5548a" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "proc-macro-hack" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" + +[[package]] +name = "proc-macro-nested" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" + +[[package]] +name = "proc-macro2" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ - "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid", ] [[package]] -name = "lazy_static" -version = "1.4.0" +name = "quote" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +dependencies = [ + "proc-macro2", +] [[package]] -name = "libc" -version = "0.2.62" +name = "slab" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" [[package]] -name = "num_cpus" -version = "1.10.1" +name = "syn" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" dependencies = [ - "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "unicode-xid", ] [[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" -"checksum futures-async-runtime-preview 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "33c03035be1dae627b7e05c6984acb1f2086043fde5249ae51604f1ff20ed037" -"checksum futures-channel-preview 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d6f8aec6b0eb1d281843ec666fba2b71a49610181e3078fbef7a8cbed481821e" -"checksum futures-core-preview 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "098785413db44e5dbf3b1fc23c24039a9091bea5acb3eb0d293f386f18aff97d" -"checksum futures-executor-preview 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "28ff61425699ca85de5c63c1f135278403518c3398bd15cf4b6fd1d21c9846e4" -"checksum futures-io-preview 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aaa769a6ac904912c1557b4dcf85b93db2bc9ba57c349f9ce43870e49d67f8e1" -"checksum futures-preview 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d575096a4e2cf458f309b5b7bce5c8aaad8e874b8d77f0aa26c08d7ac18f74" -"checksum futures-sink-preview 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5dc4cdc628b934f18a11ba070d589655f68cfec031a16381b0e7784ff0e9cc18" -"checksum futures-stable-preview 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0a6ba960b8bbbc14a9a741cc8ad9c26aff44538ea14be021db905b43f33854da" -"checksum futures-util-preview 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4b29aa737dba9e2e47a5dcd4d58ec7c7c2d5f78e8460f609f857bcf04163235e" -"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" -"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba" -"checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +name = "unicode-xid" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" diff --git a/tests/data/futures/Cargo.toml b/tests/data/futures/Cargo.toml index e089c09a56..0a7341f38a 100644 --- a/tests/data/futures/Cargo.toml +++ b/tests/data/futures/Cargo.toml @@ -7,4 +7,4 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -futures-preview = "0.2.2" +futures = { version = "0.3", features = ["thread-pool"] } From a4ed7dd2d274a379abbde64615ef446d87250e2c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 3 Mar 2021 12:14:05 +0400 Subject: [PATCH 20/48] Bump libc from 0.2.86 to 0.2.87 (#708) Bumps [libc](https://github.com/rust-lang/libc) from 0.2.86 to 0.2.87. - [Release notes](https://github.com/rust-lang/libc/releases) - [Commits](https://github.com/rust-lang/libc/compare/0.2.86...0.2.87) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7b54d1a0f7..77ffd0937c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -383,9 +383,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c" +checksum = "265d751d31d6780a3f956bb5b8022feba2d94eeee5a84ba64f4212eedca42213" [[package]] name = "libgit2-sys" diff --git a/Cargo.toml b/Cargo.toml index bec0255def..4aff4e9937 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,7 @@ walkdir = "2.3.1" cfg-if = "1.0.0" [target.'cfg(target_os = "linux")'.dependencies] -libc = "0.2.86" +libc = "0.2.87" nix = "0.20.0" procfs = "0.9" From 0058819aed9fcf12551d5a5d7bc4a36bdfd57f6b Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 3 Mar 2021 13:27:35 +0400 Subject: [PATCH 21/48] Bump cargo_metadata from 0.12.3 to 0.13.1 (#707) * Bump cargo_metadata from 0.12.3 to 0.13.1 Bumps [cargo_metadata](https://github.com/oli-obk/cargo_metadata) from 0.12.3 to 0.13.1. - [Release notes](https://github.com/oli-obk/cargo_metadata/releases) - [Commits](https://github.com/oli-obk/cargo_metadata/commits) Signed-off-by: dependabot-preview[bot] * Fix Utf8PathBuf -> PathBuf Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: xd009642 --- Cargo.lock | 14 ++++++++++++-- Cargo.toml | 2 +- src/cargo.rs | 7 +++++-- src/config/mod.rs | 4 ++-- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 77ffd0937c..bbf26390e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -68,6 +68,15 @@ version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" +[[package]] +name = "camino" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd065703998b183ed0b348a22555691373a9345a1431141e5778b48bb17e4703" +dependencies = [ + "serde", +] + [[package]] name = "cargo-platform" version = "0.1.1" @@ -114,10 +123,11 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.12.3" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7714a157da7991e23d90686b9524b9e12e0407a108647f52e9328f4b3d51ac7f" +checksum = "081e3f0755c1f380c2d010481b6fa2e02973586d5f2b24eebb7a2a1d98b143d8" dependencies = [ + "camino", "cargo-platform", "semver", "semver-parser", diff --git a/Cargo.toml b/Cargo.toml index 4aff4e9937..414ec08250 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ name = "integration" path = "tests/mod.rs" [dependencies] -cargo_metadata = "0.12" +cargo_metadata = "0.13" chrono = "0.4" clap = "2.33.3" coveralls-api = "0.5.0" diff --git a/src/cargo.rs b/src/cargo.rs index 574c5b0024..685a5f96f3 100644 --- a/src/cargo.rs +++ b/src/cargo.rs @@ -227,7 +227,7 @@ fn run_cargo( if !art.profile.test && config.command == Mode::Test { continue; } - result.push(TestBinary::new(path, ty)); + result.push(TestBinary::new(PathBuf::from(path), ty)); package_ids.push(art.package_id.clone()); } } @@ -254,7 +254,10 @@ fn run_cargo( }; for (res, package) in result.iter_mut().zip(package_ids.iter()) { let package = &metadata[package]; - res.cargo_dir = package.manifest_path.parent().map(|x| x.to_path_buf()); + res.cargo_dir = package + .manifest_path + .parent() + .map(|x| PathBuf::from(x.to_path_buf())); res.pkg_name = Some(package.name.clone()); res.pkg_version = Some(package.version.to_string()); res.pkg_authors = Some(package.authors.clone()); diff --git a/src/config/mod.rs b/src/config/mod.rs index 4ea9741dad..355b1270f7 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -333,7 +333,7 @@ impl Config { s.clone() } else { match *self.get_metadata() { - Some(ref meta) => meta.target_directory.clone(), + Some(ref meta) => PathBuf::from(meta.target_directory.clone()), _ => self .manifest .parent() @@ -363,7 +363,7 @@ impl Config { } pub fn root(&self) -> PathBuf { match *self.get_metadata() { - Some(ref meta) => meta.workspace_root.clone(), + Some(ref meta) => PathBuf::from(meta.workspace_root.clone()), _ => self .manifest .parent() From f0bd52790d0306feba1bc6cb3563a5752cb87d9b Mon Sep 17 00:00:00 2001 From: xd009642 Date: Wed, 3 Mar 2021 22:54:54 +0400 Subject: [PATCH 22/48] Fixes #710 If there is a root package to the workspace then it prepends it's name to the coverage.json filename to prevent name clashes when sharing a target directory between projects --- CHANGELOG.md | 2 ++ src/config/mod.rs | 2 +- src/report/mod.rs | 12 ++++++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71d1b35ad6..3013a0d14a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ This doesn't allow tarpaulin to work on these Operating Systems but it will print an error and exit instead of failing to build - Fixed `--force-clean` so it actually cleans the project - Change event log to now contain a time for each event +- Add project name to coverage report in target dir to make things nicer for people +reusing a target dir for multiple projects (#710) ### Removed diff --git a/src/config/mod.rs b/src/config/mod.rs index 355b1270f7..7ec63e51c1 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -350,7 +350,7 @@ impl Config { result } - fn get_metadata(&self) -> Ref> { + pub(crate) fn get_metadata(&self) -> Ref> { if self.metadata.borrow().is_none() { match MetadataCommand::new().manifest_path(&self.manifest).exec() { Ok(meta) => { diff --git a/src/report/mod.rs b/src/report/mod.rs index 0416e46c35..fc04767a91 100644 --- a/src/report/mod.rs +++ b/src/report/mod.rs @@ -20,6 +20,14 @@ pub trait Report { fn export(coverage_data: &[TracerData], config: &Config); } +fn coverage_report_name(config: &Config) -> String { + config.get_metadata() + .as_ref() + .and_then(|x| x.root_package()) + .map(|x| format!("{}-coverage.json", x.name)) + .unwrap_or_else(|| "coverage.json".to_string()) +} + /// Reports the test coverage using the users preferred method. See config.rs /// or help text for details. pub fn report_coverage(config: &Config, result: &TraceMap) -> Result<(), RunError> { @@ -35,7 +43,7 @@ pub fn report_coverage(config: &Config, result: &TraceMap) -> Result<(), RunErro if !report_dir.exists() { let _ = create_dir_all(&report_dir); } - report_dir.push("coverage.json"); + report_dir.push(coverage_report_name(config)); let file = File::create(&report_dir) .map_err(|_| RunError::CovReport("Failed to create run report".to_string()))?; serde_json::to_writer(&file, &result) @@ -117,7 +125,7 @@ fn get_previous_result(config: &Config) -> Option { report_dir.push("tarpaulin"); if report_dir.exists() { // is report there? - report_dir.push("coverage.json"); + report_dir.push(coverage_report_name(config)); let file = File::open(&report_dir).ok()?; let reader = BufReader::new(file); serde_json::from_reader(reader).ok() From 8862091c320bb0954f58c8ea328ca33f8901741e Mon Sep 17 00:00:00 2001 From: xd009642 Date: Wed, 3 Mar 2021 23:37:27 +0400 Subject: [PATCH 23/48] rustfmt --- src/report/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/report/mod.rs b/src/report/mod.rs index fc04767a91..85dd339900 100644 --- a/src/report/mod.rs +++ b/src/report/mod.rs @@ -21,7 +21,8 @@ pub trait Report { } fn coverage_report_name(config: &Config) -> String { - config.get_metadata() + config + .get_metadata() .as_ref() .and_then(|x| x.root_package()) .map(|x| format!("{}-coverage.json", x.name)) From 5c0978119214a23e80676d24b06c2f67624d343d Mon Sep 17 00:00:00 2001 From: xd009642 Date: Thu, 4 Mar 2021 09:21:38 +0400 Subject: [PATCH 24/48] initial implementation rustflags arg #689 (#711) * initial implementation of #689 * Fixes #689 Now rustflags is an arg in the CLI and therefore able to be set via the tarpaulin config files meaning users can now test configs with different rustflags for the tests for non-overlapping features --- CHANGELOG.md | 1 + src/cargo.rs | 3 ++- src/config/mod.rs | 12 ++++++++++++ src/config/parse.rs | 4 ++++ src/main.rs | 1 + 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3013a0d14a..cb62978ddb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ file. compiler support. This isn't enabled so should have no effect it's just the start of the support work. - Now factors in rustflags from toml files #528 +- Now able to add to rustflags via CLI args and via tarpaulin config files ### Changed - Make doctest prefix matching less specific as the naming convention changed again diff --git a/src/cargo.rs b/src/cargo.rs index 685a5f96f3..53213a7e1f 100644 --- a/src/cargo.rs +++ b/src/cargo.rs @@ -640,7 +640,8 @@ fn gather_config_rust_flags(config: &Config) -> String { pub fn rust_flags(config: &Config) -> String { const RUSTFLAGS: &str = "RUSTFLAGS"; - let mut value = " -C link-dead-code -C debuginfo=2 ".to_string(); + let mut value = config.rustflags.clone().unwrap_or_default(); + value.push_str(" -C link-dead-code -C debuginfo=2 "); if !config.avoid_cfg_tarpaulin { value.push_str("--cfg=tarpaulin "); } diff --git a/src/config/mod.rs b/src/config/mod.rs index 7ec63e51c1..3f8c02bed5 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -167,6 +167,8 @@ pub struct Config { pub jobs: Option, /// Engine to use to collect coverage pub engine: TraceEngine, + /// Specifying per-config rust flags + pub rustflags: Option, } fn default_test_timeout() -> Duration { @@ -230,6 +232,7 @@ impl Default for Config { jobs: None, color: Color::Auto, engine: TraceEngine::Ptrace, + rustflags: None, } } } @@ -303,6 +306,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"), + rustflags: get_rustflags(args), engine: TraceEngine::Ptrace, }; if args.is_present("ignore-config") { @@ -513,6 +517,14 @@ impl Config { self.ignore_tests |= other.ignore_tests; self.no_fail_fast |= other.no_fail_fast; + let new_flags = match (self.rustflags.as_ref(), other.rustflags.as_ref()) { + (Some(a), Some(b)) => Some(format!("{} {}", a, b)), + (Some(a), None) => Some(a.clone()), + (None, Some(b)) => Some(b.clone()), + _ => None, + }; + self.rustflags = new_flags; + if self.jobs.is_none() { self.jobs = other.jobs; } diff --git a/src/config/parse.rs b/src/config/parse.rs index a46e431617..6f38953562 100644 --- a/src/config/parse.rs +++ b/src/config/parse.rs @@ -62,6 +62,10 @@ pub(super) fn get_target(args: &ArgMatches) -> Option { args.value_of("target").map(String::from) } +pub(super) fn get_rustflags(args: &ArgMatches) -> Option { + args.value_of("rustflags").map(String::from) +} + pub(super) fn get_target_dir(args: &ArgMatches) -> Option { let path = if let Some(path) = args.value_of("target-dir") { PathBuf::from(path) diff --git a/src/main.rs b/src/main.rs index 7870bb14a6..8f95dc045c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -95,6 +95,7 @@ fn main() -> Result<(), String> { --print-rustdoc-flags 'Print the RUSTDOCFLAGS options that tarpaulin will compile any doctests with and exit' --avoid-cfg-tarpaulin 'Remove --cfg=tarpaulin from the RUSTFLAG' -j --jobs [N] 'Number of parallel jobs, defaults to # of CPUs' + --rustflags [FLAGS] 'rustflags to add when building project (can also be set via RUSTFLAGS env var)' -Z [FEATURES]... 'List of unstable nightly only flags'") .args(&[ Arg::from_usage("--out -o [FMT] 'Output format of coverage report'") From 06645ec20c26d0dffa5ca7f21dcc73cc19eca8b1 Mon Sep 17 00:00:00 2001 From: xd009642 Date: Thu, 4 Mar 2021 20:51:09 +0400 Subject: [PATCH 25/48] More tests for 689 (#712) * I'm a muppet who forgot to commit the tests * Fix test --- src/config/mod.rs | 32 ++++++++++++++++++++ tests/data/multiple_rustflags/Cargo.lock | 5 +++ tests/data/multiple_rustflags/Cargo.toml | 9 ++++++ tests/data/multiple_rustflags/src/lib.rs | 23 ++++++++++++++ tests/data/multiple_rustflags/tarpaulin.toml | 5 +++ tests/mod.rs | 25 +++++++++++---- 6 files changed, 93 insertions(+), 6 deletions(-) create mode 100644 tests/data/multiple_rustflags/Cargo.lock create mode 100644 tests/data/multiple_rustflags/Cargo.toml create mode 100644 tests/data/multiple_rustflags/src/lib.rs create mode 100644 tests/data/multiple_rustflags/tarpaulin.toml diff --git a/src/config/mod.rs b/src/config/mod.rs index 3f8c02bed5..efda7f1b5c 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -1061,6 +1061,38 @@ mod tests { assert_eq!(both_merged_dir.output_dir(), PathBuf::from("bar")); } + #[test] + fn rustflags_merge() { + let toml = r#" + [flag1] + rustflags = "xyz" + + [flag2] + rustflags = "bar" + "#; + + let configs = Config::parse_config_toml(toml.as_bytes()).unwrap(); + let flag1 = configs.iter().find(|x| x.name == "flag1").unwrap().clone(); + let flag2 = configs.iter().find(|x| x.name == "flag2").unwrap().clone(); + let noflags = Config::default(); + + let mut yes_no = flag1.clone(); + yes_no.merge(&noflags); + assert_eq!(yes_no.rustflags, Some("xyz".to_string())); + + let mut no_yes = noflags.clone(); + no_yes.merge(&flag2); + assert_eq!(no_yes.rustflags, Some("bar".to_string())); + + let mut f1_2 = flag1.clone(); + f1_2.merge(&flag2); + let flags = f1_2.rustflags.unwrap(); + let split = flags.split_ascii_whitespace().collect::>(); + assert_eq!(split.len(), 2); + assert!(split.contains(&"xyz")); + assert!(split.contains(&"bar")); + } + #[test] fn all_toml_options() { let toml = r#"[all] diff --git a/tests/data/multiple_rustflags/Cargo.lock b/tests/data/multiple_rustflags/Cargo.lock new file mode 100644 index 0000000000..5c584031c5 --- /dev/null +++ b/tests/data/multiple_rustflags/Cargo.lock @@ -0,0 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "multiple_rustflags" +version = "0.1.0" diff --git a/tests/data/multiple_rustflags/Cargo.toml b/tests/data/multiple_rustflags/Cargo.toml new file mode 100644 index 0000000000..a40a568857 --- /dev/null +++ b/tests/data/multiple_rustflags/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "multiple_rustflags" +version = "0.1.0" +authors = ["xd009642 "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/tests/data/multiple_rustflags/src/lib.rs b/tests/data/multiple_rustflags/src/lib.rs new file mode 100644 index 0000000000..f7db6ac2db --- /dev/null +++ b/tests/data/multiple_rustflags/src/lib.rs @@ -0,0 +1,23 @@ + +#[cfg(config1)] +fn config1_hello() { + println!("Hello!"); +} + +#[cfg(config2)] +fn config2_hello() { + println!("Hello!"); +} + + +#[test] +#[cfg(config1)] +fn it_works() { + config1_hello(); +} + +#[test] +#[cfg(config2)] +fn it_works() { + config2_hello(); +} diff --git a/tests/data/multiple_rustflags/tarpaulin.toml b/tests/data/multiple_rustflags/tarpaulin.toml new file mode 100644 index 0000000000..ef177a9802 --- /dev/null +++ b/tests/data/multiple_rustflags/tarpaulin.toml @@ -0,0 +1,5 @@ +[coverage] +rustflags = "--cfg=config1" + +[coverage_2] +rustflags = "--cfg=config2" diff --git a/tests/mod.rs b/tests/mod.rs index 1dbb60aa3b..bbf56eb287 100644 --- a/tests/mod.rs +++ b/tests/mod.rs @@ -36,13 +36,13 @@ pub fn check_percentage_with_cli_args(minimum_coverage: f64, has_lines: bool, ar } res.dedup(); env::set_current_dir(restore_dir).unwrap(); - assert!( - res.coverage_percentage() >= minimum_coverage, - "Assertion failed {} >= {}", - res.coverage_percentage(), - minimum_coverage - ); if has_lines { + assert!( + res.coverage_percentage() >= minimum_coverage, + "Assertion failed {} >= {}", + res.coverage_percentage(), + minimum_coverage + ); assert!(res.total_coverable() > 0); } } @@ -181,6 +181,19 @@ fn config_file_coverage() { check_percentage_with_cli_args(0.0f64, true, &args); } +#[test] +fn rustflags_config_coverage() { + let test_dir = get_test_path("multiple_rustflags"); + let mut args = vec![ + "tarpaulin".to_string(), + "--root".to_string(), + test_dir.display().to_string(), + ]; + check_percentage_with_cli_args(1.0f64, true, &args); + args.push("--ignore-config".to_string()); + check_percentage_with_cli_args(0.0f64, false, &args); +} + #[test] fn match_expr_coverage() { check_percentage("matches", 1.0f64, true); From b8e52382029957ec12e637c2c9fbbb8b0d9d9ec2 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 5 Mar 2021 12:49:45 +0400 Subject: [PATCH 26/48] Bump syn from 1.0.60 to 1.0.61 (#713) Bumps [syn](https://github.com/dtolnay/syn) from 1.0.60 to 1.0.61. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/1.0.60...1.0.61) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bbf26390e5..914e815383 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -790,9 +790,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.60" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" +checksum = "ed22b90a0e734a23a7610f4283ac9e5acfb96cbb30dfefa540d66f866f1c09c5" dependencies = [ "proc-macro2", "quote", From bb9cafa465f5fc9f701e19618834c38558269f46 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 8 Mar 2021 10:32:20 +0400 Subject: [PATCH 27/48] Bump syn from 1.0.61 to 1.0.62 (#714) Bumps [syn](https://github.com/dtolnay/syn) from 1.0.61 to 1.0.62. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/1.0.61...1.0.62) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 914e815383..b69109f2c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -790,9 +790,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.61" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed22b90a0e734a23a7610f4283ac9e5acfb96cbb30dfefa540d66f866f1c09c5" +checksum = "123a78a3596b24fee53a6464ce52d8ecbf62241e6294c7e7fe12086cd161f512" dependencies = [ "proc-macro2", "quote", From bc054e238396f0f944fac28edf66faad1d7b5899 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 8 Mar 2021 10:32:29 +0400 Subject: [PATCH 28/48] Bump libc from 0.2.87 to 0.2.88 (#715) Bumps [libc](https://github.com/rust-lang/libc) from 0.2.87 to 0.2.88. - [Release notes](https://github.com/rust-lang/libc/releases) - [Commits](https://github.com/rust-lang/libc/compare/0.2.87...0.2.88) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b69109f2c8..4210787a66 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -393,9 +393,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "265d751d31d6780a3f956bb5b8022feba2d94eeee5a84ba64f4212eedca42213" +checksum = "03b07a082330a35e43f63177cc01689da34fbffa0105e1246cf0311472cac73a" [[package]] name = "libgit2-sys" diff --git a/Cargo.toml b/Cargo.toml index 414ec08250..67c46307a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,7 @@ walkdir = "2.3.1" cfg-if = "1.0.0" [target.'cfg(target_os = "linux")'.dependencies] -libc = "0.2.87" +libc = "0.2.88" nix = "0.20.0" procfs = "0.9" From ebb33d22ac1a2344d456ca562a2c72d98590e7fc Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 8 Mar 2021 10:32:39 +0400 Subject: [PATCH 29/48] Bump serde from 1.0.123 to 1.0.124 (#716) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.123 to 1.0.124. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.123...v1.0.124) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4210787a66..04b2932f45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -721,18 +721,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.123" +version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" +checksum = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.123" +version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" +checksum = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" dependencies = [ "proc-macro2", "quote", From 0d8d19d47c2a26f003353986ea6da1a984983eae Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 8 Mar 2021 10:37:58 +0400 Subject: [PATCH 30/48] Bump indexmap from 1.6.1 to 1.6.2 (#717) Bumps [indexmap](https://github.com/bluss/indexmap) from 1.6.1 to 1.6.2. - [Release notes](https://github.com/bluss/indexmap/releases) - [Commits](https://github.com/bluss/indexmap/compare/1.6.1...1.6.2) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 04b2932f45..c0458f4641 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -361,9 +361,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.6.1" +version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b" +checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" dependencies = [ "autocfg", "hashbrown", diff --git a/Cargo.toml b/Cargo.toml index 67c46307a4..976a8f157b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ fallible-iterator = "0.2.0" gimli = "0.23.0" git2 = "0.13" humantime-serde = "1" -indexmap = { version = "1.6.1", features = ["serde-1"] } +indexmap = { version = "1.6.2", features = ["serde-1"] } lazy_static = "1.0" tracing = { version = "0.1", default-features = false } tracing-subscriber = {version = "0.2.16", default-features = false, features = ["env-filter", "fmt", "chrono", "ansi", "smallvec", "tracing-log"]} From 55b319bffb0ff6972a41845fcc982309bd1c9d96 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 10 Mar 2021 10:57:57 +0400 Subject: [PATCH 31/48] Bump syn from 1.0.62 to 1.0.63 (#718) Bumps [syn](https://github.com/dtolnay/syn) from 1.0.62 to 1.0.63. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/1.0.62...1.0.63) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c0458f4641..0654bfeb80 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -790,9 +790,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.62" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "123a78a3596b24fee53a6464ce52d8ecbf62241e6294c7e7fe12086cd161f512" +checksum = "8fd9bc7ccc2688b3344c2f48b9b546648b25ce0b20fc717ee7fa7981a8ca9717" dependencies = [ "proc-macro2", "quote", From 26e008f3e71bbb536dd78eaa847dfff4d5179d8b Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 12 Mar 2021 11:34:07 +0400 Subject: [PATCH 32/48] Bump regex from 1.4.3 to 1.4.4 (#719) Bumps [regex](https://github.com/rust-lang/regex) from 1.4.3 to 1.4.4. - [Release notes](https://github.com/rust-lang/regex/releases) - [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/regex/compare/1.4.3...1.4.4) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0654bfeb80..cc5ff1f62c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -634,14 +634,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.3" +version = "1.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" +checksum = "54fd1046a3107eb58f42de31d656fee6853e5d276c455fd943742dce89fc3dd3" dependencies = [ "aho-corasick", "memchr", "regex-syntax", - "thread_local", ] [[package]] From 8c1dd0555be35c7dd74520a94047692351e0bed8 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 15 Mar 2021 11:18:46 +0400 Subject: [PATCH 33/48] Bump syn from 1.0.63 to 1.0.64 (#720) Bumps [syn](https://github.com/dtolnay/syn) from 1.0.63 to 1.0.64. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/1.0.63...1.0.64) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cc5ff1f62c..b56c34c781 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -789,9 +789,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd9bc7ccc2688b3344c2f48b9b546648b25ce0b20fc717ee7fa7981a8ca9717" +checksum = "3fd9d1e9976102a03c542daa2eff1b43f9d72306342f3f8b3ed5fb8908195d6f" dependencies = [ "proc-macro2", "quote", From 06c5d6a6b6a036c7fb2847a5d32fe293b3747268 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 15 Mar 2021 11:27:57 +0400 Subject: [PATCH 34/48] Bump tracing-subscriber from 0.2.16 to 0.2.17 (#721) Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.2.16 to 0.2.17. - [Release notes](https://github.com/tokio-rs/tracing/releases) - [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.2.16...tracing-subscriber-0.2.17) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b56c34c781..21748d6680 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -884,9 +884,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ab8966ac3ca27126141f7999361cc97dd6fb4b71da04c02044fa9045d98bb96" +checksum = "705096c6f83bf68ea5d357a6aa01829ddbdac531b357b45abeca842938085baa" dependencies = [ "ansi_term 0.12.1", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 976a8f157b..faf36075fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ humantime-serde = "1" indexmap = { version = "1.6.2", features = ["serde-1"] } lazy_static = "1.0" tracing = { version = "0.1", default-features = false } -tracing-subscriber = {version = "0.2.16", default-features = false, features = ["env-filter", "fmt", "chrono", "ansi", "smallvec", "tracing-log"]} +tracing-subscriber = {version = "0.2.17", default-features = false, features = ["env-filter", "fmt", "chrono", "ansi", "smallvec", "tracing-log"]} memmap = "0.7.0" object = "0.23" proc-macro2 = { version = "1.0", features = ["span-locations"] } From fc28ce6dbf58cfdf5988b3bec427c8b52b5d8431 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 15 Mar 2021 11:28:05 +0400 Subject: [PATCH 35/48] Bump regex from 1.4.4 to 1.4.5 (#722) Bumps [regex](https://github.com/rust-lang/regex) from 1.4.4 to 1.4.5. - [Release notes](https://github.com/rust-lang/regex/releases) - [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/regex/compare/1.4.4...1.4.5) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 21748d6680..a1ebb72a5b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -634,9 +634,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.4" +version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54fd1046a3107eb58f42de31d656fee6853e5d276c455fd943742dce89fc3dd3" +checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" dependencies = [ "aho-corasick", "memchr", From c2b50738e4b823c50c2d73a6e3ca118bbeaeca7e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 16 Mar 2021 09:55:53 +0400 Subject: [PATCH 36/48] Bump libc from 0.2.88 to 0.2.89 (#723) Bumps [libc](https://github.com/rust-lang/libc) from 0.2.88 to 0.2.89. - [Release notes](https://github.com/rust-lang/libc/releases) - [Commits](https://github.com/rust-lang/libc/compare/0.2.88...0.2.89) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a1ebb72a5b..8dd08e6db3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -393,9 +393,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b07a082330a35e43f63177cc01689da34fbffa0105e1246cf0311472cac73a" +checksum = "538c092e5586f4cdd7dd8078c4a79220e3e168880218124dcbce860f0ea938c6" [[package]] name = "libgit2-sys" diff --git a/Cargo.toml b/Cargo.toml index faf36075fa..964c87e884 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,7 @@ walkdir = "2.3.1" cfg-if = "1.0.0" [target.'cfg(target_os = "linux")'.dependencies] -libc = "0.2.88" +libc = "0.2.89" nix = "0.20.0" procfs = "0.9" From a7d9529cb55518f01396032ff9a2b3391bcacc1e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 19 Mar 2021 10:31:24 +0400 Subject: [PATCH 37/48] Bump libc from 0.2.89 to 0.2.90 (#725) Bumps [libc](https://github.com/rust-lang/libc) from 0.2.89 to 0.2.90. - [Release notes](https://github.com/rust-lang/libc/releases) - [Commits](https://github.com/rust-lang/libc/compare/0.2.89...0.2.90) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8dd08e6db3..975e063f23 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -393,9 +393,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "538c092e5586f4cdd7dd8078c4a79220e3e168880218124dcbce860f0ea938c6" +checksum = "ba4aede83fc3617411dc6993bc8c70919750c1c257c6ca6a502aed6e0e2394ae" [[package]] name = "libgit2-sys" diff --git a/Cargo.toml b/Cargo.toml index 964c87e884..d57e411244 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,7 @@ walkdir = "2.3.1" cfg-if = "1.0.0" [target.'cfg(target_os = "linux")'.dependencies] -libc = "0.2.89" +libc = "0.2.90" nix = "0.20.0" procfs = "0.9" From d55ffc79143c1cf1db135a953498e94719a07008 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 23 Mar 2021 12:48:03 +0400 Subject: [PATCH 38/48] Bump libc from 0.2.90 to 0.2.91 (#726) Bumps [libc](https://github.com/rust-lang/libc) from 0.2.90 to 0.2.91. - [Release notes](https://github.com/rust-lang/libc/releases) - [Commits](https://github.com/rust-lang/libc/compare/0.2.90...0.2.91) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 975e063f23..8a02991056 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -393,9 +393,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4aede83fc3617411dc6993bc8c70919750c1c257c6ca6a502aed6e0e2394ae" +checksum = "8916b1f6ca17130ec6568feccee27c156ad12037880833a3b842a823236502e7" [[package]] name = "libgit2-sys" diff --git a/Cargo.toml b/Cargo.toml index d57e411244..53c1eceb33 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,7 @@ walkdir = "2.3.1" cfg-if = "1.0.0" [target.'cfg(target_os = "linux")'.dependencies] -libc = "0.2.90" +libc = "0.2.91" nix = "0.20.0" procfs = "0.9" From 1337f4fb30cd206f1d512a82ffe364adc1ded2da Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 23 Mar 2021 12:48:19 +0400 Subject: [PATCH 39/48] Bump serde from 1.0.124 to 1.0.125 (#727) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.124 to 1.0.125. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.124...v1.0.125) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a02991056..8e4970f3aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -720,18 +720,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.124" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" +checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.124" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" +checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" dependencies = [ "proc-macro2", "quote", From 9e9a4a4ca7e6bfa322182c837d32036946279e4a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 23 Mar 2021 13:27:59 +0400 Subject: [PATCH 40/48] Bump walkdir from 2.3.1 to 2.3.2 (#728) Bumps [walkdir](https://github.com/BurntSushi/walkdir) from 2.3.1 to 2.3.2. - [Release notes](https://github.com/BurntSushi/walkdir/releases) - [Commits](https://github.com/BurntSushi/walkdir/compare/2.3.1...2.3.2) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8e4970f3aa..367cd49780 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -963,9 +963,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "walkdir" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" dependencies = [ "same-file", "winapi", diff --git a/Cargo.toml b/Cargo.toml index 53c1eceb33..cc022c5b93 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" syn = { version = "1.0", features = ["full"]} toml = "0.5" -walkdir = "2.3.1" +walkdir = "2.3.2" cfg-if = "1.0.0" [target.'cfg(target_os = "linux")'.dependencies] From 9375dfe04f1d9e9154d89619e3b407cd501a121e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 29 Mar 2021 10:28:18 +0400 Subject: [PATCH 41/48] Bump syn from 1.0.64 to 1.0.67 (#730) Bumps [syn](https://github.com/dtolnay/syn) from 1.0.64 to 1.0.67. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/1.0.64...1.0.67) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 367cd49780..4f44f1ac86 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -789,9 +789,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.64" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fd9d1e9976102a03c542daa2eff1b43f9d72306342f3f8b3ed5fb8908195d6f" +checksum = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702" dependencies = [ "proc-macro2", "quote", From 1bfff4827f43a4557854c791aa66a8f8e12dc473 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 31 Mar 2021 10:11:54 +0400 Subject: [PATCH 42/48] Bump libc from 0.2.91 to 0.2.92 (#731) Bumps [libc](https://github.com/rust-lang/libc) from 0.2.91 to 0.2.92. - [Release notes](https://github.com/rust-lang/libc/releases) - [Commits](https://github.com/rust-lang/libc/compare/0.2.91...0.2.92) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4f44f1ac86..b2d94511fa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -393,9 +393,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8916b1f6ca17130ec6568feccee27c156ad12037880833a3b842a823236502e7" +checksum = "56d855069fafbb9b344c0f962150cd2c1187975cb1c22c1522c240d8c4986714" [[package]] name = "libgit2-sys" diff --git a/Cargo.toml b/Cargo.toml index cc022c5b93..0ecd5be75d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,7 @@ walkdir = "2.3.2" cfg-if = "1.0.0" [target.'cfg(target_os = "linux")'.dependencies] -libc = "0.2.91" +libc = "0.2.92" nix = "0.20.0" procfs = "0.9" From cb6b974150fdae332db412e91ecb2d3322aed17f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 2 Apr 2021 10:13:15 +0400 Subject: [PATCH 43/48] Bump proc-macro2 from 1.0.24 to 1.0.26 (#733) Bumps [proc-macro2](https://github.com/alexcrichton/proc-macro2) from 1.0.24 to 1.0.26. - [Release notes](https://github.com/alexcrichton/proc-macro2/releases) - [Commits](https://github.com/alexcrichton/proc-macro2/compare/1.0.24...1.0.26) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b2d94511fa..6165b13021 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -592,9 +592,9 @@ checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "proc-macro2" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec" dependencies = [ "unicode-xid", ] From 104a390e0511157489951f926e89cb1144c19fa8 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 2 Apr 2021 10:13:27 +0400 Subject: [PATCH 44/48] Bump syn from 1.0.67 to 1.0.68 (#732) Bumps [syn](https://github.com/dtolnay/syn) from 1.0.67 to 1.0.68. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/1.0.67...1.0.68) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6165b13021..24573b2c1b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -789,9 +789,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.67" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702" +checksum = "3ce15dd3ed8aa2f8eeac4716d6ef5ab58b6b9256db41d7e1a0224c2788e8fd87" dependencies = [ "proc-macro2", "quote", From f115223594df788cf3fef0d50d9f16440e01766f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 7 Apr 2021 17:02:44 +0400 Subject: [PATCH 45/48] Bump libc from 0.2.92 to 0.2.93 (#734) Bumps [libc](https://github.com/rust-lang/libc) from 0.2.92 to 0.2.93. - [Release notes](https://github.com/rust-lang/libc/releases) - [Commits](https://github.com/rust-lang/libc/compare/0.2.92...0.2.93) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 24573b2c1b..a023c66c5e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -393,9 +393,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56d855069fafbb9b344c0f962150cd2c1187975cb1c22c1522c240d8c4986714" +checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41" [[package]] name = "libgit2-sys" diff --git a/Cargo.toml b/Cargo.toml index 0ecd5be75d..f8233f266f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,7 @@ walkdir = "2.3.2" cfg-if = "1.0.0" [target.'cfg(target_os = "linux")'.dependencies] -libc = "0.2.92" +libc = "0.2.93" nix = "0.20.0" procfs = "0.9" From 2eb72209c908b5fe3be55cfeb2da4d723f103d2f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 8 Apr 2021 10:24:21 +0400 Subject: [PATCH 46/48] Bump syn from 1.0.68 to 1.0.69 (#735) Bumps [syn](https://github.com/dtolnay/syn) from 1.0.68 to 1.0.69. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/1.0.68...1.0.69) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a023c66c5e..170b13c7ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -789,9 +789,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.68" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ce15dd3ed8aa2f8eeac4716d6ef5ab58b6b9256db41d7e1a0224c2788e8fd87" +checksum = "48fe99c6bd8b1cc636890bcc071842de909d902c81ac7dab53ba33c421ab8ffb" dependencies = [ "proc-macro2", "quote", From dc4d8627b29a6b74f733b135d1ba317cda92e963 Mon Sep 17 00:00:00 2001 From: xd009642 Date: Fri, 16 Apr 2021 16:22:09 +0400 Subject: [PATCH 47/48] Prepare for alpha2 release --- CHANGELOG.md | 2 +- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 4 +++- src/config/mod.rs | 15 +++++++++++++-- src/main.rs | 1 + travis-install.sh | 2 +- 7 files changed, 21 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb62978ddb..6323f6988f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ From 2019 onwards, all notable changes to tarpaulin will be documented in this file. -## [Unreleased] +## [0.18.0-alpha2] 2021-04-16 ### Added - Check if user sets -Cdebuginfo and remove it #601 - INTERNAL Added ability to build with LLVM coverage instrumentation and detect diff --git a/Cargo.lock b/Cargo.lock index 170b13c7ee..54fa097124 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -88,7 +88,7 @@ dependencies = [ [[package]] name = "cargo-tarpaulin" -version = "0.18.0-alpha1" +version = "0.18.0-alpha2" dependencies = [ "cargo_metadata", "cfg-if 1.0.0", diff --git a/Cargo.toml b/Cargo.toml index f8233f266f..bcfe68b53c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo-tarpaulin" -version = "0.18.0-alpha1" +version = "0.18.0-alpha2" authors = ["Daniel McKenna "] description = "Cargo-Tarpaulin is a tool to determine code coverage achieved via tests" repository = "https://github.com/xd009642/tarpaulin" diff --git a/README.md b/README.md index 90a7111d18..1174973bc5 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Below is the help-text for a thorough explanation of the flags and features available: ``` -cargo-tarpaulin version: 0.18.0-alpha1 +cargo-tarpaulin version: 0.18.0-alpha2 Tool to analyse test coverage of cargo projects USAGE: @@ -66,6 +66,7 @@ FLAGS: --print-rust-flags Print the RUSTFLAGS options that tarpaulin will compile your program with and exit --print-rustdoc-flags Print the RUSTDOCFLAGS options that tarpaulin will compile any doctests with and exit --release Build in release mode. + --skip-clean The opposite of --force-clean --tests Test all tests -V, --version Prints version information -v, --verbose Show extra output @@ -105,6 +106,7 @@ OPTIONS: will look for a Cargo.toml in root --run-types ... Type of the coverage run [possible values: Tests, Doctests, Benchmarks, Examples, Lib, Bins, AllTargets] + --rustflags rustflags to add when building project (can also be set via RUSTFLAGS env var) --target Compilation target triple --target-dir Directory for all generated artifacts --test ... Test only the specified test target diff --git a/src/config/mod.rs b/src/config/mod.rs index efda7f1b5c..feede3745a 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -188,7 +188,7 @@ impl Default for Config { all_targets: false, ignore_tests: false, ignore_panics: false, - force_clean: false, + force_clean: true, verbose: false, debug: false, follow_exec: false, @@ -251,6 +251,17 @@ impl<'a> From<&'a ArgMatches<'a>> for ConfigWrapper { } else { Some(features.join(" ")) }; + let force_clean = match ( + args.is_present("force-clean"), + args.is_present("skip-clean"), + ) { + (true, false) | (false, false) => true, + (false, true) => false, + _ => { + warn!("skip-clean and force-clean are incompatible. Selecting force-clean"); + true + } + }; let args_config = Config { name: String::new(), @@ -263,7 +274,7 @@ impl<'a> From<&'a ArgMatches<'a>> for ConfigWrapper { run_ignored: args.is_present("ignored"), ignore_tests: args.is_present("ignore-tests"), ignore_panics: args.is_present("ignore-panics"), - force_clean: args.is_present("force-clean"), + force_clean, no_fail_fast: args.is_present("no-fail-fast"), all_targets: args.is_present("all-targets"), follow_exec: args.is_present("follow-exec"), diff --git a/src/main.rs b/src/main.rs index 8f95dc045c..ef9cfbdfd1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -68,6 +68,7 @@ fn main() -> Result<(), String> { --count 'Counts the number of hits during coverage' --ignored -i 'Run ignored tests as well' --line -l 'Line coverage' + --skip-clean 'The opposite of --force-clean' --force-clean 'Adds a clean stage to work around cargo bugs that may affect coverage results' --fail-under [PERCENTAGE] 'Sets a percentage threshold for failure ranging from 0-100, if coverage is below exit with a non-zero code' --branch -b 'Branch coverage: NOT IMPLEMENTED' diff --git a/travis-install.sh b/travis-install.sh index 1a57a42fcb..41ddb41e83 100755 --- a/travis-install.sh +++ b/travis-install.sh @@ -1,2 +1,2 @@ #!/bin/bash -curl -sL https://github.com/xd009642/tarpaulin/releases/download/0.16.0/cargo-tarpaulin-0.16.0-travis.tar.gz | tar xvz -C $HOME/.cargo/bin +curl -sL https://github.com/xd009642/tarpaulin/releases/download/0.18.0-alpha2/cargo-tarpaulin-0.18.0-alpha2-travis.tar.gz | tar xvz -C $HOME/.cargo/bin From a72f78c48c20117780fb9418e0ca2a4dc47788f0 Mon Sep 17 00:00:00 2001 From: xd009642 Date: Fri, 16 Apr 2021 18:18:41 +0400 Subject: [PATCH 48/48] Fix tests and update changelog --- CHANGELOG.md | 1 + src/statemachine/mod.rs | 12 ------------ tests/data/configs/tarpaulin.toml | 2 ++ tests/doc_coverage.rs | 4 ++++ tests/failure_thresholds.rs | 3 +++ tests/failures.rs | 4 ++++ tests/line_coverage.rs | 3 ++- tests/mod.rs | 18 +++++++++++++++--- tests/test_types.rs | 8 ++++---- tests/workspaces.rs | 2 ++ 10 files changed, 37 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6323f6988f..6955f2cbbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ compiler support. This isn't enabled so should have no effect it's just the start of the support work. - Now factors in rustflags from toml files #528 - Now able to add to rustflags via CLI args and via tarpaulin config files +- Added `--skip-clean` arg as an inverse to `--force-clean` and made cleaning default ### Changed - Make doctest prefix matching less specific as the naming convention changed again diff --git a/src/statemachine/mod.rs b/src/statemachine/mod.rs index 901445a9ba..97e1e1f6db 100644 --- a/src/statemachine/mod.rs +++ b/src/statemachine/mod.rs @@ -59,18 +59,6 @@ pub enum TracerAction { } impl TracerAction { - pub fn is_detach(&self) -> bool { - matches!(self, TracerAction::Detach(_)) - } - - pub fn is_continue(&self) -> bool { - matches!(self, TracerAction::Continue(_)) - } - - pub fn is_step(&self) -> bool { - matches!(self, TracerAction::Step(_)) - } - pub fn get_data(&self) -> Option<&T> { match self { TracerAction::Continue(d) => Some(d), diff --git a/tests/data/configs/tarpaulin.toml b/tests/data/configs/tarpaulin.toml index 98348ddd97..5d9a8b2c49 100644 --- a/tests/data/configs/tarpaulin.toml +++ b/tests/data/configs/tarpaulin.toml @@ -1,5 +1,7 @@ [coverage] features = "feature1" +force_clean = false [coverage_2] features = "feature2" +force_clean = false diff --git a/tests/doc_coverage.rs b/tests/doc_coverage.rs index 885a1f1bc8..eb1cc6ab7d 100644 --- a/tests/doc_coverage.rs +++ b/tests/doc_coverage.rs @@ -8,6 +8,7 @@ use std::time::Duration; fn doc_test_coverage() { let mut config = Config::default(); config.verbose = true; + config.force_clean = false; config.test_timeout = Duration::from_secs(60); let test_dir = get_test_path("doc_coverage"); env::set_current_dir(&test_dir).unwrap(); @@ -34,6 +35,7 @@ fn doc_test_coverage() { fn doc_test_panics() { let mut config = Config::default(); config.verbose = true; + config.force_clean = false; config.test_timeout = Duration::from_secs(60); let test_dir = get_test_path("doctest_should_panic"); env::set_current_dir(&test_dir).unwrap(); @@ -60,6 +62,7 @@ fn doc_test_panics() { fn doc_test_panics_workspace() { let mut config = Config::default(); config.verbose = true; + config.force_clean = false; config.test_timeout = Duration::from_secs(60); let test_dir = get_test_path("doctest_workspace_should_panic"); env::set_current_dir(&test_dir).unwrap(); @@ -86,6 +89,7 @@ fn doc_test_panics_workspace() { fn doc_test_compile_fail() { let mut config = Config::default(); config.verbose = true; + config.force_clean = false; config.test_timeout = Duration::from_secs(60); let test_dir = get_test_path("doctest_compile_fail_fail"); env::set_current_dir(&test_dir).unwrap(); diff --git a/tests/failure_thresholds.rs b/tests/failure_thresholds.rs index 5c4fc35374..66522cb2e0 100644 --- a/tests/failure_thresholds.rs +++ b/tests/failure_thresholds.rs @@ -11,6 +11,7 @@ fn coverage_below_threshold() { config.manifest = test_dir; config.manifest.push("Cargo.toml"); config.fail_under = Some(100.0); + config.force_clean = false; let result = run(&[config]); @@ -31,6 +32,7 @@ fn coverage_above_threshold() { config.manifest = test_dir; config.manifest.push("Cargo.toml"); config.fail_under = Some(30.0); + config.force_clean = false; let result = run(&[config]); @@ -45,6 +47,7 @@ fn report_coverage_fail() { config.manifest = test_dir.clone(); config.manifest.push("Cargo.toml"); config.fail_under = Some(10.0); + config.force_clean = false; let mut report = Config::default(); report.name = "report".to_string(); diff --git a/tests/failures.rs b/tests/failures.rs index 72891bc820..55046f99aa 100644 --- a/tests/failures.rs +++ b/tests/failures.rs @@ -13,6 +13,7 @@ fn error_if_build_script_fails() { env::set_current_dir(&test_dir).unwrap(); config.manifest = test_dir; config.manifest.push("Cargo.toml"); + config.force_clean = false; let result = launch_tarpaulin(&config, &None); @@ -31,6 +32,7 @@ fn error_if_compilation_fails() { env::set_current_dir(&test_dir).unwrap(); config.manifest = test_dir; config.manifest.push("Cargo.toml"); + config.force_clean = false; let result = launch_tarpaulin(&config, &None); @@ -49,6 +51,7 @@ fn error_if_test_fails() { env::set_current_dir(&test_dir).unwrap(); config.manifest = test_dir; config.manifest.push("Cargo.toml"); + config.force_clean = false; let result = run(&[config]); @@ -68,6 +71,7 @@ fn issue_610() { env::set_current_dir(&test_dir).unwrap(); config.manifest = test_dir; config.manifest.push("Cargo.toml"); + config.force_clean = false; let result = run(&[config.clone()]); assert!(result.is_ok()); diff --git a/tests/line_coverage.rs b/tests/line_coverage.rs index 425f7caabb..6e4354be10 100644 --- a/tests/line_coverage.rs +++ b/tests/line_coverage.rs @@ -8,7 +8,7 @@ use std::time::Duration; #[test] fn simple_project_coverage() { let mut config = Config::default(); - config.verbose = true; + config.force_clean = false; config.test_timeout = Duration::from_secs(60); let restore_dir = env::current_dir().unwrap(); let test_dir = get_test_path("simple_project"); @@ -50,6 +50,7 @@ fn simple_project_coverage() { fn debug_info_0() { // From issue #601 let mut config = Config::default(); + config.force_clean = false; let restore_dir = env::current_dir().unwrap(); let test_dir = get_test_path("simple_project"); env::set_current_dir(&test_dir).unwrap(); diff --git a/tests/mod.rs b/tests/mod.rs index bbf56eb287..8c95ae09fd 100644 --- a/tests/mod.rs +++ b/tests/mod.rs @@ -28,9 +28,10 @@ pub fn check_percentage_with_cli_args(minimum_coverage: f64, has_lines: bool, ar --root -r [DIR] 'directory'" ).get_matches_from(args); - let configs = ConfigWrapper::from(&matches).0; + let mut configs = ConfigWrapper::from(&matches).0; let mut res = TraceMap::new(); - for config in &configs { + for config in configs.iter_mut() { + config.force_clean = false; let (t, _) = launch_tarpaulin(&config, &None).unwrap(); res.merge(&t); } @@ -59,6 +60,7 @@ pub fn check_percentage_with_config( env::set_current_dir(&test_dir).unwrap(); config.manifest = test_dir; config.manifest.push("Cargo.toml"); + config.force_clean = false; // Note to contributors. If an integration test fails, uncomment this to be able to see the // tarpaulin logs @@ -82,7 +84,8 @@ pub fn check_percentage_with_config( } pub fn check_percentage(project_name: &str, minimum_coverage: f64, has_lines: bool) { - let config = Config::default(); + let mut config = Config::default(); + config.force_clean = false; check_percentage_with_config(project_name, minimum_coverage, has_lines, config); } @@ -90,6 +93,7 @@ pub fn check_percentage(project_name: &str, minimum_coverage: f64, has_lines: bo fn incorrect_manifest_path() { let mut config = Config::default(); config.manifest.push("__invalid_dir__"); + config.force_clean = false; let launch = launch_tarpaulin(&config, &None); assert!(launch.is_err()); } @@ -98,6 +102,7 @@ fn incorrect_manifest_path() { fn proc_macro_link() { let mut config = Config::default(); config.test_timeout = Duration::from_secs(60); + config.force_clean = false; let test_dir = get_test_path("proc_macro"); config.manifest = test_dir.join("Cargo.toml"); assert!(launch_tarpaulin(&config, &None).is_ok()); @@ -206,6 +211,7 @@ fn benchmark_coverage() { check_percentage(test, 0.0f64, true); let mut config = Config::default(); + config.force_clean = false; config.run_types = vec![RunType::Benchmarks]; check_percentage_with_config(test, 1.0f64, true, config); } @@ -214,6 +220,7 @@ fn benchmark_coverage() { fn cargo_run_coverage() { let mut config = Config::default(); config.command = Mode::Build; + config.force_clean = false; check_percentage_with_config("run_coverage", 1.0f64, true, config); } @@ -224,6 +231,7 @@ fn examples_coverage() { let mut config = Config::default(); config.run_types = vec![RunType::Examples]; + config.force_clean = false; check_percentage_with_config(test, 1.0f64, true, config.clone()); config.run_types.clear(); @@ -264,6 +272,7 @@ fn cargo_home_filtering() { let mut config = Config::default(); config.test_timeout = Duration::from_secs(60); + config.force_clean = false; let restore_dir = env::current_dir().unwrap(); let test_dir = get_test_path("HttptestAndReqwest"); env::set_current_dir(&test_dir).unwrap(); @@ -290,6 +299,7 @@ fn rustflags_handling() { check_percentage("rustflags", 1.0f64, true); env::set_var("RUSTFLAGS", "--cfg=foo"); let mut config = Config::default(); + config.force_clean = false; let restore_dir = env::current_dir().unwrap(); let test_dir = get_test_path("rustflags"); @@ -307,8 +317,10 @@ fn rustflags_handling() { assert_eq!(ret, 0); } +#[test] fn follow_exes_down() { let mut config = Config::default(); config.follow_exec = true; + config.force_clean = false; check_percentage_with_config("follow_exe", 1.0f64, true, config); } diff --git a/tests/test_types.rs b/tests/test_types.rs index 9049f5d298..d206d78563 100644 --- a/tests/test_types.rs +++ b/tests/test_types.rs @@ -7,7 +7,7 @@ use std::time::Duration; #[test] fn only_test_coverage() { let mut config = Config::default(); - config.verbose = true; + config.force_clean = false; config.test_timeout = Duration::from_secs(60); config.run_types = vec![RunType::Tests]; let restore_dir = env::current_dir().unwrap(); @@ -33,7 +33,7 @@ fn only_test_coverage() { #[test] fn only_example_coverage() { let mut config = Config::default(); - config.verbose = true; + config.force_clean = false; config.test_timeout = Duration::from_secs(60); config.run_types = vec![RunType::Examples]; let restore_dir = env::current_dir().unwrap(); @@ -60,7 +60,7 @@ fn only_example_coverage() { #[ignore] fn only_bench_coverage() { let mut config = Config::default(); - config.verbose = true; + config.force_clean = false; config.test_timeout = Duration::from_secs(60); config.run_types = vec![RunType::Benchmarks]; let restore_dir = env::current_dir().unwrap(); @@ -87,7 +87,7 @@ fn only_bench_coverage() { #[cfg(feature = "nightly")] fn only_doctest_coverage() { let mut config = Config::default(); - config.verbose = true; + config.force_clean = false; config.test_timeout = Duration::from_secs(60); config.run_types = vec![RunType::Doctests]; let restore_dir = env::current_dir().unwrap(); diff --git a/tests/workspaces.rs b/tests/workspaces.rs index fdf5a90879..030741db5e 100644 --- a/tests/workspaces.rs +++ b/tests/workspaces.rs @@ -11,6 +11,7 @@ fn package_exclude() { env::set_current_dir(&test_dir).unwrap(); config.manifest = test_dir; config.manifest.push("Cargo.toml"); + config.force_clean = false; config.all = true; let result = launch_tarpaulin(&config, &None); @@ -40,6 +41,7 @@ fn package_exclude() { #[test] fn specify_package() { let mut config = Config::default(); + config.force_clean = false; let test_dir = get_test_path("workspace"); env::set_current_dir(&test_dir).unwrap(); config.manifest = test_dir;