Revive the -T aka --time-passes argument to report run times on the CLI;

This commit is contained in:
Benjamin Bouvier
2018-10-15 20:17:25 +02:00
committed by Dan Gohman
parent 58229e10bf
commit af0a239539
5 changed files with 54 additions and 9 deletions

View File

@@ -4,6 +4,7 @@
//! scanning directories for tests.
use concurrent::{ConcurrentRunner, Reply};
use cranelift_codegen::timing;
use std::error::Error;
use std::ffi::OsStr;
use std::fmt::{self, Display};
@@ -62,6 +63,9 @@ impl Display for QueueEntry {
pub struct TestRunner {
verbose: bool,
// Should we print the timings out?
report_times: bool,
// Directories that have not yet been scanned.
dir_stack: Vec<PathBuf>,
@@ -85,9 +89,10 @@ pub struct TestRunner {
impl TestRunner {
/// Create a new blank TrstRunner.
pub fn new(verbose: bool) -> Self {
pub fn new(verbose: bool, report_times: bool) -> Self {
Self {
verbose,
report_times,
dir_stack: Vec::new(),
tests: Vec::new(),
new_tests: 0,
@@ -300,6 +305,9 @@ impl TestRunner {
}
}
conc.join();
if self.report_times {
println!("{}", timing::take_current());
}
}
}