use compile;
use native;
use builder::{Kind, Builder, Compiler, Step};
-use tool::Tool;
+use tool::{self, Tool};
const ADB_TEST_DIR: &str = "/data/tmp/work";
type Output = ();
const ONLY_HOSTS: bool = true;
+ fn should_run(_builder: &Builder, path: &Path) -> bool {
+ path.ends_with("src/tools/cargotest")
+ }
+
+ fn make_run(builder: &Builder, _path: Option<&Path>, host: &str, _target: &str) {
+ builder.ensure(Cargotest {
+ stage: builder.top_stage,
+ host: host,
+ });
+ }
+
/// Runs the `cargotest` tool as compiled in `stage` by the `host` compiler.
///
/// This tool in `src/tools` will check out a few Rust projects and run `cargo
const ONLY_HOSTS: bool = true;
fn should_run(_builder: &Builder, path: &Path) -> bool {
- path.ends_with("cargo") // FIXME: Why is this not src/tools/cargo?
+ path.ends_with("src/tools/cargo")
}
fn make_run(builder: &Builder, _path: Option<&Path>, _host: &str, target: &str) {
}
}
+#[derive(Serialize)]
+pub struct Docs<'a> {
+ compiler: Compiler<'a>,
+}
+
// rules.test("check-docs", "src/doc")
// .dep(|s| s.name("libtest"))
// .default(true)
// .host(true)
// .run(move |s| check::docs(build, &s.compiler()));
-/// Run `rustdoc --test` for all documentation in `src/doc`.
-///
-/// This will run all tests in our markdown documentation (e.g. the book)
-/// located in `src/doc`. The `rustdoc` that's run is the one that sits next to
-/// `compiler`.
-pub fn docs(build: &Build, compiler: &Compiler) {
- // Do a breadth-first traversal of the `src/doc` directory and just run
- // tests for all files that end in `*.md`
- let mut stack = vec![build.src.join("src/doc")];
- let _time = util::timeit();
- let _folder = build.fold_output(|| "test_docs");
-
- while let Some(p) = stack.pop() {
- if p.is_dir() {
- stack.extend(t!(p.read_dir()).map(|p| t!(p).path()));
- continue
- }
+impl<'a> Step<'a> for Docs<'a> {
+ type Output = ();
+ const DEFAULT: bool = true;
+ const ONLY_HOSTS: bool = true;
- if p.extension().and_then(|s| s.to_str()) != Some("md") {
- continue;
- }
+ fn should_run(_builder: &Builder, path: &Path) -> bool {
+ path.ends_with("src/doc")
+ }
- // The nostarch directory in the book is for no starch, and so isn't
- // guaranteed to build. We don't care if it doesn't build, so skip it.
- if p.to_str().map_or(false, |p| p.contains("nostarch")) {
- continue;
- }
+ fn make_run(builder: &Builder, _path: Option<&Path>, host: &str, _target: &str) {
+ builder.ensure(Docs {
+ compiler: builder.compiler(builder.top_stage, host),
+ });
+ }
+
+ /// Run `rustdoc --test` for all documentation in `src/doc`.
+ ///
+ /// This will run all tests in our markdown documentation (e.g. the book)
+ /// located in `src/doc`. The `rustdoc` that's run is the one that sits next to
+ /// `compiler`.
+ fn run(self, builder: &Builder) {
+ let build = builder.build;
+ let compiler = self.compiler;
- markdown_test(build, compiler, &p);
+ builder.ensure(compile::Test { compiler, target: compiler.host });
+
+ // Do a breadth-first traversal of the `src/doc` directory and just run
+ // tests for all files that end in `*.md`
+ let mut stack = vec![build.src.join("src/doc")];
+ let _time = util::timeit();
+ let _folder = build.fold_output(|| "test_docs");
+
+ while let Some(p) = stack.pop() {
+ if p.is_dir() {
+ stack.extend(t!(p.read_dir()).map(|p| t!(p).path()));
+ continue
+ }
+
+ if p.extension().and_then(|s| s.to_str()) != Some("md") {
+ continue;
+ }
+
+ // The nostarch directory in the book is for no starch, and so isn't
+ // guaranteed to build. We don't care if it doesn't build, so skip it.
+ if p.to_str().map_or(false, |p| p.contains("nostarch")) {
+ continue;
+ }
+
+ markdown_test(builder, compiler, &p);
+ }
}
}
("libtest", "src/libtest", String::new(), "test")
}
Mode::Librustc => {
+ builder.ensure(compile::Rustc { compiler, target });
("librustc", "src/rustc", build.rustc_features(), "rustc-main")
}
_ => panic!("can only test libraries"),
dst
}
-// // Some test suites are run inside emulators or on remote devices, and most
-// // of our test binaries are linked dynamically which means we need to ship
-// // the standard library and such to the emulator ahead of time. This step
-// // represents this and is a dependency of all test suites.
-// //
-// // Most of the time this step is a noop (the `check::emulator_copy_libs`
-// // only does work if necessary). For some steps such as shipping data to
-// // QEMU we have to build our own tools so we've got conditional dependencies
-// // on those programs as well. Note that the remote test client is built for
-// // the build target (us) and the server is built for the target.
// rules.test("remote-copy-libs", "path/to/nowhere")
// .dep(|s| s.name("libtest"))
// .dep(move |s| {
// .run(move |s| check::remote_copy_libs(build, &s.compiler(), s.target));
//
+/// Some test suites are run inside emulators or on remote devices, and most
+/// of our test binaries are linked dynamically which means we need to ship
+/// the standard library and such to the emulator ahead of time. This step
+/// represents this and is a dependency of all test suites.
+///
+/// Most of the time this is a noop. For some steps such as shipping data to
+/// QEMU we have to build our own tools so we've got conditional dependencies
+/// on those programs as well. Note that the remote test client is built for
+/// the build target (us) and the server is built for the target.
#[derive(Serialize)]
pub struct RemoteCopyLibs<'a> {
compiler: Compiler<'a>,
println!("REMOTE copy libs to emulator ({})", target);
t!(fs::create_dir_all(build.out.join("tmp")));
- // FIXME: This builds the tool for the native build triple
- // (build.build); that is probably wrong. Should build for target.
- let server = builder.tool_exe(Tool::RemoteTestServer);
+ let server = builder.ensure(tool::RemoteTestServer { compiler, target }));
// Spawn the emulator and wait for it to come online
let tool = builder.tool_exe(Tool::RemoteTestClient);
fn run(self, builder: &Builder) {
let build = builder.build;
+ builder.ensure(dist::PlainSourceTarball);
+ builder.ensure(dist::Src);
+
if build.build != "x86_64-unknown-linux-gnu" {
return
}
return
}
- builder.ensure(dist::PlainSourceTarball);
- builder.ensure(dist::Src);
-
println!("Distcheck");
let dir = build.out.join("tmp").join("distcheck");
let _ = fs::remove_dir_all(&dir);