@@ -763,7 +763,7 @@ impl Step for RustdocJSStd {
763763 const ONLY_HOSTS : bool = true ;
764764
765765 fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
766- run. path ( "src/test/rustdoc-js-std" )
766+ run. suite_path ( "src/test/rustdoc-js-std" )
767767 }
768768
769769 fn make_run ( run : RunConfig < ' _ > ) {
@@ -783,6 +783,17 @@ impl Step for RustdocJSStd {
783783 . arg ( builder. doc_out ( self . target ) )
784784 . arg ( "--test-folder" )
785785 . arg ( builder. src . join ( "src/test/rustdoc-js-std" ) ) ;
786+ for path in & builder. paths {
787+ if let Some ( p) =
788+ util:: is_valid_test_suite_arg ( path, "src/test/rustdoc-js-std" , builder)
789+ {
790+ if !p. ends_with ( ".js" ) {
791+ eprintln ! ( "A non-js file was given: `{}`" , path. display( ) ) ;
792+ panic ! ( "Cannot run rustdoc-js-std tests" ) ;
793+ }
794+ command. arg ( "--test-file" ) . arg ( path) ;
795+ }
796+ }
786797 builder. ensure ( crate :: doc:: Std { target : self . target , stage : builder. top_stage } ) ;
787798 builder. run ( & mut command) ;
788799 } else {
@@ -803,7 +814,7 @@ impl Step for RustdocJSNotStd {
803814 const ONLY_HOSTS : bool = true ;
804815
805816 fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
806- run. path ( "src/test/rustdoc-js" )
817+ run. suite_path ( "src/test/rustdoc-js" )
807818 }
808819
809820 fn make_run ( run : RunConfig < ' _ > ) {
@@ -938,8 +949,12 @@ impl Step for RustdocGUI {
938949 . arg ( "--tests-folder" )
939950 . arg ( builder. build . src . join ( "src/test/rustdoc-gui" ) ) ;
940951 for path in & builder. paths {
941- if let Some ( name) = path. file_name ( ) . and_then ( |f| f. to_str ( ) ) {
942- if name. ends_with ( ".goml" ) {
952+ if let Some ( p) = util:: is_valid_test_suite_arg ( path, "src/test/rustdoc-gui" , builder) {
953+ if !p. ends_with ( ".goml" ) {
954+ eprintln ! ( "A non-goml file was given: `{}`" , path. display( ) ) ;
955+ panic ! ( "Cannot run rustdoc-gui tests" ) ;
956+ }
957+ if let Some ( name) = path. file_name ( ) . and_then ( |f| f. to_str ( ) ) {
943958 command. arg ( "--file" ) . arg ( name) ;
944959 }
945960 }
@@ -1416,35 +1431,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the
14161431 // Get test-args by striping suite path
14171432 let mut test_args: Vec < & str > = paths
14181433 . iter ( )
1419- . map ( |p| match p. strip_prefix ( "." ) {
1420- Ok ( path) => path,
1421- Err ( _) => p,
1422- } )
1423- . filter ( |p| p. starts_with ( suite_path) )
1424- . filter ( |p| {
1425- let exists = p. is_dir ( ) || p. is_file ( ) ;
1426- if !exists {
1427- if let Some ( p) = p. to_str ( ) {
1428- builder. info ( & format ! (
1429- "Warning: Skipping \" {}\" : not a regular file or directory" ,
1430- p
1431- ) ) ;
1432- }
1433- }
1434- exists
1435- } )
1436- . filter_map ( |p| {
1437- // Since test suite paths are themselves directories, if we don't
1438- // specify a directory or file, we'll get an empty string here
1439- // (the result of the test suite directory without its suite prefix).
1440- // Therefore, we need to filter these out, as only the first --test-args
1441- // flag is respected, so providing an empty --test-args conflicts with
1442- // any following it.
1443- match p. strip_prefix ( suite_path) . ok ( ) . and_then ( |p| p. to_str ( ) ) {
1444- Some ( s) if !s. is_empty ( ) => Some ( s) ,
1445- _ => None ,
1446- }
1447- } )
1434+ . filter_map ( |p| util:: is_valid_test_suite_arg ( p, suite_path, builder) )
14481435 . collect ( ) ;
14491436
14501437 test_args. append ( & mut builder. config . cmd . test_args ( ) ) ;
0 commit comments