Rollup merge of #81356 - ehuss:libtest-filters, r=m-ou-se
libtest: allow multiple filters Libtest ignores any filters after the first. This changes it so that if multiple filters are passed, it will test against all of them. This also affects compiletest to do the same. Closes #30422
This commit is contained in:
commit
b102ea479d
7 changed files with 65 additions and 29 deletions
17
src/test/ui/test-attrs/test-filter-multiple.rs
Normal file
17
src/test/ui/test-attrs/test-filter-multiple.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// run-pass
|
||||
// compile-flags: --test
|
||||
// run-flags: --test-threads=1 test1 test2
|
||||
// check-run-results
|
||||
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
|
||||
// ignore-emscripten no threads support
|
||||
|
||||
#[test]
|
||||
fn test1() {}
|
||||
|
||||
#[test]
|
||||
fn test2() {}
|
||||
|
||||
#[test]
|
||||
fn test3() {
|
||||
panic!("this should not run");
|
||||
}
|
||||
7
src/test/ui/test-attrs/test-filter-multiple.run.stdout
Normal file
7
src/test/ui/test-attrs/test-filter-multiple.run.stdout
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
running 2 tests
|
||||
test test1 ... ok
|
||||
test test2 ... ok
|
||||
|
||||
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out; finished in $TIME
|
||||
|
||||
|
|
@ -240,8 +240,8 @@ pub struct Config {
|
|||
/// Run ignored tests
|
||||
pub run_ignored: bool,
|
||||
|
||||
/// Only run tests that match this filter
|
||||
pub filter: Option<String>,
|
||||
/// Only run tests that match these filters
|
||||
pub filters: Vec<String>,
|
||||
|
||||
/// Exactly match the filter, rather than a substring
|
||||
pub filter_exact: bool,
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
|
|||
suite: matches.opt_str("suite").unwrap(),
|
||||
debugger: None,
|
||||
run_ignored,
|
||||
filter: matches.free.first().cloned(),
|
||||
filters: matches.free.clone(),
|
||||
filter_exact: matches.opt_present("exact"),
|
||||
force_pass_mode: matches.opt_str("pass").map(|mode| {
|
||||
mode.parse::<PassMode>()
|
||||
|
|
@ -280,7 +280,7 @@ pub fn log_config(config: &Config) {
|
|||
logv(c, format!("stage_id: {}", config.stage_id));
|
||||
logv(c, format!("mode: {}", config.mode));
|
||||
logv(c, format!("run_ignored: {}", config.run_ignored));
|
||||
logv(c, format!("filter: {}", opt_str(&config.filter)));
|
||||
logv(c, format!("filters: {:?}", config.filters));
|
||||
logv(c, format!("filter_exact: {}", config.filter_exact));
|
||||
logv(
|
||||
c,
|
||||
|
|
@ -465,7 +465,7 @@ fn configure_lldb(config: &Config) -> Option<Config> {
|
|||
pub fn test_opts(config: &Config) -> test::TestOpts {
|
||||
test::TestOpts {
|
||||
exclude_should_panic: false,
|
||||
filter: config.filter.clone(),
|
||||
filters: config.filters.clone(),
|
||||
filter_exact: config.filter_exact,
|
||||
run_ignored: if config.run_ignored { test::RunIgnored::Yes } else { test::RunIgnored::No },
|
||||
format: if config.quiet { test::OutputFormat::Terse } else { test::OutputFormat::Pretty },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue