Print one character per test instead of one line
This commit is contained in:
parent
30931eeecb
commit
68041b42fc
@ -48,8 +48,17 @@ fn run_tests(mode: Mode, path: &str, target: Option<String>) -> Result<()> {
|
|||||||
(true, true) => panic!("cannot use MIRI_BLESS and MIRI_SKIP_UI_CHECKS at the same time"),
|
(true, true) => panic!("cannot use MIRI_BLESS and MIRI_SKIP_UI_CHECKS at the same time"),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Pass on all arguments as filters.
|
// Pass on all unknown arguments as filters.
|
||||||
let path_filter = std::env::args().skip(1);
|
let mut quiet = false;
|
||||||
|
let path_filter = std::env::args().skip(1).filter(|arg| {
|
||||||
|
match &**arg {
|
||||||
|
"--quiet" => {
|
||||||
|
quiet = true;
|
||||||
|
false
|
||||||
|
}
|
||||||
|
_ => true,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
let use_std = env::var_os("MIRI_NO_STD").is_none();
|
let use_std = env::var_os("MIRI_NO_STD").is_none();
|
||||||
|
|
||||||
@ -76,6 +85,7 @@ fn run_tests(mode: Mode, path: &str, target: Option<String>) -> Result<()> {
|
|||||||
],
|
],
|
||||||
envs: vec![],
|
envs: vec![],
|
||||||
}),
|
}),
|
||||||
|
quiet,
|
||||||
};
|
};
|
||||||
ui_test::run_tests(config)
|
ui_test::run_tests(config)
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,8 @@ pub struct Config {
|
|||||||
/// Can be used to override what command to run instead of `cargo` to build the
|
/// Can be used to override what command to run instead of `cargo` to build the
|
||||||
/// dependencies in `manifest_path`
|
/// dependencies in `manifest_path`
|
||||||
pub dependency_builder: Option<DependencyBuilder>,
|
pub dependency_builder: Option<DependencyBuilder>,
|
||||||
|
/// Print one character per test instead of one line
|
||||||
|
pub quiet: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@ -125,10 +127,38 @@ pub fn run_tests(mut config: Config) -> Result<()> {
|
|||||||
|
|
||||||
// A channel for the messages emitted by the individual test threads.
|
// A channel for the messages emitted by the individual test threads.
|
||||||
let (finish_file, finished_files) = crossbeam::channel::unbounded();
|
let (finish_file, finished_files) = crossbeam::channel::unbounded();
|
||||||
|
enum TestResult {
|
||||||
|
Ok,
|
||||||
|
Failed,
|
||||||
|
Ignored,
|
||||||
|
}
|
||||||
|
|
||||||
s.spawn(|_| {
|
s.spawn(|_| {
|
||||||
for msg in finished_files {
|
if config.quiet {
|
||||||
eprintln!("{msg}");
|
for (i, (_, result)) in finished_files.into_iter().enumerate() {
|
||||||
|
// Humans start counting at 1
|
||||||
|
let i = i + 1;
|
||||||
|
match result {
|
||||||
|
TestResult::Ok => eprint!("{}", ".".green()),
|
||||||
|
TestResult::Failed => eprint!("{}", "F".red().bold()),
|
||||||
|
TestResult::Ignored => eprint!("{}", "i".yellow()),
|
||||||
|
}
|
||||||
|
if i % 100 == 0 {
|
||||||
|
eprintln!(" {i}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (msg, result) in finished_files {
|
||||||
|
eprint!("{msg} ... ");
|
||||||
|
eprintln!(
|
||||||
|
"{}",
|
||||||
|
match result {
|
||||||
|
TestResult::Ok => "ok".green(),
|
||||||
|
TestResult::Failed => "FAILED".red().bold(),
|
||||||
|
TestResult::Ignored => "ignored (in-test comment)".yellow(),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -151,12 +181,7 @@ pub fn run_tests(mut config: Config) -> Result<()> {
|
|||||||
// Ignore file if only/ignore rules do (not) apply
|
// Ignore file if only/ignore rules do (not) apply
|
||||||
if !test_file_conditions(&comments, &target, &config) {
|
if !test_file_conditions(&comments, &target, &config) {
|
||||||
ignored.fetch_add(1, Ordering::Relaxed);
|
ignored.fetch_add(1, Ordering::Relaxed);
|
||||||
let msg = format!(
|
finish_file.send((path.display().to_string(), TestResult::Ignored))?;
|
||||||
"{} ... {}",
|
|
||||||
path.display(),
|
|
||||||
"ignored (in-test comment)".yellow()
|
|
||||||
);
|
|
||||||
finish_file.send(msg)?;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Run the test for all revisions
|
// Run the test for all revisions
|
||||||
@ -171,12 +196,11 @@ pub fn run_tests(mut config: Config) -> Result<()> {
|
|||||||
if !revision.is_empty() {
|
if !revision.is_empty() {
|
||||||
write!(msg, "(revision `{revision}`) ").unwrap();
|
write!(msg, "(revision `{revision}`) ").unwrap();
|
||||||
}
|
}
|
||||||
write!(msg, "... ").unwrap();
|
|
||||||
if errors.is_empty() {
|
if errors.is_empty() {
|
||||||
write!(msg, "{}", "ok".green()).unwrap();
|
finish_file.send((msg, TestResult::Ok))?;
|
||||||
succeeded.fetch_add(1, Ordering::Relaxed);
|
succeeded.fetch_add(1, Ordering::Relaxed);
|
||||||
} else {
|
} else {
|
||||||
write!(msg, "{}", "FAILED".red().bold()).unwrap();
|
finish_file.send((msg, TestResult::Failed))?;
|
||||||
failures.lock().unwrap().push((
|
failures.lock().unwrap().push((
|
||||||
path.clone(),
|
path.clone(),
|
||||||
m,
|
m,
|
||||||
@ -185,7 +209,6 @@ pub fn run_tests(mut config: Config) -> Result<()> {
|
|||||||
stderr,
|
stderr,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
finish_file.send(msg)?;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -18,6 +18,7 @@ fn config() -> Config {
|
|||||||
output_conflict_handling: OutputConflictHandling::Error,
|
output_conflict_handling: OutputConflictHandling::Error,
|
||||||
dependencies_crate_manifest_path: None,
|
dependencies_crate_manifest_path: None,
|
||||||
dependency_builder: None,
|
dependency_builder: None,
|
||||||
|
quiet: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user