@@ -31,7 +31,7 @@ use util::{self, dylib_path, dylib_path_var};
31
31
use compile;
32
32
use native;
33
33
use builder:: { Kind , Builder , Compiler , Step } ;
34
- use tool:: Tool ;
34
+ use tool:: { self , Tool } ;
35
35
36
36
const ADB_TEST_DIR : & str = "/data/tmp/work" ;
37
37
@@ -150,6 +150,17 @@ impl<'a> Step<'a> for Cargotest<'a> {
150
150
type Output = ( ) ;
151
151
const ONLY_HOSTS : bool = true ;
152
152
153
+ fn should_run ( _builder : & Builder , path : & Path ) -> bool {
154
+ path. ends_with ( "src/tools/cargotest" )
155
+ }
156
+
157
+ fn make_run ( builder : & Builder , _path : Option < & Path > , host : & str , _target : & str ) {
158
+ builder. ensure ( Cargotest {
159
+ stage : builder. top_stage ,
160
+ host : host,
161
+ } ) ;
162
+ }
163
+
153
164
/// Runs the `cargotest` tool as compiled in `stage` by the `host` compiler.
154
165
///
155
166
/// This tool in `src/tools` will check out a few Rust projects and run `cargo
@@ -734,6 +745,9 @@ impl<'a> Step<'a> for Docs<'a> {
734
745
fn run ( self , builder : & Builder ) {
735
746
let build = builder. build ;
736
747
let compiler = self . compiler ;
748
+
749
+ builder. ensure ( compile:: Test { compiler, target : compiler. host } ) ;
750
+
737
751
// Do a breadth-first traversal of the `src/doc` directory and just run
738
752
// tests for all files that end in `*.md`
739
753
let mut stack = vec ! [ build. src. join( "src/doc" ) ] ;
@@ -1054,6 +1068,7 @@ impl<'a> Step<'a> for Krate<'a> {
1054
1068
( "libtest" , "src/libtest" , String :: new ( ) , "test" )
1055
1069
}
1056
1070
Mode :: Librustc => {
1071
+ builder. ensure ( compile:: Rustc { compiler, target } ) ;
1057
1072
( "librustc" , "src/rustc" , build. rustc_features ( ) , "rustc-main" )
1058
1073
}
1059
1074
_ => panic ! ( "can only test libraries" ) ,
@@ -1209,16 +1224,6 @@ fn find_tests(dir: &Path, target: &str) -> Vec<PathBuf> {
1209
1224
dst
1210
1225
}
1211
1226
1212
- // // Some test suites are run inside emulators or on remote devices, and most
1213
- // // of our test binaries are linked dynamically which means we need to ship
1214
- // // the standard library and such to the emulator ahead of time. This step
1215
- // // represents this and is a dependency of all test suites.
1216
- // //
1217
- // // Most of the time this step is a noop (the `check::emulator_copy_libs`
1218
- // // only does work if necessary). For some steps such as shipping data to
1219
- // // QEMU we have to build our own tools so we've got conditional dependencies
1220
- // // on those programs as well. Note that the remote test client is built for
1221
- // // the build target (us) and the server is built for the target.
1222
1227
// rules.test("remote-copy-libs", "path/to/nowhere")
1223
1228
// .dep(|s| s.name("libtest"))
1224
1229
// .dep(move |s| {
@@ -1238,6 +1243,15 @@ fn find_tests(dir: &Path, target: &str) -> Vec<PathBuf> {
1238
1243
// .run(move |s| check::remote_copy_libs(build, &s.compiler(), s.target));
1239
1244
//
1240
1245
1246
+ /// Some test suites are run inside emulators or on remote devices, and most
1247
+ /// of our test binaries are linked dynamically which means we need to ship
1248
+ /// the standard library and such to the emulator ahead of time. This step
1249
+ /// represents this and is a dependency of all test suites.
1250
+ ///
1251
+ /// Most of the time this is a noop. For some steps such as shipping data to
1252
+ /// QEMU we have to build our own tools so we've got conditional dependencies
1253
+ /// on those programs as well. Note that the remote test client is built for
1254
+ /// the build target (us) and the server is built for the target.
1241
1255
#[ derive( Serialize ) ]
1242
1256
pub struct RemoteCopyLibs < ' a > {
1243
1257
compiler : Compiler < ' a > ,
@@ -1260,9 +1274,7 @@ impl<'a> Step<'a> for RemoteCopyLibs<'a> {
1260
1274
println ! ( "REMOTE copy libs to emulator ({})" , target) ;
1261
1275
t ! ( fs:: create_dir_all( build. out. join( "tmp" ) ) ) ;
1262
1276
1263
- // FIXME: This builds the tool for the native build triple
1264
- // (build.build); that is probably wrong. Should build for target.
1265
- let server = builder. tool_exe ( Tool :: RemoteTestServer ) ;
1277
+ let server = builder. ensure ( tool:: RemoteTestServer { compiler, target } ) ) ;
1266
1278
1267
1279
// Spawn the emulator and wait for it to come online
1268
1280
let tool = builder. tool_exe ( Tool :: RemoteTestClient ) ;
@@ -1304,6 +1316,9 @@ impl<'a> Step<'a> for Distcheck {
1304
1316
fn run ( self , builder : & Builder ) {
1305
1317
let build = builder. build ;
1306
1318
1319
+ builder. ensure ( dist:: PlainSourceTarball ) ;
1320
+ builder. ensure ( dist:: Src ) ;
1321
+
1307
1322
if build. build != "x86_64-unknown-linux-gnu" {
1308
1323
return
1309
1324
}
@@ -1314,9 +1329,6 @@ impl<'a> Step<'a> for Distcheck {
1314
1329
return
1315
1330
}
1316
1331
1317
- builder. ensure ( dist:: PlainSourceTarball ) ;
1318
- builder. ensure ( dist:: Src ) ;
1319
-
1320
1332
println ! ( "Distcheck" ) ;
1321
1333
let dir = build. out . join ( "tmp" ) . join ( "distcheck" ) ;
1322
1334
let _ = fs:: remove_dir_all ( & dir) ;
0 commit comments