diff options
| author | bors <bors@rust-lang.org> | 2016-12-14 00:31:48 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-12-14 00:31:48 +0000 |
| commit | aa7a2e9e61cfb9469c7eb88308fa2e1a087ebdb4 (patch) | |
| tree | 9cba4698ce46878b3967e33b54f228d65ed942c6 /src/tools | |
| parent | a2746170441823cec2807716fab594d62549c5c2 (diff) | |
| parent | 5bf4d6fbc0ca467f16537a5e440fda35d0e2780b (diff) | |
| download | rust-aa7a2e9e61cfb9469c7eb88308fa2e1a087ebdb4.tar.gz rust-aa7a2e9e61cfb9469c7eb88308fa2e1a087ebdb4.zip | |
Auto merge of #38181 - jsgf:test-filter-exact, r=alexcrichton
libtest: add --exact to make filter matching exact Filter matching is by substring by default. This makes it impossible to run a single test if its name is a substring of some other test. For example, its not possible to run just `mymod::test` with these tests: ``` mymod::test mymod::test1 mymod::test_module::moretests ``` You could declare by convention that no test has a name that's a substring of another test, but that's not really practical. This PR adds the `--exact` flag, to make filter matching exactly match the complete name.
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/compiletest/src/common.rs | 3 | ||||
| -rw-r--r-- | src/tools/compiletest/src/main.rs | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 34f3837d8bb..1aeb76c0a0e 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -127,6 +127,9 @@ pub struct Config { // Only run tests that match this filter pub filter: Option<String>, + // Exactly match the filter, rather than a substring + pub filter_exact: bool, + // Write out a parseable log of tests that were run pub logfile: Option<PathBuf>, diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index d8681c9d6ed..cbdf75eda26 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -89,6 +89,7 @@ pub fn parse_config(args: Vec<String> ) -> Config { "(compile-fail|parse-fail|run-fail|run-pass|\ run-pass-valgrind|pretty|debug-info|incremental|mir-opt)"), optflag("", "ignored", "run tests marked as ignored"), + optflag("", "exact", "filters match exactly"), optopt("", "runtool", "supervisor program to run tests under \ (eg. emulator, valgrind)", "PROGRAM"), optopt("", "host-rustcflags", "flags to pass to rustc for host", "FLAGS"), @@ -167,6 +168,7 @@ pub fn parse_config(args: Vec<String> ) -> Config { mode: matches.opt_str("mode").unwrap().parse().ok().expect("invalid mode"), run_ignored: matches.opt_present("ignored"), filter: matches.free.first().cloned(), + filter_exact: matches.opt_present("exact"), logfile: matches.opt_str("logfile").map(|s| PathBuf::from(&s)), runtool: matches.opt_str("runtool"), host_rustcflags: matches.opt_str("host-rustcflags"), @@ -216,6 +218,7 @@ pub fn log_config(config: &Config) { opt_str(&config.filter .as_ref() .map(|re| re.to_owned())))); + logv(c, format!("filter_exact: {}", config.filter_exact)); logv(c, format!("runtool: {}", opt_str(&config.runtool))); logv(c, format!("host-rustcflags: {}", opt_str(&config.host_rustcflags))); @@ -309,6 +312,7 @@ pub fn run_tests(config: &Config) { pub fn test_opts(config: &Config) -> test::TestOpts { test::TestOpts { filter: config.filter.clone(), + filter_exact: config.filter_exact, run_ignored: config.run_ignored, quiet: config.quiet, logfile: config.logfile.clone(), |
