@@ -18,7 +18,6 @@ use crate::common::{
1818 CompareMode , Config , Debugger , FailMode , PassMode , RunFailMode , RunResult , TestMode , TestPaths ,
1919 TestSuite , UI_EXTENSIONS , UI_FIXED , UI_RUN_STDERR , UI_RUN_STDOUT , UI_STDERR , UI_STDOUT , UI_SVG ,
2020 UI_WINDOWS_SVG , expected_output_path, incremental_dir, output_base_dir, output_base_name,
21- output_testname_unique,
2221} ;
2322use crate :: directives:: TestProps ;
2423use crate :: errors:: { Error , ErrorKind , load_errors} ;
@@ -1004,27 +1003,39 @@ impl<'test> TestCx<'test> {
10041003 root_out_dir : & Utf8Path ,
10051004 root_testpaths : & TestPaths ,
10061005 kind : DocKind ,
1006+ ) -> ProcRes {
1007+ self . document_inner ( & self . testpaths . file , root_out_dir, root_testpaths, kind)
1008+ }
1009+
1010+ /// Like `document`, but takes an explicit `file_to_doc` argument so that
1011+ /// it can also be used for documenting auxiliaries, in addition to
1012+ /// documenting the main test file.
1013+ fn document_inner (
1014+ & self ,
1015+ file_to_doc : & Utf8Path ,
1016+ root_out_dir : & Utf8Path ,
1017+ root_testpaths : & TestPaths ,
1018+ kind : DocKind ,
10071019 ) -> ProcRes {
10081020 if self . props . build_aux_docs {
10091021 assert_eq ! ( kind, DocKind :: Html , "build-aux-docs only make sense for html output" ) ;
10101022
10111023 for rel_ab in & self . props . aux . builds {
1012- let aux_testpaths = self . compute_aux_test_paths ( root_testpaths, rel_ab) ;
1013- let props_for_aux =
1014- self . props . from_aux_file ( & aux_testpaths. file , self . revision , self . config ) ;
1024+ let aux_path = self . compute_aux_test_paths ( root_testpaths, rel_ab) ;
1025+ let props_for_aux = self . props . from_aux_file ( & aux_path, self . revision , self . config ) ;
10151026 let aux_cx = TestCx {
10161027 config : self . config ,
10171028 stdout : self . stdout ,
10181029 stderr : self . stderr ,
10191030 props : & props_for_aux,
1020- testpaths : & aux_testpaths ,
1031+ testpaths : self . testpaths ,
10211032 revision : self . revision ,
10221033 } ;
10231034 // Create the directory for the stdout/stderr files.
10241035 create_dir_all ( aux_cx. output_base_dir ( ) ) . unwrap ( ) ;
10251036 // use root_testpaths here, because aux-builds should have the
10261037 // same --out-dir and auxiliary directory.
1027- let auxres = aux_cx. document ( & root_out_dir, root_testpaths, kind) ;
1038+ let auxres = aux_cx. document_inner ( & aux_path , & root_out_dir, root_testpaths, kind) ;
10281039 if !auxres. status . success ( ) {
10291040 return auxres;
10301041 }
@@ -1038,7 +1049,7 @@ impl<'test> TestCx<'test> {
10381049 // actual --out-dir given to the auxiliary or test, as opposed to the root out dir for the entire
10391050 // test
10401051 let out_dir: Cow < ' _ , Utf8Path > = if self . props . unique_doc_out_dir {
1041- let file_name = self . testpaths . file . file_stem ( ) . expect ( "file name should not be empty" ) ;
1052+ let file_name = file_to_doc . file_stem ( ) . expect ( "file name should not be empty" ) ;
10421053 let out_dir = Utf8PathBuf :: from_iter ( [
10431054 root_out_dir,
10441055 Utf8Path :: new ( "docs" ) ,
@@ -1063,7 +1074,7 @@ impl<'test> TestCx<'test> {
10631074 . arg ( out_dir. as_ref ( ) )
10641075 . arg ( "--deny" )
10651076 . arg ( "warnings" )
1066- . arg ( & self . testpaths . file )
1077+ . arg ( file_to_doc )
10671078 . arg ( "-A" )
10681079 . arg ( "internal_features" )
10691080 . args ( & self . props . compile_flags )
@@ -1195,24 +1206,14 @@ impl<'test> TestCx<'test> {
11951206
11961207 /// For each `aux-build: foo/bar` annotation, we check to find the file in an `auxiliary`
11971208 /// directory relative to the test itself (not any intermediate auxiliaries).
1198- fn compute_aux_test_paths ( & self , of : & TestPaths , rel_ab : & str ) -> TestPaths {
1209+ fn compute_aux_test_paths ( & self , of : & TestPaths , rel_ab : & str ) -> Utf8PathBuf {
11991210 let test_ab =
12001211 of. file . parent ( ) . expect ( "test file path has no parent" ) . join ( "auxiliary" ) . join ( rel_ab) ;
12011212 if !test_ab. exists ( ) {
12021213 self . fatal ( & format ! ( "aux-build `{}` source not found" , test_ab) )
12031214 }
12041215
1205- TestPaths {
1206- file : test_ab,
1207- relative_dir : of
1208- . relative_dir
1209- . join ( self . output_testname_unique ( ) )
1210- . join ( "auxiliary" )
1211- . join ( rel_ab)
1212- . parent ( )
1213- . expect ( "aux-build path has no parent" )
1214- . to_path_buf ( ) ,
1215- }
1216+ test_ab
12161217 }
12171218
12181219 fn is_vxworks_pure_static ( & self ) -> bool {
@@ -1369,9 +1370,8 @@ impl<'test> TestCx<'test> {
13691370 aux_dir : & Utf8Path ,
13701371 aux_type : Option < AuxType > ,
13711372 ) -> AuxType {
1372- let aux_testpaths = self . compute_aux_test_paths ( of, source_path) ;
1373- let mut aux_props =
1374- self . props . from_aux_file ( & aux_testpaths. file , self . revision , self . config ) ;
1373+ let aux_path = self . compute_aux_test_paths ( of, source_path) ;
1374+ let mut aux_props = self . props . from_aux_file ( & aux_path, self . revision , self . config ) ;
13751375 if aux_type == Some ( AuxType :: ProcMacro ) {
13761376 aux_props. force_host = true ;
13771377 }
@@ -1388,14 +1388,13 @@ impl<'test> TestCx<'test> {
13881388 stdout : self . stdout ,
13891389 stderr : self . stderr ,
13901390 props : & aux_props,
1391- testpaths : & aux_testpaths ,
1391+ testpaths : self . testpaths ,
13921392 revision : self . revision ,
13931393 } ;
13941394 // Create the directory for the stdout/stderr files.
13951395 create_dir_all ( aux_cx. output_base_dir ( ) ) . unwrap ( ) ;
1396- let input_file = & aux_testpaths. file ;
13971396 let mut aux_rustc = aux_cx. make_compile_args (
1398- input_file ,
1397+ & aux_path ,
13991398 aux_output,
14001399 Emit :: None ,
14011400 AllowUnused :: No ,
@@ -1471,7 +1470,7 @@ impl<'test> TestCx<'test> {
14711470 ) ;
14721471 if !auxres. status . success ( ) {
14731472 self . fatal_proc_rec (
1474- & format ! ( "auxiliary build of {} failed to compile: " , aux_testpaths . file ) ,
1473+ & format ! ( "auxiliary build of {aux_path } failed to compile: " ) ,
14751474 & auxres,
14761475 ) ;
14771476 }
@@ -2033,11 +2032,6 @@ impl<'test> TestCx<'test> {
20332032 self . aux_output_dir_name ( ) . join ( "bin" )
20342033 }
20352034
2036- /// Generates a unique name for the test, such as `testname.revision.mode`.
2037- fn output_testname_unique ( & self ) -> Utf8PathBuf {
2038- output_testname_unique ( self . config , self . testpaths , self . safe_revision ( ) )
2039- }
2040-
20412035 /// The revision, ignored for incremental compilation since it wants all revisions in
20422036 /// the same directory.
20432037 fn safe_revision ( & self ) -> Option < & str > {
0 commit comments