@@ -1936,7 +1936,7 @@ impl<'test> TestCx<'test> {
1936
1936
fn document ( & self , out_dir : & Path ) -> ProcRes {
1937
1937
if self . props . build_aux_docs {
1938
1938
for rel_ab in & self . props . aux_builds {
1939
- let aux_testpaths = self . compute_aux_test_paths ( rel_ab) ;
1939
+ let aux_testpaths = self . compute_aux_test_paths ( & self . testpaths , rel_ab) ;
1940
1940
let aux_props =
1941
1941
self . props . from_aux_file ( & aux_testpaths. file , self . revision , self . config ) ;
1942
1942
let aux_cx = TestCx {
@@ -2092,24 +2092,18 @@ impl<'test> TestCx<'test> {
2092
2092
proc_res
2093
2093
}
2094
2094
2095
- /// For each `aux-build: foo/bar` annotation, we check to find the
2096
- /// file in an `auxiliary` directory relative to the test itself.
2097
- fn compute_aux_test_paths ( & self , rel_ab : & str ) -> TestPaths {
2098
- let test_ab = self
2099
- . testpaths
2100
- . file
2101
- . parent ( )
2102
- . expect ( "test file path has no parent" )
2103
- . join ( "auxiliary" )
2104
- . join ( rel_ab) ;
2095
+ /// For each `aux-build: foo/bar` annotation, we check to find the file in an `auxiliary`
2096
+ /// directory relative to the test itself (not any intermediate auxiliaries).
2097
+ fn compute_aux_test_paths ( & self , of : & TestPaths , rel_ab : & str ) -> TestPaths {
2098
+ let test_ab =
2099
+ of. file . parent ( ) . expect ( "test file path has no parent" ) . join ( "auxiliary" ) . join ( rel_ab) ;
2105
2100
if !test_ab. exists ( ) {
2106
2101
self . fatal ( & format ! ( "aux-build `{}` source not found" , test_ab. display( ) ) )
2107
2102
}
2108
2103
2109
2104
TestPaths {
2110
2105
file : test_ab,
2111
- relative_dir : self
2112
- . testpaths
2106
+ relative_dir : of
2113
2107
. relative_dir
2114
2108
. join ( self . output_testname_unique ( ) )
2115
2109
. join ( "auxiliary" )
@@ -2135,30 +2129,34 @@ impl<'test> TestCx<'test> {
2135
2129
self . config . target . contains ( "vxworks" ) && !self . is_vxworks_pure_static ( )
2136
2130
}
2137
2131
2138
- fn build_all_auxiliary ( & self , rustc : & mut Command ) -> PathBuf {
2132
+ fn aux_output_dir ( & self ) -> PathBuf {
2139
2133
let aux_dir = self . aux_output_dir_name ( ) ;
2140
2134
2141
2135
if !self . props . aux_builds . is_empty ( ) {
2142
2136
let _ = fs:: remove_dir_all ( & aux_dir) ;
2143
2137
create_dir_all ( & aux_dir) . unwrap ( ) ;
2144
2138
}
2145
2139
2140
+ aux_dir
2141
+ }
2142
+
2143
+ fn build_all_auxiliary ( & self , of : & TestPaths , aux_dir : & Path , rustc : & mut Command ) {
2146
2144
for rel_ab in & self . props . aux_builds {
2147
- self . build_auxiliary ( rel_ab, & aux_dir) ;
2145
+ self . build_auxiliary ( of , rel_ab, & aux_dir) ;
2148
2146
}
2149
2147
2150
2148
for ( aux_name, aux_path) in & self . props . aux_crates {
2151
- let is_dylib = self . build_auxiliary ( & aux_path, & aux_dir) ;
2149
+ let is_dylib = self . build_auxiliary ( of , & aux_path, & aux_dir) ;
2152
2150
let lib_name =
2153
2151
get_lib_name ( & aux_path. trim_end_matches ( ".rs" ) . replace ( '-' , "_" ) , is_dylib) ;
2154
2152
rustc. arg ( "--extern" ) . arg ( format ! ( "{}={}/{}" , aux_name, aux_dir. display( ) , lib_name) ) ;
2155
2153
}
2156
-
2157
- aux_dir
2158
2154
}
2159
2155
2160
2156
fn compose_and_run_compiler ( & self , mut rustc : Command , input : Option < String > ) -> ProcRes {
2161
- let aux_dir = self . build_all_auxiliary ( & mut rustc) ;
2157
+ let aux_dir = self . aux_output_dir ( ) ;
2158
+ self . build_all_auxiliary ( & self . testpaths , & aux_dir, & mut rustc) ;
2159
+
2162
2160
self . props . unset_rustc_env . iter ( ) . fold ( & mut rustc, Command :: env_remove) ;
2163
2161
rustc. envs ( self . props . rustc_env . clone ( ) ) ;
2164
2162
self . compose_and_run (
@@ -2172,10 +2170,10 @@ impl<'test> TestCx<'test> {
2172
2170
/// Builds an aux dependency.
2173
2171
///
2174
2172
/// Returns whether or not it is a dylib.
2175
- fn build_auxiliary ( & self , source_path : & str , aux_dir : & Path ) -> bool {
2176
- let aux_testpaths = self . compute_aux_test_paths ( source_path) ;
2173
+ fn build_auxiliary ( & self , of : & TestPaths , source_path : & str , aux_dir : & Path ) -> bool {
2174
+ let aux_testpaths = self . compute_aux_test_paths ( of , source_path) ;
2177
2175
let aux_props = self . props . from_aux_file ( & aux_testpaths. file , self . revision , self . config ) ;
2178
- let aux_output = TargetLocation :: ThisDirectory ( self . aux_output_dir_name ( ) ) ;
2176
+ let aux_output = TargetLocation :: ThisDirectory ( aux_dir . to_path_buf ( ) ) ;
2179
2177
let aux_cx = TestCx {
2180
2178
config : self . config ,
2181
2179
props : & aux_props,
@@ -2193,6 +2191,7 @@ impl<'test> TestCx<'test> {
2193
2191
LinkToAux :: No ,
2194
2192
Vec :: new ( ) ,
2195
2193
) ;
2194
+ aux_cx. build_all_auxiliary ( of, aux_dir, & mut aux_rustc) ;
2196
2195
2197
2196
for key in & aux_props. unset_rustc_env {
2198
2197
aux_rustc. env_remove ( key) ;
@@ -3034,7 +3033,8 @@ impl<'test> TestCx<'test> {
3034
3033
LinkToAux :: Yes ,
3035
3034
Vec :: new ( ) ,
3036
3035
) ;
3037
- new_rustdoc. build_all_auxiliary ( & mut rustc) ;
3036
+ let aux_dir = new_rustdoc. aux_output_dir ( ) ;
3037
+ new_rustdoc. build_all_auxiliary ( & new_rustdoc. testpaths , & aux_dir, & mut rustc) ;
3038
3038
3039
3039
let proc_res = new_rustdoc. document ( & compare_dir) ;
3040
3040
if !proc_res. status . success ( ) {
0 commit comments