ui_test: support multiple filters
This commit is contained in:
parent
065ff89e33
commit
e37dfa6d91
@ -47,7 +47,8 @@ fn run_tests(mode: Mode, path: &str, target: Option<String>) {
|
||||
(true, true) => panic!("cannot use MIRI_BLESS and MIRI_SKIP_UI_CHECKS at the same time"),
|
||||
};
|
||||
|
||||
let path_filter = std::env::args().skip(1).next();
|
||||
// Pass on all arguments as filters.
|
||||
let path_filter = std::env::args().skip(1);
|
||||
|
||||
let config = Config {
|
||||
args: flags,
|
||||
@ -56,7 +57,7 @@ fn run_tests(mode: Mode, path: &str, target: Option<String>) {
|
||||
stdout_filters: STDOUT.clone(),
|
||||
root_dir: PathBuf::from(path),
|
||||
mode,
|
||||
path_filter,
|
||||
path_filter: path_filter.collect(),
|
||||
program: miri_path(),
|
||||
output_conflict_handling,
|
||||
};
|
||||
|
@ -30,8 +30,8 @@ pub struct Config {
|
||||
pub mode: Mode,
|
||||
pub program: PathBuf,
|
||||
pub output_conflict_handling: OutputConflictHandling,
|
||||
/// Only run tests with this string in their path/name
|
||||
pub path_filter: Option<String>,
|
||||
/// Only run tests with one of these strings in their path/name
|
||||
pub path_filter: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -77,12 +77,13 @@ pub fn run_tests(config: Config) {
|
||||
if !path.extension().map(|ext| ext == "rs").unwrap_or(false) {
|
||||
continue;
|
||||
}
|
||||
if let Some(path_filter) = &config.path_filter {
|
||||
if !path.display().to_string().contains(path_filter) {
|
||||
if !config.path_filter.is_empty() {
|
||||
let path_display = path.display().to_string();
|
||||
if !config.path_filter.iter().any(|filter| path_display.contains(filter)) {
|
||||
ignored.fetch_add(1, Ordering::Relaxed);
|
||||
eprintln!(
|
||||
"{} .. {}",
|
||||
path.display(),
|
||||
path_display,
|
||||
"ignored (command line filter)".yellow()
|
||||
);
|
||||
continue;
|
||||
|
@ -10,7 +10,7 @@ fn config() -> Config {
|
||||
stdout_filters: vec![],
|
||||
root_dir: PathBuf::from("."),
|
||||
mode: Mode::Fail,
|
||||
path_filter: None,
|
||||
path_filter: vec![],
|
||||
program: PathBuf::from("cake"),
|
||||
output_conflict_handling: OutputConflictHandling::Error,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user