@@ -37,8 +37,9 @@ use crate::core::{android, debuggers};
3737use crate :: utils:: build_stamp:: { self , BuildStamp } ;
3838use crate :: utils:: exec:: { BootstrapCommand , command} ;
3939use crate :: utils:: helpers:: {
40- self , LldThreads , add_dylib_path, add_rustdoc_cargo_linker_args, dylib_path, dylib_path_var,
41- linker_args, linker_flags, t, target_supports_cranelift_backend, up_to_date,
40+ self , LldThreads , TestFilterCategory , add_dylib_path, add_rustdoc_cargo_linker_args,
41+ dylib_path, dylib_path_var, linker_args, linker_flags, t, target_supports_cranelift_backend,
42+ up_to_date,
4243} ;
4344use crate :: utils:: render_tests:: { add_flags_and_try_run_tests, try_run_tests} ;
4445use crate :: { CLang , CodegenBackendKind , GitRepo , Mode , PathSet , TestTarget , envify} ;
@@ -969,13 +970,15 @@ impl Step for Clippy {
969970 let paths = & builder. config . paths [ ..] ;
970971 let mut test_names = Vec :: new ( ) ;
971972 for path in paths {
972- if let Some ( path) =
973- helpers:: is_valid_test_suite_arg ( path, "src/tools/clippy/tests" , builder)
974- {
975- test_names. push ( path) ;
976- } else if path. ends_with ( "src/tools/clippy" ) {
977- // When src/tools/clippy is called directly, all tests should be run.
978- break ' partially_test;
973+ match helpers:: is_valid_test_suite_arg ( path, "src/tools/clippy/tests" , builder) {
974+ TestFilterCategory :: Arg ( path) => {
975+ test_names. push ( path) ;
976+ }
977+ TestFilterCategory :: Fullsuite => {
978+ // When src/tools/clippy is called directly, all tests should be run.
979+ break ' partially_test;
980+ }
981+ TestFilterCategory :: Uninteresting => { }
979982 }
980983 }
981984 cargo. env ( "TESTNAME" , test_names. join ( "," ) ) ;
@@ -1104,16 +1107,30 @@ impl Step for RustdocJSStd {
11041107 . arg ( builder. doc_out ( self . target ) )
11051108 . arg ( "--test-folder" )
11061109 . arg ( builder. src . join ( "tests/rustdoc-js-std" ) ) ;
1107- for path in & builder. paths {
1108- if let Some ( p) = helpers:: is_valid_test_suite_arg ( path, "tests/rustdoc-js-std" , builder)
1109- {
1110- if !p. ends_with ( ".js" ) {
1111- eprintln ! ( "A non-js file was given: `{}`" , path. display( ) ) ;
1112- panic ! ( "Cannot run rustdoc-js-std tests" ) ;
1110+
1111+ let full_suite = builder. paths . iter ( ) . any ( |path| {
1112+ matches ! (
1113+ helpers:: is_valid_test_suite_arg( path, "tests/rustdoc-js-std" , builder) ,
1114+ TestFilterCategory :: Fullsuite
1115+ )
1116+ } ) ;
1117+
1118+ // If we have to also run the full suite, don't worry about the individual arguments.
1119+ // They will be covered by running the entire suite
1120+ if !full_suite {
1121+ for path in & builder. paths {
1122+ if let TestFilterCategory :: Arg ( p) =
1123+ helpers:: is_valid_test_suite_arg ( path, "tests/rustdoc-js-std" , builder)
1124+ {
1125+ if !p. ends_with ( ".js" ) {
1126+ eprintln ! ( "A non-js file was given: `{}`" , path. display( ) ) ;
1127+ panic ! ( "Cannot run rustdoc-js-std tests" ) ;
1128+ }
1129+ command. arg ( "--test-file" ) . arg ( path) ;
11131130 }
1114- command. arg ( "--test-file" ) . arg ( path) ;
11151131 }
11161132 }
1133+
11171134 builder. ensure ( crate :: core:: build_steps:: doc:: Std :: from_build_compiler (
11181135 self . build_compiler ,
11191136 self . target ,
@@ -1252,14 +1269,27 @@ impl Step for RustdocGUI {
12521269
12531270 add_rustdoc_cargo_linker_args ( & mut cmd, builder, self . test_compiler . host , LldThreads :: No ) ;
12541271
1255- for path in & builder. paths {
1256- if let Some ( p) = helpers:: is_valid_test_suite_arg ( path, "tests/rustdoc-gui" , builder) {
1257- if !p. ends_with ( ".goml" ) {
1258- eprintln ! ( "A non-goml file was given: `{}`" , path. display( ) ) ;
1259- panic ! ( "Cannot run rustdoc-gui tests" ) ;
1260- }
1261- if let Some ( name) = path. file_name ( ) . and_then ( |f| f. to_str ( ) ) {
1262- cmd. arg ( "--goml-file" ) . arg ( name) ;
1272+ let full_suite = builder. paths . iter ( ) . any ( |path| {
1273+ matches ! (
1274+ helpers:: is_valid_test_suite_arg( path, "tests/rustdoc-js-std" , builder) ,
1275+ TestFilterCategory :: Fullsuite
1276+ )
1277+ } ) ;
1278+
1279+ // If we have to also run the full suite, don't worry about the individual arguments.
1280+ // They will be covered by running the entire suite
1281+ if !full_suite {
1282+ for path in & builder. paths {
1283+ if let TestFilterCategory :: Arg ( p) =
1284+ helpers:: is_valid_test_suite_arg ( path, "tests/rustdoc-gui" , builder)
1285+ {
1286+ if !p. ends_with ( ".goml" ) {
1287+ eprintln ! ( "A non-goml file was given: `{}`" , path. display( ) ) ;
1288+ panic ! ( "Cannot run rustdoc-gui tests" ) ;
1289+ }
1290+ if let Some ( name) = path. file_name ( ) . and_then ( |f| f. to_str ( ) ) {
1291+ cmd. arg ( "--goml-file" ) . arg ( name) ;
1292+ }
12631293 }
12641294 }
12651295 }
@@ -2270,11 +2300,23 @@ Please disable assertions with `rust.debug-assertions = false`.
22702300 }
22712301 paths = & paths_v;
22722302 }
2303+
22732304 // Get test-args by striping suite path
2274- let mut test_args: Vec < & str > = paths
2275- . iter ( )
2276- . filter_map ( |p| helpers:: is_valid_test_suite_arg ( p, suite_path, builder) )
2277- . collect ( ) ;
2305+ let mut test_args = Vec :: new ( ) ;
2306+ for p in paths {
2307+ match helpers:: is_valid_test_suite_arg ( p, suite_path, builder) {
2308+ TestFilterCategory :: Fullsuite => {
2309+ // If we also have to run the full suite, don't append _any_ test args here,
2310+ // clear the list instead and break out.
2311+ // That way none of the more specific paths make it into test_args,
2312+ // since running the whole suite will run the specific ones anyway.
2313+ test_args. clear ( ) ;
2314+ break ;
2315+ }
2316+ TestFilterCategory :: Arg ( a) => test_args. push ( a) ,
2317+ TestFilterCategory :: Uninteresting => { }
2318+ }
2319+ }
22782320
22792321 test_args. append ( & mut builder. config . test_args ( ) ) ;
22802322
0 commit comments