From 3484d727c3b26e9596ec3bd671e2a76a87cdb5fd Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 15 Feb 2020 18:00:14 +0100 Subject: Extend analysis-stats a bit This adds some tools helpful when debugging nondeterminism in analysis-stats: - a `--randomize` option that analyses everything in random order - a `-vv` option that prints even more detail Also add a debug log if Chalk fuel is exhausted (which would be a source of nondeterminism, but didn't happen in my tests). I found one source of nondeterminism (rust-lang/chalk#331), but there are still other cases remaining. --- crates/ra_cli/src/main.rs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'crates/ra_cli/src/main.rs') diff --git a/crates/ra_cli/src/main.rs b/crates/ra_cli/src/main.rs index 806612c2c..6a0e447b9 100644 --- a/crates/ra_cli/src/main.rs +++ b/crates/ra_cli/src/main.rs @@ -16,6 +16,7 @@ type Result = std::result::Result>; #[derive(Clone, Copy)] pub enum Verbosity { + Spammy, Verbose, Normal, Quiet, @@ -24,7 +25,13 @@ pub enum Verbosity { impl Verbosity { fn is_verbose(self) -> bool { match self { - Verbosity::Verbose => true, + Verbosity::Verbose | Verbosity::Spammy => true, + _ => false, + } + } + fn is_spammy(self) -> bool { + match self { + Verbosity::Spammy => true, _ => false, } } @@ -86,14 +93,18 @@ fn main() -> Result<()> { return Ok(()); } let verbosity = match ( + matches.contains(["-vv", "--spammy"]), matches.contains(["-v", "--verbose"]), matches.contains(["-q", "--quiet"]), ) { - (false, false) => Verbosity::Normal, - (false, true) => Verbosity::Quiet, - (true, false) => Verbosity::Verbose, - (true, true) => Err("Invalid flags: -q conflicts with -v")?, + (true, _, true) => Err("Invalid flags: -q conflicts with -vv")?, + (true, _, false) => Verbosity::Spammy, + (false, false, false) => Verbosity::Normal, + (false, false, true) => Verbosity::Quiet, + (false, true, false) => Verbosity::Verbose, + (false, true, true) => Err("Invalid flags: -q conflicts with -v")?, }; + let randomize = matches.contains("--randomize"); let memory_usage = matches.contains("--memory-usage"); let only: Option = matches.opt_value_from_str(["-o", "--only"])?; let with_deps: bool = matches.contains("--with-deps"); @@ -111,6 +122,7 @@ fn main() -> Result<()> { path.as_ref(), only.as_ref().map(String::as_ref), with_deps, + randomize, )?; } "analysis-bench" => { -- cgit v1.2.3