@@ -303,6 +303,7 @@ pub struct TestOpts {
303
303
pub color : ColorConfig ,
304
304
pub quiet : bool ,
305
305
pub test_threads : Option < usize > ,
306
+ pub skip : Vec < String > ,
306
307
}
307
308
308
309
impl TestOpts {
@@ -318,6 +319,7 @@ impl TestOpts {
318
319
color : AutoColor ,
319
320
quiet : false ,
320
321
test_threads : None ,
322
+ skip : vec ! [ ] ,
321
323
}
322
324
}
323
325
}
@@ -337,6 +339,8 @@ fn optgroups() -> Vec<getopts::OptGroup> {
337
339
task, allow printing directly") ,
338
340
getopts:: optopt( "" , "test-threads" , "Number of threads used for running tests \
339
341
in parallel", "n_threads" ) ,
342
+ getopts:: optmulti( "" , "skip" , "Skip tests whose names contain FILTER (this flag can \
343
+ be used multiple times)", "FILTER" ) ,
340
344
getopts:: optflag( "q" , "quiet" , "Display one character per test instead of one line" ) ,
341
345
getopts:: optopt( "" , "color" , "Configure coloring of output:
342
346
auto = colorize if stdout is a tty and tests are run on serially (default);
@@ -446,6 +450,7 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
446
450
color : color,
447
451
quiet : quiet,
448
452
test_threads : test_threads,
453
+ skip : matches. opt_strs ( "skip" ) ,
449
454
} ;
450
455
451
456
Some ( Ok ( test_opts) )
@@ -1095,6 +1100,11 @@ pub fn filter_tests(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> Vec<TestDescA
1095
1100
}
1096
1101
} ;
1097
1102
1103
+ // Skip tests that match any of the skip filters
1104
+ filtered = filtered. into_iter ( )
1105
+ . filter ( |t| !opts. skip . iter ( ) . any ( |sf| t. desc . name . as_slice ( ) . contains ( & sf[ ..] ) ) )
1106
+ . collect ( ) ;
1107
+
1098
1108
// Maybe pull out the ignored test and unignore them
1099
1109
filtered = if !opts. run_ignored {
1100
1110
filtered
0 commit comments