@@ -729,7 +729,7 @@ impl<'test> TestCx<'test> {
729
729
self . maybe_add_external_args ( & mut rustc, & self . config . target_rustcflags ) ;
730
730
rustc. args ( & self . props . compile_flags ) ;
731
731
732
- self . compose_and_run_compiler ( rustc, Some ( src) , self . testpaths )
732
+ self . compose_and_run_compiler ( rustc, Some ( src) )
733
733
}
734
734
735
735
fn run_debuginfo_test ( & self ) {
@@ -1585,15 +1585,13 @@ impl<'test> TestCx<'test> {
1585
1585
passes,
1586
1586
) ;
1587
1587
1588
- self . compose_and_run_compiler ( rustc, None , self . testpaths )
1588
+ self . compose_and_run_compiler ( rustc, None )
1589
1589
}
1590
1590
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 {
1594
1592
if self . props . build_aux_docs {
1595
1593
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) ;
1597
1595
let aux_props =
1598
1596
self . props . from_aux_file ( & aux_testpaths. file , self . revision , self . config ) ;
1599
1597
let aux_cx = TestCx {
@@ -1604,7 +1602,7 @@ impl<'test> TestCx<'test> {
1604
1602
} ;
1605
1603
// Create the directory for the stdout/stderr files.
1606
1604
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 ) ;
1608
1606
if !auxres. status . success ( ) {
1609
1607
return auxres;
1610
1608
}
@@ -1614,47 +1612,21 @@ impl<'test> TestCx<'test> {
1614
1612
let aux_dir = self . aux_output_dir_name ( ) ;
1615
1613
1616
1614
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
-
1641
1615
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
+
1644
1617
rustdoc
1645
1618
. arg ( "-L" )
1646
1619
. arg ( self . config . run_lib_path . to_str ( ) . unwrap ( ) )
1647
1620
. arg ( "-L" )
1648
1621
. arg ( aux_dir)
1649
1622
. arg ( "-o" )
1650
- . arg ( out_dir. as_ref ( ) )
1623
+ . arg ( out_dir)
1651
1624
. arg ( "--deny" )
1652
1625
. arg ( "warnings" )
1653
1626
. arg ( & self . testpaths . file )
1654
1627
. arg ( "-A" )
1655
1628
. arg ( "internal_features" )
1656
- . args ( & self . props . compile_flags )
1657
- . args ( & self . props . doc_flags ) ;
1629
+ . args ( & self . props . compile_flags ) ;
1658
1630
1659
1631
if self . config . mode == RustdocJson {
1660
1632
rustdoc. arg ( "--output-format" ) . arg ( "json" ) . arg ( "-Zunstable-options" ) ;
@@ -1664,7 +1636,7 @@ impl<'test> TestCx<'test> {
1664
1636
rustdoc. arg ( format ! ( "-Clinker={}" , linker) ) ;
1665
1637
}
1666
1638
1667
- self . compose_and_run_compiler ( rustdoc, None , root_testpaths )
1639
+ self . compose_and_run_compiler ( rustdoc, None )
1668
1640
}
1669
1641
1670
1642
fn exec_compiled_test ( & self ) -> ProcRes {
@@ -1862,16 +1834,9 @@ impl<'test> TestCx<'test> {
1862
1834
}
1863
1835
}
1864
1836
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 {
1873
1838
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) ;
1875
1840
1876
1841
rustc. envs ( self . props . rustc_env . clone ( ) ) ;
1877
1842
self . props . unset_rustc_env . iter ( ) . fold ( & mut rustc, Command :: env_remove) ;
@@ -2586,7 +2551,7 @@ impl<'test> TestCx<'test> {
2586
2551
Vec :: new ( ) ,
2587
2552
) ;
2588
2553
2589
- let proc_res = self . compose_and_run_compiler ( rustc, None , self . testpaths ) ;
2554
+ let proc_res = self . compose_and_run_compiler ( rustc, None ) ;
2590
2555
let output_path = self . get_filecheck_file ( "ll" ) ;
2591
2556
( proc_res, output_path)
2592
2557
}
@@ -2622,7 +2587,7 @@ impl<'test> TestCx<'test> {
2622
2587
Vec :: new ( ) ,
2623
2588
) ;
2624
2589
2625
- let proc_res = self . compose_and_run_compiler ( rustc, None , self . testpaths ) ;
2590
+ let proc_res = self . compose_and_run_compiler ( rustc, None ) ;
2626
2591
let output_path = self . get_filecheck_file ( "s" ) ;
2627
2592
( proc_res, output_path)
2628
2593
}
@@ -2705,7 +2670,7 @@ impl<'test> TestCx<'test> {
2705
2670
let out_dir = self . output_base_dir ( ) ;
2706
2671
remove_and_create_dir_all ( & out_dir) ;
2707
2672
2708
- let proc_res = self . document ( & out_dir, & self . testpaths ) ;
2673
+ let proc_res = self . document ( & out_dir) ;
2709
2674
if !proc_res. status . success ( ) {
2710
2675
self . fatal_proc_rec ( "rustdoc failed!" , & proc_res) ;
2711
2676
}
@@ -2764,7 +2729,7 @@ impl<'test> TestCx<'test> {
2764
2729
let aux_dir = new_rustdoc. aux_output_dir ( ) ;
2765
2730
new_rustdoc. build_all_auxiliary ( & new_rustdoc. testpaths , & aux_dir, & mut rustc) ;
2766
2731
2767
- let proc_res = new_rustdoc. document ( & compare_dir, & new_rustdoc . testpaths ) ;
2732
+ let proc_res = new_rustdoc. document ( & compare_dir) ;
2768
2733
if !proc_res. status . success ( ) {
2769
2734
eprintln ! ( "failed to run nightly rustdoc" ) ;
2770
2735
return ;
@@ -2888,7 +2853,7 @@ impl<'test> TestCx<'test> {
2888
2853
let out_dir = self . output_base_dir ( ) ;
2889
2854
remove_and_create_dir_all ( & out_dir) ;
2890
2855
2891
- let proc_res = self . document ( & out_dir, & self . testpaths ) ;
2856
+ let proc_res = self . document ( & out_dir) ;
2892
2857
if !proc_res. status . success ( ) {
2893
2858
self . fatal_proc_rec ( "rustdoc failed!" , & proc_res) ;
2894
2859
}
@@ -2964,15 +2929,24 @@ impl<'test> TestCx<'test> {
2964
2929
fn check_rustdoc_test_option ( & self , res : ProcRes ) {
2965
2930
let mut other_files = Vec :: new ( ) ;
2966
2931
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
+ ) ;
2970
2943
for other_file in other_files {
2971
2944
let mut path = self . testpaths . file . clone ( ) ;
2972
2945
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
+ ) ;
2976
2950
}
2977
2951
2978
2952
let mut tested = 0 ;
@@ -3811,7 +3785,7 @@ impl<'test> TestCx<'test> {
3811
3785
if let Some ( nodejs) = & self . config . nodejs {
3812
3786
let out_dir = self . output_base_dir ( ) ;
3813
3787
3814
- self . document ( & out_dir, & self . testpaths ) ;
3788
+ self . document ( & out_dir) ;
3815
3789
3816
3790
let root = self . config . find_rust_src_root ( ) . unwrap ( ) ;
3817
3791
let file_stem =
@@ -4127,7 +4101,7 @@ impl<'test> TestCx<'test> {
4127
4101
rustc. arg ( crate_name) ;
4128
4102
}
4129
4103
4130
- let res = self . compose_and_run_compiler ( rustc, None , self . testpaths ) ;
4104
+ let res = self . compose_and_run_compiler ( rustc, None ) ;
4131
4105
if !res. status . success ( ) {
4132
4106
self . fatal_proc_rec ( "failed to compile fixed code" , & res) ;
4133
4107
}
0 commit comments