@@ -1100,25 +1100,23 @@ actual:\n\
1100
1100
}
1101
1101
1102
1102
fn compile_test ( & self ) -> ProcRes {
1103
- let aux_dir = self . aux_output_dir_name ( ) ;
1104
- // FIXME (#9639): This needs to handle non-utf8 paths
1105
- let mut extra_args = vec ! [ "-L" . to_owned( ) ,
1106
- aux_dir. to_str( ) . unwrap( ) . to_owned( ) ] ;
1103
+ let mut rustc = self . make_compile_args (
1104
+ & self . testpaths . file , TargetLocation :: ThisFile ( self . make_exe_name ( ) ) ) ;
1105
+
1106
+ rustc. arg ( "-L" ) . arg ( & self . aux_output_dir_name ( ) ) ;
1107
+
1107
1108
match self . config . mode {
1108
1109
CompileFail | Ui => {
1109
1110
// compile-fail and ui tests tend to have tons of unused code as
1110
1111
// it's just testing various pieces of the compile, but we don't
1111
1112
// want to actually assert warnings about all this code. Instead
1112
1113
// let's just ignore unused code warnings by defaults and tests
1113
1114
// can turn it back on if needed.
1114
- extra_args. push ( "-A" . to_owned ( ) ) ;
1115
- extra_args. push ( "unused" . to_owned ( ) ) ;
1115
+ rustc. args ( & [ "-A" , "unused" ] ) ;
1116
1116
}
1117
1117
_ => { }
1118
1118
}
1119
1119
1120
- let rustc = self . make_compile_args (
1121
- extra_args, & self . testpaths . file , TargetLocation :: ThisFile ( self . make_exe_name ( ) ) ) ;
1122
1120
self . compose_and_run_compiler ( rustc, None )
1123
1121
}
1124
1122
@@ -1241,17 +1239,27 @@ actual:\n\
1241
1239
}
1242
1240
1243
1241
let aux_dir = self . aux_output_dir_name ( ) ;
1244
- // FIXME (#9639): This needs to handle non-utf8 paths
1245
- let extra_link_args = vec ! [ "-L" . to_owned( ) ,
1246
- aux_dir. to_str( ) . unwrap( ) . to_owned( ) ] ;
1247
1242
1248
1243
for rel_ab in & self . props . aux_builds {
1249
1244
let aux_testpaths = self . compute_aux_test_paths ( rel_ab) ;
1250
1245
let aux_props = self . props . from_aux_file ( & aux_testpaths. file ,
1251
1246
self . revision ,
1252
1247
self . config ) ;
1253
- let mut crate_type = if aux_props. no_prefer_dynamic {
1254
- Vec :: new ( )
1248
+ let aux_output = {
1249
+ let f = self . make_lib_name ( & self . testpaths . file ) ;
1250
+ let parent = f. parent ( ) . unwrap ( ) ;
1251
+ TargetLocation :: ThisDirectory ( parent. to_path_buf ( ) )
1252
+ } ;
1253
+ let aux_cx = TestCx {
1254
+ config : self . config ,
1255
+ props : & aux_props,
1256
+ testpaths : & aux_testpaths,
1257
+ revision : self . revision
1258
+ } ;
1259
+ let mut aux_rustc = aux_cx. make_compile_args ( & aux_testpaths. file , aux_output) ;
1260
+
1261
+ let crate_type = if aux_props. no_prefer_dynamic {
1262
+ None
1255
1263
} else if ( self . config . target . contains ( "musl" ) && !aux_props. force_host ) ||
1256
1264
self . config . target . contains ( "emscripten" ) {
1257
1265
// We primarily compile all auxiliary libraries as dynamic libraries
@@ -1263,24 +1271,17 @@ actual:\n\
1263
1271
// dynamic libraries so we just go back to building a normal library. Note,
1264
1272
// however, that for MUSL if the library is built with `force_host` then
1265
1273
// it's ok to be a dylib as the host should always support dylibs.
1266
- vec ! [ "--crate-type= lib". to_owned ( ) ]
1274
+ Some ( " lib")
1267
1275
} else {
1268
- vec ! [ "--crate-type=dylib" . to_owned( ) ]
1269
- } ;
1270
- crate_type. extend ( extra_link_args. clone ( ) ) ;
1271
- let aux_output = {
1272
- let f = self . make_lib_name ( & self . testpaths . file ) ;
1273
- let parent = f. parent ( ) . unwrap ( ) ;
1274
- TargetLocation :: ThisDirectory ( parent. to_path_buf ( ) )
1275
- } ;
1276
- let aux_cx = TestCx {
1277
- config : self . config ,
1278
- props : & aux_props,
1279
- testpaths : & aux_testpaths,
1280
- revision : self . revision
1276
+ Some ( "dylib" )
1281
1277
} ;
1282
- let aux_rustc =
1283
- aux_cx. make_compile_args ( crate_type, & aux_testpaths. file , aux_output) ;
1278
+
1279
+ if let Some ( crate_type) = crate_type {
1280
+ aux_rustc. args ( & [ "--crate-type" , crate_type] ) ;
1281
+ }
1282
+
1283
+ aux_rustc. arg ( "-L" ) . arg ( & aux_dir) ;
1284
+
1284
1285
let auxres = aux_cx. compose_and_run ( aux_rustc,
1285
1286
aux_cx. config . compile_lib_path . to_str ( ) . unwrap ( ) ,
1286
1287
Some ( aux_dir. to_str ( ) . unwrap ( ) ) ,
@@ -1337,12 +1338,7 @@ actual:\n\
1337
1338
result
1338
1339
}
1339
1340
1340
- fn make_compile_args ( & self ,
1341
- extra_args : Vec < String > ,
1342
- input_file : & Path ,
1343
- output_file : TargetLocation )
1344
- -> Command
1345
- {
1341
+ fn make_compile_args ( & self , input_file : & Path , output_file : TargetLocation ) -> Command {
1346
1342
let mut rustc = Command :: new ( & self . config . rustc_path ) ;
1347
1343
rustc. arg ( input_file)
1348
1344
. arg ( "-L" ) . arg ( & self . config . build_base ) ;
@@ -1410,8 +1406,6 @@ actual:\n\
1410
1406
}
1411
1407
}
1412
1408
1413
- rustc. args ( & extra_args) ;
1414
-
1415
1409
if !self . props . no_prefer_dynamic {
1416
1410
rustc. args ( & [ "-C" , "prefer-dynamic" ] ) ;
1417
1411
}
@@ -1635,17 +1629,13 @@ actual:\n\
1635
1629
1636
1630
fn compile_test_and_save_ir ( & self ) -> ProcRes {
1637
1631
let aux_dir = self . aux_output_dir_name ( ) ;
1638
- // FIXME (#9639): This needs to handle non-utf8 paths
1639
- let mut link_args = vec ! [ "-L" . to_owned( ) ,
1640
- aux_dir. to_str( ) . unwrap( ) . to_owned( ) ] ;
1641
- let llvm_args = vec ! [ "--emit=llvm-ir" . to_owned( ) , ] ;
1642
- link_args. extend ( llvm_args) ;
1643
- let rustc = self . make_compile_args ( link_args,
1644
- & self . testpaths . file ,
1645
- TargetLocation :: ThisDirectory (
1646
- self . output_base_name ( ) . parent ( )
1647
- . unwrap ( )
1648
- . to_path_buf ( ) ) ) ;
1632
+
1633
+ let output_file = TargetLocation :: ThisDirectory (
1634
+ self . output_base_name ( ) . parent ( ) . unwrap ( ) . to_path_buf ( ) ) ;
1635
+ let mut rustc = self . make_compile_args ( & self . testpaths . file , output_file) ;
1636
+ rustc. arg ( "-L" ) . arg ( aux_dir)
1637
+ . arg ( "--emit=llvm-ir" ) ;
1638
+
1649
1639
self . compose_and_run_compiler ( rustc, None )
1650
1640
}
1651
1641
0 commit comments