Reintroduce path filters
This commit is contained in:
parent
10e06be15a
commit
1b7e278922
4
miri
4
miri
@ -133,9 +133,9 @@ test|test-debug|bless|bless-debug)
|
||||
;;
|
||||
esac
|
||||
# Then test, and let caller control flags.
|
||||
# Only in root project as `cargo-miri` has no tests.
|
||||
# Only in root project and ui_test as `cargo-miri` has no tests.
|
||||
cargo test $CARGO_BUILD_FLAGS "$@"
|
||||
cargo test --manifest-path ui_test/Cargo.toml
|
||||
cargo test --manifest-path ui_test/Cargo.toml "$@"
|
||||
;;
|
||||
run|run-debug)
|
||||
# Scan for "--target" to set the "MIRI_TEST_TARGET" env var so
|
||||
|
@ -47,6 +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();
|
||||
|
||||
let config = Config {
|
||||
args: flags,
|
||||
target,
|
||||
@ -54,6 +56,7 @@ fn run_tests(mode: Mode, path: &str, target: Option<String>) {
|
||||
stdout_filters: STDOUT.clone(),
|
||||
root_dir: PathBuf::from(path),
|
||||
mode,
|
||||
path_filter,
|
||||
program: miri_path(),
|
||||
output_conflict_handling,
|
||||
};
|
||||
|
@ -30,6 +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>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -75,6 +77,17 @@ 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) {
|
||||
ignored.fetch_add(1, Ordering::Relaxed);
|
||||
eprintln!(
|
||||
"{} .. {}",
|
||||
path.display(),
|
||||
"ignored (command line filter)".yellow()
|
||||
);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
let comments = Comments::parse_file(&path);
|
||||
// Ignore file if only/ignore rules do (not) apply
|
||||
if ignore_file(&comments, &target) {
|
||||
|
@ -10,6 +10,7 @@ fn config() -> Config {
|
||||
stdout_filters: vec![],
|
||||
root_dir: PathBuf::from("."),
|
||||
mode: Mode::Fail,
|
||||
path_filter: None,
|
||||
program: PathBuf::from("cake"),
|
||||
output_conflict_handling: OutputConflictHandling::Error,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user