@@ -729,7 +729,7 @@ impl<'test> TestCx<'test> {
729729 self . maybe_add_external_args ( & mut rustc, & self . config . target_rustcflags ) ;
730730 rustc. args ( & self . props . compile_flags ) ;
731731
732- self . compose_and_run_compiler ( rustc, Some ( src) , self . testpaths )
732+ self . compose_and_run_compiler ( rustc, Some ( src) )
733733 }
734734
735735 fn run_debuginfo_test ( & self ) {
@@ -1585,15 +1585,13 @@ impl<'test> TestCx<'test> {
15851585 passes,
15861586 ) ;
15871587
1588- self . compose_and_run_compiler ( rustc, None , self . testpaths )
1588+ self . compose_and_run_compiler ( rustc, None )
15891589 }
15901590
1591- /// `root_out_dir` and `root_testpaths` refer to the parameters of the actual test being run.
1592- /// Auxiliaries, no matter how deep, have the same root_out_dir and root_testpaths.
1593- fn document ( & self , root_out_dir : & Path , root_testpaths : & TestPaths ) -> ProcRes {
1591+ fn document ( & self , out_dir : & Path ) -> ProcRes {
15941592 if self . props . build_aux_docs {
15951593 for rel_ab in & self . props . aux_builds {
1596- let aux_testpaths = self . compute_aux_test_paths ( root_testpaths , rel_ab) ;
1594+ let aux_testpaths = self . compute_aux_test_paths ( & self . testpaths , rel_ab) ;
15971595 let aux_props =
15981596 self . props . from_aux_file ( & aux_testpaths. file , self . revision , self . config ) ;
15991597 let aux_cx = TestCx {
@@ -1604,7 +1602,7 @@ impl<'test> TestCx<'test> {
16041602 } ;
16051603 // Create the directory for the stdout/stderr files.
16061604 create_dir_all ( aux_cx. output_base_dir ( ) ) . unwrap ( ) ;
1607- let auxres = aux_cx. document ( & root_out_dir , root_testpaths ) ;
1605+ let auxres = aux_cx. document ( out_dir ) ;
16081606 if !auxres. status . success ( ) {
16091607 return auxres;
16101608 }
@@ -1614,47 +1612,21 @@ impl<'test> TestCx<'test> {
16141612 let aux_dir = self . aux_output_dir_name ( ) ;
16151613
16161614 let rustdoc_path = self . config . rustdoc_path . as_ref ( ) . expect ( "--rustdoc-path not passed" ) ;
1617-
1618- // actual --out-dir given to the auxiliary or test, as opposed to the root out dir for the entire
1619- // test
1620- let out_dir: Cow < ' _ , Path > = if self . props . unique_doc_out_dir {
1621- let file_name = self
1622- . testpaths
1623- . file
1624- . file_name ( )
1625- . expect ( "file name should not be empty" )
1626- . to_str ( )
1627- . expect ( "file name utf8" )
1628- . trim_end_matches ( ".rs" ) ;
1629- let out_dir = PathBuf :: from_iter ( [
1630- root_out_dir,
1631- Path :: new ( "docs" ) ,
1632- Path :: new ( file_name) ,
1633- Path :: new ( "doc" ) ,
1634- ] ) ;
1635- create_dir_all ( & out_dir) . unwrap ( ) ;
1636- Cow :: Owned ( out_dir)
1637- } else {
1638- Cow :: Borrowed ( root_out_dir)
1639- } ;
1640-
16411615 let mut rustdoc = Command :: new ( rustdoc_path) ;
1642- let current_dir = output_base_dir ( self . config , root_testpaths, self . safe_revision ( ) ) ;
1643- rustdoc. current_dir ( current_dir) ;
1616+
16441617 rustdoc
16451618 . arg ( "-L" )
16461619 . arg ( self . config . run_lib_path . to_str ( ) . unwrap ( ) )
16471620 . arg ( "-L" )
16481621 . arg ( aux_dir)
16491622 . arg ( "-o" )
1650- . arg ( out_dir. as_ref ( ) )
1623+ . arg ( out_dir)
16511624 . arg ( "--deny" )
16521625 . arg ( "warnings" )
16531626 . arg ( & self . testpaths . file )
16541627 . arg ( "-A" )
16551628 . arg ( "internal_features" )
1656- . args ( & self . props . compile_flags )
1657- . args ( & self . props . doc_flags ) ;
1629+ . args ( & self . props . compile_flags ) ;
16581630
16591631 if self . config . mode == RustdocJson {
16601632 rustdoc. arg ( "--output-format" ) . arg ( "json" ) . arg ( "-Zunstable-options" ) ;
@@ -1664,7 +1636,7 @@ impl<'test> TestCx<'test> {
16641636 rustdoc. arg ( format ! ( "-Clinker={}" , linker) ) ;
16651637 }
16661638
1667- self . compose_and_run_compiler ( rustdoc, None , root_testpaths )
1639+ self . compose_and_run_compiler ( rustdoc, None )
16681640 }
16691641
16701642 fn exec_compiled_test ( & self ) -> ProcRes {
@@ -1862,16 +1834,9 @@ impl<'test> TestCx<'test> {
18621834 }
18631835 }
18641836
1865- /// `root_testpaths` refers to the path of the original test.
1866- /// the auxiliary and the test with an aux-build have the same `root_testpaths`.
1867- fn compose_and_run_compiler (
1868- & self ,
1869- mut rustc : Command ,
1870- input : Option < String > ,
1871- root_testpaths : & TestPaths ,
1872- ) -> ProcRes {
1837+ fn compose_and_run_compiler ( & self , mut rustc : Command , input : Option < String > ) -> ProcRes {
18731838 let aux_dir = self . aux_output_dir ( ) ;
1874- self . build_all_auxiliary ( root_testpaths , & aux_dir, & mut rustc) ;
1839+ self . build_all_auxiliary ( & self . testpaths , & aux_dir, & mut rustc) ;
18751840
18761841 rustc. envs ( self . props . rustc_env . clone ( ) ) ;
18771842 self . props . unset_rustc_env . iter ( ) . fold ( & mut rustc, Command :: env_remove) ;
@@ -2586,7 +2551,7 @@ impl<'test> TestCx<'test> {
25862551 Vec :: new ( ) ,
25872552 ) ;
25882553
2589- let proc_res = self . compose_and_run_compiler ( rustc, None , self . testpaths ) ;
2554+ let proc_res = self . compose_and_run_compiler ( rustc, None ) ;
25902555 let output_path = self . get_filecheck_file ( "ll" ) ;
25912556 ( proc_res, output_path)
25922557 }
@@ -2622,7 +2587,7 @@ impl<'test> TestCx<'test> {
26222587 Vec :: new ( ) ,
26232588 ) ;
26242589
2625- let proc_res = self . compose_and_run_compiler ( rustc, None , self . testpaths ) ;
2590+ let proc_res = self . compose_and_run_compiler ( rustc, None ) ;
26262591 let output_path = self . get_filecheck_file ( "s" ) ;
26272592 ( proc_res, output_path)
26282593 }
@@ -2705,7 +2670,7 @@ impl<'test> TestCx<'test> {
27052670 let out_dir = self . output_base_dir ( ) ;
27062671 remove_and_create_dir_all ( & out_dir) ;
27072672
2708- let proc_res = self . document ( & out_dir, & self . testpaths ) ;
2673+ let proc_res = self . document ( & out_dir) ;
27092674 if !proc_res. status . success ( ) {
27102675 self . fatal_proc_rec ( "rustdoc failed!" , & proc_res) ;
27112676 }
@@ -2764,7 +2729,7 @@ impl<'test> TestCx<'test> {
27642729 let aux_dir = new_rustdoc. aux_output_dir ( ) ;
27652730 new_rustdoc. build_all_auxiliary ( & new_rustdoc. testpaths , & aux_dir, & mut rustc) ;
27662731
2767- let proc_res = new_rustdoc. document ( & compare_dir, & new_rustdoc . testpaths ) ;
2732+ let proc_res = new_rustdoc. document ( & compare_dir) ;
27682733 if !proc_res. status . success ( ) {
27692734 eprintln ! ( "failed to run nightly rustdoc" ) ;
27702735 return ;
@@ -2888,7 +2853,7 @@ impl<'test> TestCx<'test> {
28882853 let out_dir = self . output_base_dir ( ) ;
28892854 remove_and_create_dir_all ( & out_dir) ;
28902855
2891- let proc_res = self . document ( & out_dir, & self . testpaths ) ;
2856+ let proc_res = self . document ( & out_dir) ;
28922857 if !proc_res. status . success ( ) {
28932858 self . fatal_proc_rec ( "rustdoc failed!" , & proc_res) ;
28942859 }
@@ -2964,15 +2929,24 @@ impl<'test> TestCx<'test> {
29642929 fn check_rustdoc_test_option ( & self , res : ProcRes ) {
29652930 let mut other_files = Vec :: new ( ) ;
29662931 let mut files: HashMap < String , Vec < usize > > = HashMap :: new ( ) ;
2967- let normalized = fs:: canonicalize ( & self . testpaths . file ) . expect ( "failed to canonicalize" ) ;
2968- let normalized = normalized. to_str ( ) . unwrap ( ) . replace ( '\\' , "/" ) ;
2969- files. insert ( normalized, self . get_lines ( & self . testpaths . file , Some ( & mut other_files) ) ) ;
2932+ let cwd = env:: current_dir ( ) . unwrap ( ) ;
2933+ files. insert (
2934+ self . testpaths
2935+ . file
2936+ . strip_prefix ( & cwd)
2937+ . unwrap_or ( & self . testpaths . file )
2938+ . to_str ( )
2939+ . unwrap ( )
2940+ . replace ( '\\' , "/" ) ,
2941+ self . get_lines ( & self . testpaths . file , Some ( & mut other_files) ) ,
2942+ ) ;
29702943 for other_file in other_files {
29712944 let mut path = self . testpaths . file . clone ( ) ;
29722945 path. set_file_name ( & format ! ( "{}.rs" , other_file) ) ;
2973- let path = fs:: canonicalize ( path) . expect ( "failed to canonicalize" ) ;
2974- let normalized = path. to_str ( ) . unwrap ( ) . replace ( '\\' , "/" ) ;
2975- files. insert ( normalized, self . get_lines ( & path, None ) ) ;
2946+ files. insert (
2947+ path. strip_prefix ( & cwd) . unwrap_or ( & path) . to_str ( ) . unwrap ( ) . replace ( '\\' , "/" ) ,
2948+ self . get_lines ( & path, None ) ,
2949+ ) ;
29762950 }
29772951
29782952 let mut tested = 0 ;
@@ -3811,7 +3785,7 @@ impl<'test> TestCx<'test> {
38113785 if let Some ( nodejs) = & self . config . nodejs {
38123786 let out_dir = self . output_base_dir ( ) ;
38133787
3814- self . document ( & out_dir, & self . testpaths ) ;
3788+ self . document ( & out_dir) ;
38153789
38163790 let root = self . config . find_rust_src_root ( ) . unwrap ( ) ;
38173791 let file_stem =
@@ -4127,7 +4101,7 @@ impl<'test> TestCx<'test> {
41274101 rustc. arg ( crate_name) ;
41284102 }
41294103
4130- let res = self . compose_and_run_compiler ( rustc, None , self . testpaths ) ;
4104+ let res = self . compose_and_run_compiler ( rustc, None ) ;
41314105 if !res. status . success ( ) {
41324106 self . fatal_proc_rec ( "failed to compile fixed code" , & res) ;
41334107 }
0 commit comments