From 280afc8c0f680603b57e2a597a72cd087b2a3c48 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Fri, 4 Jun 2021 14:58:53 +0000 Subject: [PATCH] Allow passing "-vv" to `cargo fuzz` It should help to figure out how libFuzzer is built and linked against, which in turn should be useful in scenarios like https://github.com/google/oss-fuzz/pull/5867#issuecomment-852870976 --- src/options.rs | 10 +++++----- src/project.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/options.rs b/src/options.rs index c56a521..72916ef 100644 --- a/src/options.rs +++ b/src/options.rs @@ -72,8 +72,8 @@ pub struct BuildOptions { pub debug_assertions: bool, /// Build target with verbose output from `cargo build` - #[structopt(short = "v", long = "verbose")] - pub verbose: bool, + #[structopt(short = "v", long = "verbose", parse(from_occurrences))] + pub verbose: i32, #[structopt(long = "no-default-features")] /// Build artifacts with default Cargo features disabled @@ -144,7 +144,7 @@ impl stdfmt::Display for BuildOptions { write!(f, " -a")?; } - if self.verbose { + for _ in 0..self.verbose { write!(f, " -v")?; } @@ -213,7 +213,7 @@ mod test { dev: false, release: false, debug_assertions: false, - verbose: false, + verbose: 0, no_default_features: false, all_features: false, features: None, @@ -240,7 +240,7 @@ mod test { ..default_opts.clone() }, BuildOptions { - verbose: true, + verbose: 1, ..default_opts.clone() }, BuildOptions { diff --git a/src/project.rs b/src/project.rs index f0c1594..35e2070 100644 --- a/src/project.rs +++ b/src/project.rs @@ -140,7 +140,7 @@ impl FuzzProject { if !build.dev { cmd.arg("--release"); } - if build.verbose { + for _ in 0..build.verbose { cmd.arg("--verbose"); } if build.no_default_features {