Skip to content

Commit 939a98b

Browse files
Fix more incorrectly transitioned code
1 parent 2a21a84 commit 939a98b

File tree

2 files changed

+59
-22
lines changed

2 files changed

+59
-22
lines changed

src/bootstrap/check.rs

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use util::{self, dylib_path, dylib_path_var};
3131
use compile;
3232
use native;
3333
use builder::{Kind, Builder, Compiler, Step};
34-
use tool::Tool;
34+
use tool::{self, Tool};
3535

3636
const ADB_TEST_DIR: &str = "/data/tmp/work";
3737

@@ -150,6 +150,17 @@ impl<'a> Step<'a> for Cargotest<'a> {
150150
type Output = ();
151151
const ONLY_HOSTS: bool = true;
152152

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+
153164
/// Runs the `cargotest` tool as compiled in `stage` by the `host` compiler.
154165
///
155166
/// 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> {
734745
fn run(self, builder: &Builder) {
735746
let build = builder.build;
736747
let compiler = self.compiler;
748+
749+
builder.ensure(compile::Test { compiler, target: compiler.host });
750+
737751
// Do a breadth-first traversal of the `src/doc` directory and just run
738752
// tests for all files that end in `*.md`
739753
let mut stack = vec![build.src.join("src/doc")];
@@ -1054,6 +1068,7 @@ impl<'a> Step<'a> for Krate<'a> {
10541068
("libtest", "src/libtest", String::new(), "test")
10551069
}
10561070
Mode::Librustc => {
1071+
builder.ensure(compile::Rustc { compiler, target });
10571072
("librustc", "src/rustc", build.rustc_features(), "rustc-main")
10581073
}
10591074
_ => panic!("can only test libraries"),
@@ -1209,16 +1224,6 @@ fn find_tests(dir: &Path, target: &str) -> Vec<PathBuf> {
12091224
dst
12101225
}
12111226

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.
12221227
// rules.test("remote-copy-libs", "path/to/nowhere")
12231228
// .dep(|s| s.name("libtest"))
12241229
// .dep(move |s| {
@@ -1238,6 +1243,15 @@ fn find_tests(dir: &Path, target: &str) -> Vec<PathBuf> {
12381243
// .run(move |s| check::remote_copy_libs(build, &s.compiler(), s.target));
12391244
//
12401245

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.
12411255
#[derive(Serialize)]
12421256
pub struct RemoteCopyLibs<'a> {
12431257
compiler: Compiler<'a>,
@@ -1260,9 +1274,7 @@ impl<'a> Step<'a> for RemoteCopyLibs<'a> {
12601274
println!("REMOTE copy libs to emulator ({})", target);
12611275
t!(fs::create_dir_all(build.out.join("tmp")));
12621276

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 }));
12661278

12671279
// Spawn the emulator and wait for it to come online
12681280
let tool = builder.tool_exe(Tool::RemoteTestClient);
@@ -1304,6 +1316,9 @@ impl<'a> Step<'a> for Distcheck {
13041316
fn run(self, builder: &Builder) {
13051317
let build = builder.build;
13061318

1319+
builder.ensure(dist::PlainSourceTarball);
1320+
builder.ensure(dist::Src);
1321+
13071322
if build.build != "x86_64-unknown-linux-gnu" {
13081323
return
13091324
}
@@ -1314,9 +1329,6 @@ impl<'a> Step<'a> for Distcheck {
13141329
return
13151330
}
13161331

1317-
builder.ensure(dist::PlainSourceTarball);
1318-
builder.ensure(dist::Src);
1319-
13201332
println!("Distcheck");
13211333
let dir = build.out.join("tmp").join("distcheck");
13221334
let _ = fs::remove_dir_all(&dir);

src/bootstrap/tool.rs

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,6 @@ tool!(
239239
// .dep(|s| s.name("libstd-tool"))
240240
// .run(move |s| compile::tool(build, s.stage, s.target, "build-manifest"));
241241
BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::Librustc;
242-
// rules.build("tool-remote-test-server", "src/tools/remote-test-server")
243-
// .dep(|s| s.name("maybe-clean-tools"))
244-
// .dep(|s| s.name("libstd-tool"))
245-
// .run(move |s| compile::tool(build, s.stage, s.target, "remote-test-server"));
246-
RemoteTestServer, "src/tools/remote-test-server", "remote-test-server", Mode::Libstd;
247242
// rules.build("tool-remote-test-client", "src/tools/remote-test-client")
248243
// .dep(|s| s.name("maybe-clean-tools"))
249244
// .dep(|s| s.name("libstd-tool"))
@@ -256,6 +251,36 @@ tool!(
256251
RustInstaller, "src/tools/rust-installer", "rust-installer", Mode::Libstd;
257252
);
258253

254+
#[derive(Serialize)]
255+
pub struct RemoteTestServer<'a> {
256+
pub compiler: Compiler<'a>,
257+
pub target: &'a str,
258+
}
259+
260+
impl<'a> Step<'a> for RemoteTestServer<'a> {
261+
type Output = PathBuf;
262+
263+
fn should_run(_builder: &Builder, path: &Path) -> bool {
264+
path.ends_with("src/tools/remote-test-server")
265+
}
266+
267+
fn make_run(builder: &Builder, _path: Option<&Path>, host: &str, target: &str) {
268+
builder.ensure(RemoteTestServer {
269+
compiler: builder.compiler(builder.top_stage, host),
270+
target,
271+
});
272+
}
273+
274+
fn run(self, builder: &Builder) -> PathBuf {
275+
builder.ensure(ToolBuild {
276+
stage: self.stage,
277+
target: self.target,
278+
tool: "remote-test-server",
279+
mode: Mode::Libstd,
280+
})
281+
}
282+
}
283+
259284
// rules.build("tool-cargo", "src/tools/cargo")
260285
// .host(true)
261286
// .default(build.config.extended)

0 commit comments

Comments
 (0)