@@ -8,7 +8,8 @@ extern crate test;
88use crate :: common:: CompareMode ;
99use crate :: common:: { expected_output_path, output_base_dir, output_relative_path, UI_EXTENSIONS } ;
1010use crate :: common:: { Config , TestPaths } ;
11- use crate :: common:: { DebugInfoCdb , DebugInfoGdbLldb , DebugInfoGdb , DebugInfoLldb , Mode , Pretty } ;
11+ use crate :: common:: { DebugInfoCdb , DebugInfoGdbLldb , DebugInfoGdb , DebugInfoLldb } ;
12+ use crate :: common:: { Mode , ExtraMode , Pretty } ;
1213use getopts:: Options ;
1314use std:: env;
1415use std:: ffi:: OsString ;
@@ -128,6 +129,12 @@ pub fn parse_config(args: Vec<String>) -> Config {
128129 "(compile-fail|run-fail|run-pass|\
129130 run-pass-valgrind|pretty|debug-info|incremental|mir-opt)",
130131 )
132+ . optopt (
133+ "" ,
134+ "filter-mode" ,
135+ "only test files matching any of the comma separated list of modes" ,
136+ "MODES"
137+ )
131138 . optflag ( "" , "ignored" , "run tests marked as ignored" )
132139 . optflag ( "" , "exact" , "filters match exactly" )
133140 . optopt (
@@ -320,6 +327,17 @@ pub fn parse_config(args: Vec<String>) -> Config {
320327 run_ignored,
321328 filter : matches. free . first ( ) . cloned ( ) ,
322329 filter_exact : matches. opt_present ( "exact" ) ,
330+ filter_mode : matches. opt_str ( "filter-mode" ) . map ( |fm| {
331+ fm. split ( ',' )
332+ . map ( |m| match m. parse :: < ExtraMode > ( ) {
333+ Ok ( m) => m,
334+ _ => panic ! (
335+ "--filter-mode only accepts valid modes; `{}` is not valid" ,
336+ m
337+ ) ,
338+ } )
339+ . collect ( )
340+ } ) ,
323341 logfile : matches. opt_str ( "logfile" ) . map ( |s| PathBuf :: from ( & s) ) ,
324342 runtool : matches. opt_str ( "runtool" ) ,
325343 host_rustcflags : matches. opt_str ( "host-rustcflags" ) ,
@@ -382,6 +400,18 @@ pub fn log_config(config: &Config) {
382400 ) ,
383401 ) ;
384402 logv ( c, format ! ( "filter_exact: {}" , config. filter_exact) ) ;
403+ logv (
404+ c,
405+ format ! (
406+ "filter_mode: {}" ,
407+ opt_str( & config. filter_mode. as_ref( ) . map( |fm| {
408+ fm. iter( )
409+ . map( |m| format!( "{}" , m) )
410+ . collect:: <Vec <_>>( )
411+ . join( "," )
412+ } ) )
413+ ) ,
414+ ) ;
385415 logv ( c, format ! ( "runtool: {}" , opt_str( & config. runtool) ) ) ;
386416 logv (
387417 c,
0 commit comments