@@ -8,7 +8,8 @@ extern crate test;
8
8
use crate :: common:: CompareMode ;
9
9
use crate :: common:: { expected_output_path, output_base_dir, output_relative_path, UI_EXTENSIONS } ;
10
10
use 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 } ;
12
13
use getopts:: Options ;
13
14
use std:: env;
14
15
use std:: ffi:: OsString ;
@@ -128,6 +129,12 @@ pub fn parse_config(args: Vec<String>) -> Config {
128
129
"(compile-fail|run-fail|run-pass|\
129
130
run-pass-valgrind|pretty|debug-info|incremental|mir-opt)",
130
131
)
132
+ . optopt (
133
+ "" ,
134
+ "filter-mode" ,
135
+ "only test files matching any of the comma separated list of modes" ,
136
+ "MODES"
137
+ )
131
138
. optflag ( "" , "ignored" , "run tests marked as ignored" )
132
139
. optflag ( "" , "exact" , "filters match exactly" )
133
140
. optopt (
@@ -320,6 +327,17 @@ pub fn parse_config(args: Vec<String>) -> Config {
320
327
run_ignored,
321
328
filter : matches. free . first ( ) . cloned ( ) ,
322
329
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
+ } ) ,
323
341
logfile : matches. opt_str ( "logfile" ) . map ( |s| PathBuf :: from ( & s) ) ,
324
342
runtool : matches. opt_str ( "runtool" ) ,
325
343
host_rustcflags : matches. opt_str ( "host-rustcflags" ) ,
@@ -382,6 +400,18 @@ pub fn log_config(config: &Config) {
382
400
) ,
383
401
) ;
384
402
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
+ ) ;
385
415
logv ( c, format ! ( "runtool: {}" , opt_str( & config. runtool) ) ) ;
386
416
logv (
387
417
c,
0 commit comments