@@ -468,28 +468,52 @@ pub fn get_compile_benchmarks(
468
468
let mut excludes = to_hashmap ( exclude) ;
469
469
let mut exclude_suffixes = to_hashmap ( exclude_suffix) ;
470
470
471
+ let mut include_primaries = false ;
472
+ let mut include_secondaries = false ;
473
+ let mut include_stables = false ;
474
+ if let Some ( includes) = includes. as_mut ( ) {
475
+ include_primaries = includes. remove ( & "primary" ) . is_some ( ) ;
476
+ include_secondaries = includes. remove ( & "secondary" ) . is_some ( ) ;
477
+ include_stables = includes. remove ( & "stable" ) . is_some ( ) ;
478
+ }
479
+ let mut exclude_primaries = false ;
480
+ let mut exclude_secondaries = false ;
481
+ let mut exclude_stables = false ;
482
+ if let Some ( excludes) = excludes. as_mut ( ) {
483
+ exclude_primaries = excludes. remove ( & "primary" ) . is_some ( ) ;
484
+ exclude_secondaries = excludes. remove ( & "secondary" ) . is_some ( ) ;
485
+ exclude_stables = excludes. remove ( & "stable" ) . is_some ( ) ;
486
+ }
487
+
471
488
for ( path, name) in paths {
472
489
let mut skip = false ;
490
+ let b = Benchmark :: new ( name, path) ?;
473
491
474
492
let name_matches_prefix = |prefixes : & mut HashMap < & str , usize > | {
475
- substring_matches ( prefixes, |prefix| name. starts_with ( prefix) )
493
+ substring_matches ( prefixes, |prefix| b . name . 0 . starts_with ( prefix) )
476
494
} ;
477
495
478
496
if let Some ( includes) = includes. as_mut ( ) {
479
- skip |= !name_matches_prefix ( includes) ;
497
+ skip |= !( name_matches_prefix ( includes)
498
+ || ( include_primaries && b. category ( ) == Category :: Primary )
499
+ || ( include_secondaries && b. category ( ) == Category :: Secondary )
500
+ || ( include_stables && b. category ( ) == Category :: Stable ) ) ;
480
501
}
481
502
if let Some ( excludes) = excludes. as_mut ( ) {
482
- skip |= name_matches_prefix ( excludes) ;
503
+ skip |= name_matches_prefix ( excludes)
504
+ || ( exclude_primaries && b. category ( ) == Category :: Primary )
505
+ || ( exclude_secondaries && b. category ( ) == Category :: Secondary )
506
+ || ( exclude_stables && b. category ( ) == Category :: Stable ) ;
483
507
}
484
508
if let Some ( exclude_suffixes) = exclude_suffixes. as_mut ( ) {
485
- skip |= substring_matches ( exclude_suffixes, |suffix| name. ends_with ( suffix) ) ;
509
+ skip |= substring_matches ( exclude_suffixes, |suffix| b . name . 0 . ends_with ( suffix) ) ;
486
510
}
487
511
if skip {
488
512
continue ;
489
513
}
490
514
491
- debug ! ( "benchmark `{}`- registered" , name) ;
492
- benchmarks. push ( Benchmark :: new ( name , path ) ? ) ;
515
+ debug ! ( "benchmark `{}`- registered" , b . name) ;
516
+ benchmarks. push ( b ) ;
493
517
}
494
518
495
519
// All prefixes/suffixes must be used at least once. This is to catch typos.
0 commit comments