use std::any::Any;
use std::cell::{Cell, RefCell};
use std::collections::BTreeSet;
+use std::collections::HashMap;
use std::env;
use std::fmt::Debug;
use std::fs;
use std::ops::Deref;
use std::path::{Path, PathBuf};
use std::process::Command;
-use std::time::{Instant, Duration};
-use std::collections::HashMap;
+use std::time::{Duration, Instant};
+use cache::{Cache, Interned, INTERNER};
+use check;
use compile;
-use install;
use dist;
-use util::{exe, libdir, add_lib_path};
-use {Build, Mode, DocTests};
-use cache::{INTERNER, Interned, Cache};
-use check;
-use test;
-use flags::Subcommand;
use doc;
-use tool;
+use flags::Subcommand;
+use install;
use native;
+use test;
+use tool;
+use util::{add_lib_path, exe, libdir};
+use {Build, DocTests, Mode};
pub use Compiler;
-use petgraph::Graph;
use petgraph::graph::NodeIndex;
+use petgraph::Graph;
pub struct Builder<'a> {
pub build: &'a Build,
#[derive(Debug, Clone, PartialOrd, Ord, PartialEq, Eq)]
pub enum PathSet {
- Set (BTreeSet<PathBuf>),
- Suite (PathBuf)
+ Set(BTreeSet<PathBuf>),
+ Suite(PathBuf),
}
impl PathSet {
fn has(&self, needle: &Path) -> bool {
match self {
PathSet::Set(set) => set.iter().any(|p| p.ends_with(needle)),
- PathSet::Suite(_) => false
+ PathSet::Suite(_) => false,
}
}
fn path(&self, builder: &Builder) -> PathBuf {
match self {
- PathSet::Set(set) => set.iter().next().unwrap_or(&builder.build.src).to_path_buf(),
- PathSet::Suite(path) => PathBuf::from(path)
+ PathSet::Set(set) => set
+ .iter()
+ .next()
+ .unwrap_or(&builder.build.src)
+ .to_path_buf(),
+ PathSet::Suite(path) => PathBuf::from(path),
}
}
}
eprintln!("Skipping {:?} because it is excluded", pathset);
return;
} else if !builder.config.exclude.is_empty() {
- eprintln!("{:?} not skipped for {:?} -- not in {:?}", pathset,
- self.name, builder.config.exclude);
+ eprintln!(
+ "{:?} not skipped for {:?} -- not in {:?}",
+ pathset, self.name, builder.config.exclude
+ );
}
let hosts = &builder.hosts;
}
fn run(v: &[StepDescription], builder: &Builder, paths: &[PathBuf]) {
- let should_runs = v.iter().map(|desc| {
- (desc.should_run)(ShouldRun::new(builder))
- }).collect::<Vec<_>>();
+ let should_runs = v
+ .iter()
+ .map(|desc| (desc.should_run)(ShouldRun::new(builder)))
+ .collect::<Vec<_>>();
// sanity checks on rules
for (desc, should_run) in v.iter().zip(&should_runs) {
- assert!(!should_run.paths.is_empty(),
- "{:?} should have at least one pathset", desc.name);
+ assert!(
+ !should_run.paths.is_empty(),
+ "{:?} should have at least one pathset",
+ desc.name
+ );
}
if paths.is_empty() {
// multiple aliases for the same job
pub fn paths(mut self, paths: &[&str]) -> Self {
- self.paths.insert(PathSet::Set(paths.iter().map(PathBuf::from).collect()));
+ self.paths
+ .insert(PathSet::Set(paths.iter().map(PathBuf::from).collect()));
self
}
pub fn is_suite_path(&self, path: &Path) -> Option<&PathSet> {
- self.paths.iter().find(|pathset| {
- match pathset {
- PathSet::Suite(p) => path.starts_with(p),
- PathSet::Set(_) => false
- }
+ self.paths.iter().find(|pathset| match pathset {
+ PathSet::Suite(p) => path.starts_with(p),
+ PathSet::Set(_) => false,
})
}
}};
}
match kind {
- Kind::Build => describe!(compile::Std, compile::Test, compile::Rustc,
- compile::StartupObjects, tool::BuildManifest, tool::Rustbook, tool::ErrorIndex,
- tool::UnstableBookGen, tool::Tidy, tool::Linkchecker, tool::CargoTest,
- tool::Compiletest, tool::RemoteTestServer, tool::RemoteTestClient,
- tool::RustInstaller, tool::Cargo, tool::Rls, tool::Rustdoc, tool::Clippy,
- native::Llvm, tool::Rustfmt, tool::Miri, native::Lld),
- Kind::Check => describe!(check::Std, check::Test, check::Rustc, check::CodegenBackend,
- check::Rustdoc),
- Kind::Test => describe!(test::Tidy, test::Bootstrap, test::Ui, test::RunPass,
- test::CompileFail, test::ParseFail, test::RunFail, test::RunPassValgrind,
- test::MirOpt, test::Codegen, test::CodegenUnits, test::Incremental, test::Debuginfo,
- test::UiFullDeps, test::RunPassFullDeps, test::RunFailFullDeps,
- test::CompileFailFullDeps, test::IncrementalFullDeps, test::Rustdoc, test::Pretty,
- test::RunPassPretty, test::RunFailPretty, test::RunPassValgrindPretty,
- test::RunPassFullDepsPretty, test::RunFailFullDepsPretty,
- test::Crate, test::CrateLibrustc, test::CrateRustdoc, test::Linkcheck,
- test::Cargotest, test::Cargo, test::Rls, test::ErrorIndex, test::Distcheck,
+ Kind::Build => describe!(
+ compile::Std,
+ compile::Test,
+ compile::Rustc,
+ compile::StartupObjects,
+ tool::BuildManifest,
+ tool::Rustbook,
+ tool::ErrorIndex,
+ tool::UnstableBookGen,
+ tool::Tidy,
+ tool::Linkchecker,
+ tool::CargoTest,
+ tool::Compiletest,
+ tool::RemoteTestServer,
+ tool::RemoteTestClient,
+ tool::RustInstaller,
+ tool::Cargo,
+ tool::Rls,
+ tool::Rustdoc,
+ tool::Clippy,
+ native::Llvm,
+ tool::Rustfmt,
+ tool::Miri,
+ native::Lld
+ ),
+ Kind::Check => describe!(
+ check::Std,
+ check::Test,
+ check::Rustc,
+ check::CodegenBackend,
+ check::Rustdoc
+ ),
+ Kind::Test => describe!(
+ test::Tidy,
+ test::Bootstrap,
+ test::Ui,
+ test::RunPass,
+ test::CompileFail,
+ test::ParseFail,
+ test::RunFail,
+ test::RunPassValgrind,
+ test::MirOpt,
+ test::Codegen,
+ test::CodegenUnits,
+ test::Incremental,
+ test::Debuginfo,
+ test::UiFullDeps,
+ test::RunPassFullDeps,
+ test::RunFailFullDeps,
+ test::CompileFailFullDeps,
+ test::IncrementalFullDeps,
+ test::Rustdoc,
+ test::Pretty,
+ test::RunPassPretty,
+ test::RunFailPretty,
+ test::RunPassValgrindPretty,
+ test::RunPassFullDepsPretty,
+ test::RunFailFullDepsPretty,
+ test::Crate,
+ test::CrateLibrustc,
+ test::CrateRustdoc,
+ test::Linkcheck,
+ test::Cargotest,
+ test::Cargo,
+ test::Rls,
+ test::ErrorIndex,
+ test::Distcheck,
test::RunMakeFullDeps,
- test::Nomicon, test::Reference, test::RustdocBook, test::RustByExample,
- test::TheBook, test::UnstableBook, test::RustcBook,
- test::Rustfmt, test::Miri, test::Clippy, test::RustdocJS, test::RustdocTheme,
+ test::Nomicon,
+ test::Reference,
+ test::RustdocBook,
+ test::RustByExample,
+ test::TheBook,
+ test::UnstableBook,
+ test::RustcBook,
+ test::Rustfmt,
+ test::Miri,
+ test::Clippy,
+ test::RustdocJS,
+ test::RustdocTheme,
// Run run-make last, since these won't pass without make on Windows
- test::RunMake, test::RustdocUi),
+ test::RunMake,
+ test::RustdocUi
+ ),
Kind::Bench => describe!(test::Crate, test::CrateLibrustc),
- Kind::Doc => describe!(doc::UnstableBook, doc::UnstableBookGen, doc::TheBook,
- doc::Standalone, doc::Std, doc::Test, doc::WhitelistedRustc, doc::Rustc,
- doc::Rustdoc, doc::ErrorIndex, doc::Nomicon, doc::Reference, doc::RustdocBook,
- doc::RustByExample, doc::RustcBook, doc::CargoBook),
- Kind::Dist => describe!(dist::Docs, dist::RustcDocs, dist::Mingw, dist::Rustc,
- dist::DebuggerScripts, dist::Std, dist::Analysis, dist::Src,
- dist::PlainSourceTarball, dist::Cargo, dist::Rls, dist::Rustfmt, dist::Extended,
- dist::HashSign),
- Kind::Install => describe!(install::Docs, install::Std, install::Cargo, install::Rls,
- install::Rustfmt, install::Analysis, install::Src, install::Rustc),
+ Kind::Doc => describe!(
+ doc::UnstableBook,
+ doc::UnstableBookGen,
+ doc::TheBook,
+ doc::Standalone,
+ doc::Std,
+ doc::Test,
+ doc::WhitelistedRustc,
+ doc::Rustc,
+ doc::Rustdoc,
+ doc::ErrorIndex,
+ doc::Nomicon,
+ doc::Reference,
+ doc::RustdocBook,
+ doc::RustByExample,
+ doc::RustcBook,
+ doc::CargoBook
+ ),
+ Kind::Dist => describe!(
+ dist::Docs,
+ dist::RustcDocs,
+ dist::Mingw,
+ dist::Rustc,
+ dist::DebuggerScripts,
+ dist::Std,
+ dist::Analysis,
+ dist::Src,
+ dist::PlainSourceTarball,
+ dist::Cargo,
+ dist::Rls,
+ dist::Rustfmt,
+ dist::Extended,
+ dist::HashSign
+ ),
+ Kind::Install => describe!(
+ install::Docs,
+ install::Std,
+ install::Cargo,
+ install::Rls,
+ install::Rustfmt,
+ install::Analysis,
+ install::Src,
+ install::Rustc
+ ),
}
}
}
let mut help = String::from("Available paths:\n");
for pathset in should_run.paths {
- if let PathSet::Set(set) = pathset{
- set.iter().for_each(|path| help.push_str(
- format!(" ./x.py {} {}\n", subcommand, path.display()).as_str()
- ))
+ if let PathSet::Set(set) = pathset {
+ set.iter().for_each(|path| {
+ help.push_str(
+ format!(" ./x.py {} {}\n", subcommand, path.display()).as_str(),
+ )
+ })
}
}
Some(help)
parent: Cell::new(None),
};
-
if kind == Kind::Dist {
- assert!(!builder.config.test_miri, "Do not distribute with miri enabled.\n\
+ assert!(
+ !builder.config.test_miri,
+ "Do not distribute with miri enabled.\n\
The distributed libraries would include all MIR (increasing binary size).
- The distributed MIR would include validation statements.");
+ The distributed MIR would include validation statements."
+ );
}
builder
/// obtained through this function, since it ensures that they are valid
/// (i.e., built and assembled).
pub fn compiler(&self, stage: u32, host: Interned<String>) -> Compiler {
- self.ensure(compile::Assemble { target_compiler: Compiler { stage, host } })
+ self.ensure(compile::Assemble {
+ target_compiler: Compiler { stage, host },
+ })
}
pub fn sysroot(&self, compiler: Compiler) -> Interned<PathBuf> {
/// Returns the libdir where the standard library and other artifacts are
/// found for a compiler's sysroot.
pub fn sysroot_libdir(
- &self, compiler: Compiler, target: Interned<String>
+ &self,
+ compiler: Compiler,
+ target: Interned<String>,
) -> Interned<PathBuf> {
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
struct Libdir {
} else {
Path::new("lib")
};
- let sysroot = builder.sysroot(self.compiler).join(lib)
- .join("rustlib").join(self.target).join("lib");
+ let sysroot = builder
+ .sysroot(self.compiler)
+ .join(lib)
+ .join("rustlib")
+ .join(self.target)
+ .join("lib");
let _ = fs::remove_dir_all(&sysroot);
t!(fs::create_dir_all(&sysroot));
INTERNER.intern_path(sysroot)
// compiler live next to the compiler and the system will find them
// automatically.
if cfg!(windows) {
- return
+ return;
}
add_lib_path(vec![self.rustc_libdir(compiler)], cmd);
if compiler.is_snapshot(self) {
self.initial_rustc.clone()
} else {
- self.sysroot(compiler).join("bin").join(exe("rustc", &compiler.host))
+ self.sysroot(compiler)
+ .join("bin")
+ .join(exe("rustc", &compiler.host))
}
}
let mut cmd = Command::new(&self.out.join("bootstrap/debug/rustdoc"));
let compiler = self.compiler(self.top_stage, host);
cmd.env("RUSTC_STAGE", compiler.stage.to_string())
- .env("RUSTC_SYSROOT", self.sysroot(compiler))
- .env("RUSTDOC_LIBDIR", self.sysroot_libdir(compiler, self.config.build))
- .env("CFG_RELEASE_CHANNEL", &self.config.channel)
- .env("RUSTDOC_REAL", self.rustdoc(host))
- .env("RUSTDOC_CRATE_VERSION", self.rust_version())
- .env("RUSTC_BOOTSTRAP", "1");
+ .env("RUSTC_SYSROOT", self.sysroot(compiler))
+ .env(
+ "RUSTDOC_LIBDIR",
+ self.sysroot_libdir(compiler, self.config.build),
+ )
+ .env("CFG_RELEASE_CHANNEL", &self.config.channel)
+ .env("RUSTDOC_REAL", self.rustdoc(host))
+ .env("RUSTDOC_CRATE_VERSION", self.rust_version())
+ .env("RUSTC_BOOTSTRAP", "1");
if let Some(linker) = self.linker(host) {
cmd.env("RUSTC_TARGET_LINKER", linker);
}
/// rustc compiler, its output will be scoped by `mode`'s output directory,
/// it will pass the `--target` flag for the specified `target`, and will be
/// executing the Cargo command `cmd`.
- pub fn cargo(&self,
- compiler: Compiler,
- mode: Mode,
- target: Interned<String>,
- cmd: &str) -> Command {
+ pub fn cargo(
+ &self,
+ compiler: Compiler,
+ mode: Mode,
+ target: Interned<String>,
+ cmd: &str,
+ ) -> Command {
let mut cargo = Command::new(&self.initial_cargo);
let out_dir = self.stage_out(compiler, mode);
- cargo.env("CARGO_TARGET_DIR", out_dir)
- .arg(cmd)
- .arg("--target")
- .arg(target);
+ cargo
+ .env("CARGO_TARGET_DIR", out_dir)
+ .arg(cmd)
+ .arg("--target")
+ .arg(target);
// Set a flag for `check` so that certain build scripts can do less work
// (e.g. not building/requiring LLVM).
}
if !extra_args.is_empty() {
- cargo.env("RUSTFLAGS",
- format!("{} {}", env::var("RUSTFLAGS").unwrap_or_default(), extra_args));
+ cargo.env(
+ "RUSTFLAGS",
+ format!(
+ "{} {}",
+ env::var("RUSTFLAGS").unwrap_or_default(),
+ extra_args
+ ),
+ );
}
let want_rustdoc = self.doc_tests != DocTests::No;
//
// These variables are primarily all read by
// src/bootstrap/bin/{rustc.rs,rustdoc.rs}
- cargo.env("RUSTBUILD_NATIVE_DIR", self.native_dir(target))
- .env("RUSTC", self.out.join("bootstrap/debug/rustc"))
- .env("RUSTC_REAL", self.rustc(compiler))
- .env("RUSTC_STAGE", stage.to_string())
- .env("RUSTC_DEBUG_ASSERTIONS",
- self.config.rust_debug_assertions.to_string())
- .env("RUSTC_SYSROOT", self.sysroot(compiler))
- .env("RUSTC_LIBDIR", self.rustc_libdir(compiler))
- .env("RUSTC_RPATH", self.config.rust_rpath.to_string())
- .env("RUSTDOC", self.out.join("bootstrap/debug/rustdoc"))
- .env("RUSTDOC_REAL", if cmd == "doc" || (cmd == "test" && want_rustdoc) {
- self.rustdoc(compiler.host)
- } else {
- PathBuf::from("/path/to/nowhere/rustdoc/not/required")
- })
- .env("TEST_MIRI", self.config.test_miri.to_string())
- .env("RUSTC_ERROR_METADATA_DST", self.extended_error_dir());
+ cargo
+ .env("RUSTBUILD_NATIVE_DIR", self.native_dir(target))
+ .env("RUSTC", self.out.join("bootstrap/debug/rustc"))
+ .env("RUSTC_REAL", self.rustc(compiler))
+ .env("RUSTC_STAGE", stage.to_string())
+ .env(
+ "RUSTC_DEBUG_ASSERTIONS",
+ self.config.rust_debug_assertions.to_string(),
+ )
+ .env("RUSTC_SYSROOT", self.sysroot(compiler))
+ .env("RUSTC_LIBDIR", self.rustc_libdir(compiler))
+ .env("RUSTC_RPATH", self.config.rust_rpath.to_string())
+ .env("RUSTDOC", self.out.join("bootstrap/debug/rustdoc"))
+ .env(
+ "RUSTDOC_REAL",
+ if cmd == "doc" || (cmd == "test" && want_rustdoc) {
+ self.rustdoc(compiler.host)
+ } else {
+ PathBuf::from("/path/to/nowhere/rustdoc/not/required")
+ },
+ )
+ .env("TEST_MIRI", self.config.test_miri.to_string())
+ .env("RUSTC_ERROR_METADATA_DST", self.extended_error_dir());
if let Some(host_linker) = self.linker(compiler.host) {
cargo.env("RUSTC_HOST_LINKER", host_linker);
cargo.env("RUSTC_ERROR_FORMAT", error_format);
}
if cmd != "build" && cmd != "check" && want_rustdoc {
- cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(self.compiler(2, self.config.build)));
+ cargo.env(
+ "RUSTDOC_LIBDIR",
+ self.rustc_libdir(self.compiler(2, self.config.build)),
+ );
}
if mode == Mode::Tool {
// enabled in the config. Adding debuginfo makes them several times larger.
if self.config.rust_debuginfo_tools {
cargo.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string());
- cargo.env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string());
+ cargo.env(
+ "RUSTC_DEBUGINFO_LINES",
+ self.config.rust_debuginfo_lines.to_string(),
+ );
}
} else {
cargo.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string());
- cargo.env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string());
+ cargo.env(
+ "RUSTC_DEBUGINFO_LINES",
+ self.config.rust_debuginfo_lines.to_string(),
+ );
cargo.env("RUSTC_FORCE_UNSTABLE", "1");
// Currently the compiler depends on crates from crates.io, and
// If LLVM support is disabled we need to use the snapshot compiler to compile
// build scripts, as the new compiler doesn't support executables.
if mode == Mode::Libstd || !self.config.llvm_enabled {
- cargo.env("RUSTC_SNAPSHOT", &self.initial_rustc)
- .env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_snapshot_libdir());
+ cargo
+ .env("RUSTC_SNAPSHOT", &self.initial_rustc)
+ .env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_snapshot_libdir());
} else {
- cargo.env("RUSTC_SNAPSHOT", self.rustc(compiler))
- .env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_libdir(compiler));
+ cargo
+ .env("RUSTC_SNAPSHOT", self.rustc(compiler))
+ .env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_libdir(compiler));
}
// Ignore incremental modes except for stage0, since we're
}
};
let cc = ccacheify(&self.cc(target));
- cargo.env(format!("CC_{}", target), &cc)
- .env("CC", &cc);
+ cargo.env(format!("CC_{}", target), &cc).env("CC", &cc);
let cflags = self.cflags(target).join(" ");
- cargo.env(format!("CFLAGS_{}", target), cflags.clone())
- .env("CFLAGS", cflags.clone());
+ cargo
+ .env(format!("CFLAGS_{}", target), cflags.clone())
+ .env("CFLAGS", cflags.clone());
if let Some(ar) = self.ar(target) {
let ranlib = format!("{} s", ar.display());
- cargo.env(format!("AR_{}", target), ar)
- .env("AR", ar)
- .env(format!("RANLIB_{}", target), ranlib.clone())
- .env("RANLIB", ranlib);
+ cargo
+ .env(format!("AR_{}", target), ar)
+ .env("AR", ar)
+ .env(format!("RANLIB_{}", target), ranlib.clone())
+ .env("RANLIB", ranlib);
}
if let Ok(cxx) = self.cxx(target) {
let cxx = ccacheify(&cxx);
- cargo.env(format!("CXX_{}", target), &cxx)
- .env("CXX", &cxx)
- .env(format!("CXXFLAGS_{}", target), cflags.clone())
- .env("CXXFLAGS", cflags);
+ cargo
+ .env(format!("CXX_{}", target), &cxx)
+ .env("CXX", &cxx)
+ .env(format!("CXXFLAGS_{}", target), cflags.clone())
+ .env("CXXFLAGS", cflags);
}
}
- if cmd == "build" && mode == Mode::Libstd
- && self.config.extended && compiler.is_final_stage(self)
+ if cmd == "build"
+ && mode == Mode::Libstd
+ && self.config.extended
+ && compiler.is_final_stage(self)
{
cargo.env("RUSTC_SAVE_ANALYSIS", "api".to_string());
}
let mut stack = self.stack.borrow_mut();
for stack_step in stack.iter() {
// should skip
- if stack_step.downcast_ref::<S>().map_or(true, |stack_step| *stack_step != step) {
+ if stack_step
+ .downcast_ref::<S>()
+ .map_or(true, |stack_step| *stack_step != step)
+ {
continue;
}
let mut out = String::new();
{
let mut graph = self.graph.borrow_mut();
let parent = self.parent.get();
- let us = *self.graph_nodes.borrow_mut()
+ let us = *self
+ .graph_nodes
+ .borrow_mut()
.entry(format!("{:?}", step))
.or_insert_with(|| graph.add_node(format!("{:?}", step)));
if let Some(parent) = parent {
{
let mut graph = self.graph.borrow_mut();
let parent = self.parent.get();
- let us = *self.graph_nodes.borrow_mut()
+ let us = *self
+ .graph_nodes
+ .borrow_mut()
.entry(format!("{:?}", step))
.or_insert_with(|| graph.add_node(format!("{:?}", step)));
self.parent.set(Some(us));
self.parent.set(prev_parent);
if self.config.print_step_timings && dur > Duration::from_millis(100) {
- println!("[TIMING] {:?} -- {}.{:03}",
- step,
- dur.as_secs(),
- dur.subsec_nanos() / 1_000_000);
+ println!(
+ "[TIMING] {:?} -- {}.{:03}",
+ step,
+ dur.as_secs(),
+ dur.subsec_nanos() / 1_000_000
+ );
}
{
let cur_step = stack.pop().expect("step stack empty");
assert_eq!(cur_step.downcast_ref(), Some(&step));
}
- self.verbose(&format!("{}< {:?}", " ".repeat(self.stack.borrow().len()), step));
+ self.verbose(&format!(
+ "{}< {:?}",
+ " ".repeat(self.stack.borrow().len()),
+ step
+ ));
self.cache.put(step, out.clone());
out
}
#[cfg(test)]
mod __test {
+ use super::*;
use config::Config;
use std::thread;
- use super::*;
fn configure(host: &[&str], target: &[&str]) -> Config {
let mut config = Config::default_opts();
config.run_host_only = true;
config.dry_run = true;
// try to avoid spurious failures in dist where we create/delete each others file
- let dir = config.out.join("tmp-rustbuild-tests")
- .join(&thread::current().name().unwrap_or("unknown").replace(":", "-"));
+ let dir = config.out.join("tmp-rustbuild-tests").join(
+ &thread::current()
+ .name()
+ .unwrap_or("unknown")
+ .replace(":", "-"),
+ );
t!(fs::create_dir_all(&dir));
config.out = dir;
config.build = INTERNER.intern_str("A");
- config.hosts = vec![config.build].clone().into_iter()
- .chain(host.iter().map(|s| INTERNER.intern_str(s))).collect::<Vec<_>>();
- config.targets = config.hosts.clone().into_iter()
- .chain(target.iter().map(|s| INTERNER.intern_str(s))).collect::<Vec<_>>();
+ config.hosts = vec![config.build]
+ .clone()
+ .into_iter()
+ .chain(host.iter().map(|s| INTERNER.intern_str(s)))
+ .collect::<Vec<_>>();
+ config.targets = config
+ .hosts
+ .clone()
+ .into_iter()
+ .chain(target.iter().map(|s| INTERNER.intern_str(s)))
+ .collect::<Vec<_>>();
config
}
let a = INTERNER.intern_str("A");
- assert_eq!(first(builder.cache.all::<dist::Docs>()), &[
- dist::Docs { stage: 2, host: a },
- ]);
- assert_eq!(first(builder.cache.all::<dist::Mingw>()), &[
- dist::Mingw { host: a },
- ]);
- assert_eq!(first(builder.cache.all::<dist::Rustc>()), &[
- dist::Rustc { compiler: Compiler { host: a, stage: 2 } },
- ]);
- assert_eq!(first(builder.cache.all::<dist::Std>()), &[
- dist::Std {
+ assert_eq!(
+ first(builder.cache.all::<dist::Docs>()),
+ &[dist::Docs { stage: 2, host: a },]
+ );
+ assert_eq!(
+ first(builder.cache.all::<dist::Mingw>()),
+ &[dist::Mingw { host: a },]
+ );
+ assert_eq!(
+ first(builder.cache.all::<dist::Rustc>()),
+ &[dist::Rustc {
+ compiler: Compiler { host: a, stage: 2 }
+ },]
+ );
+ assert_eq!(
+ first(builder.cache.all::<dist::Std>()),
+ &[dist::Std {
compiler: Compiler { host: a, stage: 2 },
target: a,
- },
- ]);
+ },]
+ );
assert_eq!(first(builder.cache.all::<dist::Src>()), &[dist::Src]);
}
let a = INTERNER.intern_str("A");
let b = INTERNER.intern_str("B");
- assert_eq!(first(builder.cache.all::<dist::Docs>()), &[
- dist::Docs { stage: 2, host: a },
- dist::Docs { stage: 2, host: b },
- ]);
- assert_eq!(first(builder.cache.all::<dist::Mingw>()), &[
- dist::Mingw { host: a },
- dist::Mingw { host: b },
- ]);
- assert_eq!(first(builder.cache.all::<dist::Rustc>()), &[
- dist::Rustc { compiler: Compiler { host: a, stage: 2 } },
- ]);
- assert_eq!(first(builder.cache.all::<dist::Std>()), &[
- dist::Std {
- compiler: Compiler { host: a, stage: 2 },
- target: a,
- },
- dist::Std {
- compiler: Compiler { host: a, stage: 2 },
- target: b,
- },
- ]);
+ assert_eq!(
+ first(builder.cache.all::<dist::Docs>()),
+ &[
+ dist::Docs { stage: 2, host: a },
+ dist::Docs { stage: 2, host: b },
+ ]
+ );
+ assert_eq!(
+ first(builder.cache.all::<dist::Mingw>()),
+ &[dist::Mingw { host: a }, dist::Mingw { host: b },]
+ );
+ assert_eq!(
+ first(builder.cache.all::<dist::Rustc>()),
+ &[dist::Rustc {
+ compiler: Compiler { host: a, stage: 2 }
+ },]
+ );
+ assert_eq!(
+ first(builder.cache.all::<dist::Std>()),
+ &[
+ dist::Std {
+ compiler: Compiler { host: a, stage: 2 },
+ target: a,
+ },
+ dist::Std {
+ compiler: Compiler { host: a, stage: 2 },
+ target: b,
+ },
+ ]
+ );
assert_eq!(first(builder.cache.all::<dist::Src>()), &[dist::Src]);
}
let a = INTERNER.intern_str("A");
let b = INTERNER.intern_str("B");
- assert_eq!(first(builder.cache.all::<dist::Docs>()), &[
- dist::Docs { stage: 2, host: a },
- dist::Docs { stage: 2, host: b },
- ]);
- assert_eq!(first(builder.cache.all::<dist::Mingw>()), &[
- dist::Mingw { host: a },
- dist::Mingw { host: b },
- ]);
- assert_eq!(first(builder.cache.all::<dist::Rustc>()), &[
- dist::Rustc { compiler: Compiler { host: a, stage: 2 } },
- dist::Rustc { compiler: Compiler { host: b, stage: 2 } },
- ]);
- assert_eq!(first(builder.cache.all::<dist::Std>()), &[
- dist::Std {
- compiler: Compiler { host: a, stage: 2 },
- target: a,
- },
- dist::Std {
- compiler: Compiler { host: a, stage: 2 },
- target: b,
- },
- ]);
+ assert_eq!(
+ first(builder.cache.all::<dist::Docs>()),
+ &[
+ dist::Docs { stage: 2, host: a },
+ dist::Docs { stage: 2, host: b },
+ ]
+ );
+ assert_eq!(
+ first(builder.cache.all::<dist::Mingw>()),
+ &[dist::Mingw { host: a }, dist::Mingw { host: b },]
+ );
+ assert_eq!(
+ first(builder.cache.all::<dist::Rustc>()),
+ &[
+ dist::Rustc {
+ compiler: Compiler { host: a, stage: 2 }
+ },
+ dist::Rustc {
+ compiler: Compiler { host: b, stage: 2 }
+ },
+ ]
+ );
+ assert_eq!(
+ first(builder.cache.all::<dist::Std>()),
+ &[
+ dist::Std {
+ compiler: Compiler { host: a, stage: 2 },
+ target: a,
+ },
+ dist::Std {
+ compiler: Compiler { host: a, stage: 2 },
+ target: b,
+ },
+ ]
+ );
assert_eq!(first(builder.cache.all::<dist::Src>()), &[dist::Src]);
}
let b = INTERNER.intern_str("B");
let c = INTERNER.intern_str("C");
- assert_eq!(first(builder.cache.all::<dist::Docs>()), &[
- dist::Docs { stage: 2, host: a },
- dist::Docs { stage: 2, host: b },
- dist::Docs { stage: 2, host: c },
- ]);
- assert_eq!(first(builder.cache.all::<dist::Mingw>()), &[
- dist::Mingw { host: a },
- dist::Mingw { host: b },
- dist::Mingw { host: c },
- ]);
- assert_eq!(first(builder.cache.all::<dist::Rustc>()), &[
- dist::Rustc { compiler: Compiler { host: a, stage: 2 } },
- dist::Rustc { compiler: Compiler { host: b, stage: 2 } },
- ]);
- assert_eq!(first(builder.cache.all::<dist::Std>()), &[
- dist::Std {
- compiler: Compiler { host: a, stage: 2 },
- target: a,
- },
- dist::Std {
- compiler: Compiler { host: a, stage: 2 },
- target: b,
- },
- dist::Std {
- compiler: Compiler { host: a, stage: 2 },
- target: c,
- },
- ]);
+ assert_eq!(
+ first(builder.cache.all::<dist::Docs>()),
+ &[
+ dist::Docs { stage: 2, host: a },
+ dist::Docs { stage: 2, host: b },
+ dist::Docs { stage: 2, host: c },
+ ]
+ );
+ assert_eq!(
+ first(builder.cache.all::<dist::Mingw>()),
+ &[
+ dist::Mingw { host: a },
+ dist::Mingw { host: b },
+ dist::Mingw { host: c },
+ ]
+ );
+ assert_eq!(
+ first(builder.cache.all::<dist::Rustc>()),
+ &[
+ dist::Rustc {
+ compiler: Compiler { host: a, stage: 2 }
+ },
+ dist::Rustc {
+ compiler: Compiler { host: b, stage: 2 }
+ },
+ ]
+ );
+ assert_eq!(
+ first(builder.cache.all::<dist::Std>()),
+ &[
+ dist::Std {
+ compiler: Compiler { host: a, stage: 2 },
+ target: a,
+ },
+ dist::Std {
+ compiler: Compiler { host: a, stage: 2 },
+ target: b,
+ },
+ dist::Std {
+ compiler: Compiler { host: a, stage: 2 },
+ target: c,
+ },
+ ]
+ );
assert_eq!(first(builder.cache.all::<dist::Src>()), &[dist::Src]);
}
let b = INTERNER.intern_str("B");
let c = INTERNER.intern_str("C");
- assert_eq!(first(builder.cache.all::<dist::Docs>()), &[
- dist::Docs { stage: 2, host: a },
- dist::Docs { stage: 2, host: b },
- dist::Docs { stage: 2, host: c },
- ]);
- assert_eq!(first(builder.cache.all::<dist::Mingw>()), &[
- dist::Mingw { host: a },
- dist::Mingw { host: b },
- dist::Mingw { host: c },
- ]);
+ assert_eq!(
+ first(builder.cache.all::<dist::Docs>()),
+ &[
+ dist::Docs { stage: 2, host: a },
+ dist::Docs { stage: 2, host: b },
+ dist::Docs { stage: 2, host: c },
+ ]
+ );
+ assert_eq!(
+ first(builder.cache.all::<dist::Mingw>()),
+ &[
+ dist::Mingw { host: a },
+ dist::Mingw { host: b },
+ dist::Mingw { host: c },
+ ]
+ );
assert_eq!(first(builder.cache.all::<dist::Rustc>()), &[]);
- assert_eq!(first(builder.cache.all::<dist::Std>()), &[
- dist::Std {
- compiler: Compiler { host: a, stage: 2 },
- target: a,
- },
- dist::Std {
- compiler: Compiler { host: a, stage: 2 },
- target: b,
- },
- dist::Std {
- compiler: Compiler { host: a, stage: 2 },
- target: c,
- },
- ]);
+ assert_eq!(
+ first(builder.cache.all::<dist::Std>()),
+ &[
+ dist::Std {
+ compiler: Compiler { host: a, stage: 2 },
+ target: a,
+ },
+ dist::Std {
+ compiler: Compiler { host: a, stage: 2 },
+ target: b,
+ },
+ dist::Std {
+ compiler: Compiler { host: a, stage: 2 },
+ target: c,
+ },
+ ]
+ );
assert_eq!(first(builder.cache.all::<dist::Src>()), &[]);
}
let a = INTERNER.intern_str("A");
let b = INTERNER.intern_str("B");
- assert_eq!(first(builder.cache.all::<dist::Docs>()), &[
- dist::Docs { stage: 2, host: a },
- dist::Docs { stage: 2, host: b },
- ]);
- assert_eq!(first(builder.cache.all::<dist::Mingw>()), &[
- dist::Mingw { host: a },
- dist::Mingw { host: b },
- ]);
- assert_eq!(first(builder.cache.all::<dist::Rustc>()), &[
- dist::Rustc { compiler: Compiler { host: a, stage: 2 } },
- dist::Rustc { compiler: Compiler { host: b, stage: 2 } },
- ]);
- assert_eq!(first(builder.cache.all::<dist::Std>()), &[
- dist::Std {
- compiler: Compiler { host: a, stage: 2 },
- target: a,
- },
- dist::Std {
- compiler: Compiler { host: a, stage: 2 },
- target: b,
- },
- ]);
+ assert_eq!(
+ first(builder.cache.all::<dist::Docs>()),
+ &[
+ dist::Docs { stage: 2, host: a },
+ dist::Docs { stage: 2, host: b },
+ ]
+ );
+ assert_eq!(
+ first(builder.cache.all::<dist::Mingw>()),
+ &[dist::Mingw { host: a }, dist::Mingw { host: b },]
+ );
+ assert_eq!(
+ first(builder.cache.all::<dist::Rustc>()),
+ &[
+ dist::Rustc {
+ compiler: Compiler { host: a, stage: 2 }
+ },
+ dist::Rustc {
+ compiler: Compiler { host: b, stage: 2 }
+ },
+ ]
+ );
+ assert_eq!(
+ first(builder.cache.all::<dist::Std>()),
+ &[
+ dist::Std {
+ compiler: Compiler { host: a, stage: 2 },
+ target: a,
+ },
+ dist::Std {
+ compiler: Compiler { host: a, stage: 2 },
+ target: b,
+ },
+ ]
+ );
assert_eq!(first(builder.cache.all::<dist::Src>()), &[dist::Src]);
- assert_eq!(first(builder.cache.all::<compile::Std>()), &[
- compile::Std {
- compiler: Compiler { host: a, stage: 0 },
- target: a,
- },
- compile::Std {
- compiler: Compiler { host: a, stage: 1 },
- target: a,
- },
- compile::Std {
- compiler: Compiler { host: a, stage: 2 },
- target: a,
- },
- compile::Std {
- compiler: Compiler { host: a, stage: 1 },
- target: b,
- },
- compile::Std {
- compiler: Compiler { host: a, stage: 2 },
- target: b,
- },
- ]);
- assert_eq!(first(builder.cache.all::<compile::Test>()), &[
- compile::Test {
- compiler: Compiler { host: a, stage: 0 },
- target: a,
- },
- compile::Test {
- compiler: Compiler { host: a, stage: 1 },
- target: a,
- },
- compile::Test {
- compiler: Compiler { host: a, stage: 2 },
- target: a,
- },
- compile::Test {
- compiler: Compiler { host: a, stage: 1 },
- target: b,
- },
- compile::Test {
- compiler: Compiler { host: a, stage: 2 },
- target: b,
- },
- ]);
- assert_eq!(first(builder.cache.all::<compile::Assemble>()), &[
- compile::Assemble {
- target_compiler: Compiler { host: a, stage: 0 },
- },
- compile::Assemble {
- target_compiler: Compiler { host: a, stage: 1 },
- },
- compile::Assemble {
- target_compiler: Compiler { host: a, stage: 2 },
- },
- compile::Assemble {
- target_compiler: Compiler { host: b, stage: 2 },
- },
- ]);
+ assert_eq!(
+ first(builder.cache.all::<compile::Std>()),
+ &[
+ compile::Std {
+ compiler: Compiler { host: a, stage: 0 },
+ target: a,
+ },
+ compile::Std {
+ compiler: Compiler { host: a, stage: 1 },
+ target: a,
+ },
+ compile::Std {
+ compiler: Compiler { host: a, stage: 2 },
+ target: a,
+ },
+ compile::Std {
+ compiler: Compiler { host: a, stage: 1 },
+ target: b,
+ },
+ compile::Std {
+ compiler: Compiler { host: a, stage: 2 },
+ target: b,
+ },
+ ]
+ );
+ assert_eq!(
+ first(builder.cache.all::<compile::Test>()),
+ &[
+ compile::Test {
+ compiler: Compiler { host: a, stage: 0 },
+ target: a,
+ },
+ compile::Test {
+ compiler: Compiler { host: a, stage: 1 },
+ target: a,
+ },
+ compile::Test {
+ compiler: Compiler { host: a, stage: 2 },
+ target: a,
+ },
+ compile::Test {
+ compiler: Compiler { host: a, stage: 1 },
+ target: b,
+ },
+ compile::Test {
+ compiler: Compiler { host: a, stage: 2 },
+ target: b,
+ },
+ ]
+ );
+ assert_eq!(
+ first(builder.cache.all::<compile::Assemble>()),
+ &[
+ compile::Assemble {
+ target_compiler: Compiler { host: a, stage: 0 },
+ },
+ compile::Assemble {
+ target_compiler: Compiler { host: a, stage: 1 },
+ },
+ compile::Assemble {
+ target_compiler: Compiler { host: a, stage: 2 },
+ },
+ compile::Assemble {
+ target_compiler: Compiler { host: b, stage: 2 },
+ },
+ ]
+ );
}
#[test]
assert!(!builder.cache.all::<compile::Std>().is_empty());
assert!(!builder.cache.all::<compile::Assemble>().is_empty());
- assert_eq!(first(builder.cache.all::<compile::Rustc>()), &[
- compile::Rustc {
- compiler: Compiler { host: a, stage: 0 },
- target: a,
- },
- compile::Rustc {
- compiler: Compiler { host: a, stage: 1 },
- target: a,
- },
- compile::Rustc {
- compiler: Compiler { host: a, stage: 2 },
- target: a,
- },
- compile::Rustc {
- compiler: Compiler { host: b, stage: 2 },
- target: a,
- },
- compile::Rustc {
- compiler: Compiler { host: a, stage: 0 },
- target: b,
- },
- compile::Rustc {
- compiler: Compiler { host: a, stage: 1 },
- target: b,
- },
- compile::Rustc {
- compiler: Compiler { host: a, stage: 2 },
- target: b,
- },
- compile::Rustc {
- compiler: Compiler { host: b, stage: 2 },
- target: b,
- },
- ]);
-
- assert_eq!(first(builder.cache.all::<compile::Test>()), &[
- compile::Test {
- compiler: Compiler { host: a, stage: 0 },
- target: a,
- },
- compile::Test {
- compiler: Compiler { host: a, stage: 1 },
- target: a,
- },
- compile::Test {
- compiler: Compiler { host: a, stage: 2 },
- target: a,
- },
- compile::Test {
- compiler: Compiler { host: b, stage: 2 },
- target: a,
- },
- compile::Test {
- compiler: Compiler { host: a, stage: 0 },
- target: b,
- },
- compile::Test {
- compiler: Compiler { host: a, stage: 1 },
- target: b,
- },
- compile::Test {
- compiler: Compiler { host: a, stage: 2 },
- target: b,
- },
- compile::Test {
- compiler: Compiler { host: b, stage: 2 },
- target: b,
- },
- compile::Test {
- compiler: Compiler { host: a, stage: 2 },
- target: c,
- },
- compile::Test {
- compiler: Compiler { host: b, stage: 2 },
- target: c,
- },
- ]);
+ assert_eq!(
+ first(builder.cache.all::<compile::Rustc>()),
+ &[
+ compile::Rustc {
+ compiler: Compiler { host: a, stage: 0 },
+ target: a,
+ },
+ compile::Rustc {
+ compiler: Compiler { host: a, stage: 1 },
+ target: a,
+ },
+ compile::Rustc {
+ compiler: Compiler { host: a, stage: 2 },
+ target: a,
+ },
+ compile::Rustc {
+ compiler: Compiler { host: b, stage: 2 },
+ target: a,
+ },
+ compile::Rustc {
+ compiler: Compiler { host: a, stage: 0 },
+ target: b,
+ },
+ compile::Rustc {
+ compiler: Compiler { host: a, stage: 1 },
+ target: b,
+ },
+ compile::Rustc {
+ compiler: Compiler { host: a, stage: 2 },
+ target: b,
+ },
+ compile::Rustc {
+ compiler: Compiler { host: b, stage: 2 },
+ target: b,
+ },
+ ]
+ );
+
+ assert_eq!(
+ first(builder.cache.all::<compile::Test>()),
+ &[
+ compile::Test {
+ compiler: Compiler { host: a, stage: 0 },
+ target: a,
+ },
+ compile::Test {
+ compiler: Compiler { host: a, stage: 1 },
+ target: a,
+ },
+ compile::Test {
+ compiler: Compiler { host: a, stage: 2 },
+ target: a,
+ },
+ compile::Test {
+ compiler: Compiler { host: b, stage: 2 },
+ target: a,
+ },
+ compile::Test {
+ compiler: Compiler { host: a, stage: 0 },
+ target: b,
+ },
+ compile::Test {
+ compiler: Compiler { host: a, stage: 1 },
+ target: b,
+ },
+ compile::Test {
+ compiler: Compiler { host: a, stage: 2 },
+ target: b,
+ },
+ compile::Test {
+ compiler: Compiler { host: b, stage: 2 },
+ target: b,
+ },
+ compile::Test {
+ compiler: Compiler { host: a, stage: 2 },
+ target: c,
+ },
+ compile::Test {
+ compiler: Compiler { host: b, stage: 2 },
+ target: c,
+ },
+ ]
+ );
}
#[test]
let c = INTERNER.intern_str("C");
assert!(!builder.cache.all::<compile::Std>().is_empty());
- assert_eq!(first(builder.cache.all::<compile::Assemble>()), &[
- compile::Assemble {
- target_compiler: Compiler { host: a, stage: 0 },
- },
- compile::Assemble {
- target_compiler: Compiler { host: a, stage: 1 },
- },
- compile::Assemble {
- target_compiler: Compiler { host: b, stage: 1 },
- },
- compile::Assemble {
- target_compiler: Compiler { host: a, stage: 2 },
- },
- compile::Assemble {
- target_compiler: Compiler { host: b, stage: 2 },
- },
- ]);
- assert_eq!(first(builder.cache.all::<compile::Rustc>()), &[
- compile::Rustc {
- compiler: Compiler { host: a, stage: 0 },
- target: a,
- },
- compile::Rustc {
- compiler: Compiler { host: a, stage: 1 },
- target: a,
- },
- compile::Rustc {
- compiler: Compiler { host: a, stage: 0 },
- target: b,
- },
- compile::Rustc {
- compiler: Compiler { host: a, stage: 1 },
- target: b,
- },
- ]);
-
- assert_eq!(first(builder.cache.all::<compile::Test>()), &[
- compile::Test {
- compiler: Compiler { host: a, stage: 0 },
- target: a,
- },
- compile::Test {
- compiler: Compiler { host: a, stage: 1 },
- target: a,
- },
- compile::Test {
- compiler: Compiler { host: a, stage: 2 },
- target: a,
- },
- compile::Test {
- compiler: Compiler { host: b, stage: 2 },
- target: a,
- },
- compile::Test {
- compiler: Compiler { host: a, stage: 0 },
- target: b,
- },
- compile::Test {
- compiler: Compiler { host: a, stage: 1 },
- target: b,
- },
- compile::Test {
- compiler: Compiler { host: a, stage: 2 },
- target: b,
- },
- compile::Test {
- compiler: Compiler { host: b, stage: 2 },
- target: b,
- },
- compile::Test {
- compiler: Compiler { host: a, stage: 2 },
- target: c,
- },
- compile::Test {
- compiler: Compiler { host: b, stage: 2 },
- target: c,
- },
- ]);
+ assert_eq!(
+ first(builder.cache.all::<compile::Assemble>()),
+ &[
+ compile::Assemble {
+ target_compiler: Compiler { host: a, stage: 0 },
+ },
+ compile::Assemble {
+ target_compiler: Compiler { host: a, stage: 1 },
+ },
+ compile::Assemble {
+ target_compiler: Compiler { host: b, stage: 1 },
+ },
+ compile::Assemble {
+ target_compiler: Compiler { host: a, stage: 2 },
+ },
+ compile::Assemble {
+ target_compiler: Compiler { host: b, stage: 2 },
+ },
+ ]
+ );
+ assert_eq!(
+ first(builder.cache.all::<compile::Rustc>()),
+ &[
+ compile::Rustc {
+ compiler: Compiler { host: a, stage: 0 },
+ target: a,
+ },
+ compile::Rustc {
+ compiler: Compiler { host: a, stage: 1 },
+ target: a,
+ },
+ compile::Rustc {
+ compiler: Compiler { host: a, stage: 0 },
+ target: b,
+ },
+ compile::Rustc {
+ compiler: Compiler { host: a, stage: 1 },
+ target: b,
+ },
+ ]
+ );
+
+ assert_eq!(
+ first(builder.cache.all::<compile::Test>()),
+ &[
+ compile::Test {
+ compiler: Compiler { host: a, stage: 0 },
+ target: a,
+ },
+ compile::Test {
+ compiler: Compiler { host: a, stage: 1 },
+ target: a,
+ },
+ compile::Test {
+ compiler: Compiler { host: a, stage: 2 },
+ target: a,
+ },
+ compile::Test {
+ compiler: Compiler { host: b, stage: 2 },
+ target: a,
+ },
+ compile::Test {
+ compiler: Compiler { host: a, stage: 0 },
+ target: b,
+ },
+ compile::Test {
+ compiler: Compiler { host: a, stage: 1 },
+ target: b,
+ },
+ compile::Test {
+ compiler: Compiler { host: a, stage: 2 },
+ target: b,
+ },
+ compile::Test {
+ compiler: Compiler { host: b, stage: 2 },
+ target: b,
+ },
+ compile::Test {
+ compiler: Compiler { host: a, stage: 2 },
+ target: c,
+ },
+ compile::Test {
+ compiler: Compiler { host: b, stage: 2 },
+ target: c,
+ },
+ ]
+ );
}
#[test]
// Ensure we don't build any compiler artifacts.
assert!(builder.cache.all::<compile::Rustc>().is_empty());
- assert_eq!(first(builder.cache.all::<test::Crate>()), &[
- test::Crate {
+ assert_eq!(
+ first(builder.cache.all::<test::Crate>()),
+ &[test::Crate {
compiler: Compiler { host, stage: 0 },
target: host,
mode: Mode::Libstd,
test_kind: test::TestKind::Test,
krate: INTERNER.intern_str("std"),
- },
- ]);
+ },]
+ );
}
}
use getopts::Options;
-use {Build, DocTests};
+use builder::Builder;
use config::Config;
use metadata;
-use builder::Builder;
+use {Build, DocTests};
use cache::{Interned, INTERNER};
impl Flags {
pub fn parse(args: &[String]) -> Flags {
let mut extra_help = String::new();
- let mut subcommand_help = format!("\
+ let mut subcommand_help = format!(
+ "\
Usage: x.py <subcommand> [options] [<paths>...]
Subcommands:
dist Build distribution artifacts
install Install distribution artifacts
-To learn more about a subcommand, run `./x.py <subcommand> -h`");
+To learn more about a subcommand, run `./x.py <subcommand> -h`"
+ );
let mut opts = Options::new();
// Options common to all subcommands
opts.optopt("", "src", "path to the root of the rust checkout", "DIR");
opts.optopt("j", "jobs", "number of jobs to run in parallel", "JOBS");
opts.optflag("h", "help", "print this help message");
- opts.optopt("", "warnings", "if value is deny, will deny warnings, otherwise use default",
- "VALUE");
+ opts.optopt(
+ "",
+ "warnings",
+ "if value is deny, will deny warnings, otherwise use default",
+ "VALUE",
+ );
opts.optopt("", "error-format", "rustc error format", "FORMAT");
// fn usage()
- let usage = |exit_code: i32, opts: &Options, subcommand_help: &str, extra_help: &str| -> ! {
- println!("{}", opts.usage(subcommand_help));
- if !extra_help.is_empty() {
- println!("{}", extra_help);
- }
- process::exit(exit_code);
- };
+ let usage =
+ |exit_code: i32, opts: &Options, subcommand_help: &str, extra_help: &str| -> ! {
+ println!("{}", opts.usage(subcommand_help));
+ if !extra_help.is_empty() {
+ println!("{}", extra_help);
+ }
+ process::exit(exit_code);
+ };
// We can't use getopt to parse the options until we have completed specifying which
// options are valid, but under the current implementation, some options are conditional on
// the subcommand. Therefore we must manually identify the subcommand first, so that we can
// complete the definition of the options. Then we can use the getopt::Matches object from
// there on out.
- let subcommand = args.iter().find(|&s|
+ let subcommand = args.iter().find(|&s| {
(s == "build")
- || (s == "check")
- || (s == "test")
- || (s == "bench")
- || (s == "doc")
- || (s == "clean")
- || (s == "dist")
- || (s == "install"));
+ || (s == "check")
+ || (s == "test")
+ || (s == "bench")
+ || (s == "doc")
+ || (s == "clean")
+ || (s == "dist")
+ || (s == "install")
+ });
let subcommand = match subcommand {
Some(s) => s,
None => {
// Some subcommands get extra options
match subcommand.as_str() {
- "test" => {
+ "test" => {
opts.optflag("", "no-fail-fast", "Run all tests regardless of failure");
opts.optmulti("", "test-args", "extra arguments", "ARGS");
opts.optmulti(
);
opts.optflag("", "no-doc", "do not run doc tests");
opts.optflag("", "doc", "only run doc tests");
- opts.optflag("", "bless", "update all stderr/stdout files of failing ui tests");
- opts.optopt("", "compare-mode", "mode describing what file the actual ui output will be compared to", "COMPARE MODE");
- },
- "bench" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); },
- "clean" => { opts.optflag("", "all", "clean all build artifacts"); },
- _ => { },
+ opts.optflag(
+ "",
+ "bless",
+ "update all stderr/stdout files of failing ui tests",
+ );
+ opts.optopt(
+ "",
+ "compare-mode",
+ "mode describing what file the actual ui output will be compared to",
+ "COMPARE MODE",
+ );
+ }
+ "bench" => {
+ opts.optmulti("", "test-args", "extra arguments", "ARGS");
+ }
+ "clean" => {
+ opts.optflag("", "all", "clean all build artifacts");
+ }
+ _ => {}
};
// Done specifying what options are possible, so do the getopts parsing
if check_subcommand != subcommand {
pass_sanity_check = false;
}
- },
+ }
None => {
pass_sanity_check = false;
}
}
if !pass_sanity_check {
println!("{}\n", subcommand_help);
- println!("Sorry, I couldn't figure out which subcommand you were trying to specify.\n\
- You may need to move some options to after the subcommand.\n");
+ println!(
+ "Sorry, I couldn't figure out which subcommand you were trying to specify.\n\
+ You may need to move some options to after the subcommand.\n"
+ );
process::exit(1);
}
// Extra help text for some commands
match subcommand.as_str() {
"build" => {
- subcommand_help.push_str("\n
+ subcommand_help.push_str(
+ "\n
Arguments:
This subcommand accepts a number of paths to directories to the crates
and/or artifacts to compile. For example:
This will first build everything once (like --stage 0 without further
arguments would), and then use the compiler built in stage 0 to build
src/libtest and its dependencies.
- Once this is done, build/$ARCH/stage1 contains a usable compiler.");
+ Once this is done, build/$ARCH/stage1 contains a usable compiler.",
+ );
}
"check" => {
- subcommand_help.push_str("\n
+ subcommand_help.push_str(
+ "\n
Arguments:
This subcommand accepts a number of paths to directories to the crates
and/or artifacts to compile. For example:
also that since we use `cargo check`, by default this will automatically enable incremental
compilation, so there's no need to pass it separately, though it won't hurt. We also completely
ignore the stage passed, as there's no way to compile in non-stage 0 without actually building
- the compiler.");
+ the compiler.",
+ );
}
"test" => {
- subcommand_help.push_str("\n
+ subcommand_help.push_str(
+ "\n
Arguments:
This subcommand accepts a number of paths to directories to tests that
should be compiled and run. For example:
compiled and tested.
./x.py test
- ./x.py test --stage 1");
+ ./x.py test --stage 1",
+ );
}
"doc" => {
- subcommand_help.push_str("\n
+ subcommand_help.push_str(
+ "\n
Arguments:
This subcommand accepts a number of paths to directories of documentation
to build. For example:
If no arguments are passed then everything is documented:
./x.py doc
- ./x.py doc --stage 1");
+ ./x.py doc --stage 1",
+ );
}
- _ => { }
+ _ => {}
};
// Get any optional paths which occur after the subcommand
- let paths = matches.free[1..].iter().map(|p| p.into()).collect::<Vec<PathBuf>>();
+ let paths = matches.free[1..]
+ .iter()
+ .map(|p| p.into())
+ .collect::<Vec<PathBuf>>();
let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| {
if fs::metadata("config.toml").is_ok() {
let maybe_rules_help = Builder::get_help(&build, subcommand.as_str());
extra_help.push_str(maybe_rules_help.unwrap_or_default().as_str());
} else if subcommand.as_str() != "clean" {
- extra_help.push_str(format!(
- "Run `./x.py {} -h -v` to see a list of available paths.",
- subcommand).as_str());
+ extra_help.push_str(
+ format!(
+ "Run `./x.py {} -h -v` to see a list of available paths.",
+ subcommand
+ ).as_str(),
+ );
}
// User passed in -h/--help?
}
let cmd = match subcommand.as_str() {
- "build" => {
- Subcommand::Build { paths: paths }
- }
- "check" => {
- Subcommand::Check { paths: paths }
- }
- "test" => {
- Subcommand::Test {
- paths,
- bless: matches.opt_present("bless"),
- compare_mode: matches.opt_str("compare-mode"),
- test_args: matches.opt_strs("test-args"),
- rustc_args: matches.opt_strs("rustc-args"),
- fail_fast: !matches.opt_present("no-fail-fast"),
- doc_tests: if matches.opt_present("doc") {
- DocTests::Only
- } else if matches.opt_present("no-doc") {
- DocTests::No
- } else {
- DocTests::Yes
- }
- }
- }
- "bench" => {
- Subcommand::Bench {
- paths,
- test_args: matches.opt_strs("test-args"),
- }
- }
- "doc" => {
- Subcommand::Doc { paths: paths }
- }
+ "build" => Subcommand::Build { paths: paths },
+ "check" => Subcommand::Check { paths: paths },
+ "test" => Subcommand::Test {
+ paths,
+ bless: matches.opt_present("bless"),
+ compare_mode: matches.opt_str("compare-mode"),
+ test_args: matches.opt_strs("test-args"),
+ rustc_args: matches.opt_strs("rustc-args"),
+ fail_fast: !matches.opt_present("no-fail-fast"),
+ doc_tests: if matches.opt_present("doc") {
+ DocTests::Only
+ } else if matches.opt_present("no-doc") {
+ DocTests::No
+ } else {
+ DocTests::Yes
+ },
+ },
+ "bench" => Subcommand::Bench {
+ paths,
+ test_args: matches.opt_strs("test-args"),
+ },
+ "doc" => Subcommand::Doc { paths: paths },
"clean" => {
if paths.len() > 0 {
println!("\nclean does not take a path argument\n");
all: matches.opt_present("all"),
}
}
- "dist" => {
- Subcommand::Dist {
- paths,
- }
- }
- "install" => {
- Subcommand::Install {
- paths,
- }
- }
+ "dist" => Subcommand::Dist { paths },
+ "install" => Subcommand::Install { paths },
_ => {
usage(1, &opts, &subcommand_help, &extra_help);
}
};
-
Flags {
verbose: matches.opt_count("verbose"),
stage: matches.opt_str("stage").map(|j| j.parse().unwrap()),
rustc_error_format: matches.opt_str("error-format"),
keep_stage: matches.opt_str("keep-stage").map(|j| j.parse().unwrap()),
host: split(matches.opt_strs("host"))
- .into_iter().map(|x| INTERNER.intern_string(x)).collect::<Vec<_>>(),
+ .into_iter()
+ .map(|x| INTERNER.intern_string(x))
+ .collect::<Vec<_>>(),
target: split(matches.opt_strs("target"))
- .into_iter().map(|x| INTERNER.intern_string(x)).collect::<Vec<_>>(),
+ .into_iter()
+ .map(|x| INTERNER.intern_string(x))
+ .collect::<Vec<_>>(),
config: cfg_file,
jobs: matches.opt_str("jobs").map(|j| j.parse().unwrap()),
cmd,
incremental: matches.opt_present("incremental"),
exclude: split(matches.opt_strs("exclude"))
- .into_iter().map(|p| p.into()).collect::<Vec<_>>(),
+ .into_iter()
+ .map(|p| p.into())
+ .collect::<Vec<_>>(),
warnings: matches.opt_str("warnings").map(|v| v == "deny"),
}
}
impl Subcommand {
pub fn test_args(&self) -> Vec<&str> {
match *self {
- Subcommand::Test { ref test_args, .. } |
- Subcommand::Bench { ref test_args, .. } => {
- test_args.iter().flat_map(|s| s.split_whitespace()).collect()
+ Subcommand::Test { ref test_args, .. } | Subcommand::Bench { ref test_args, .. } => {
+ test_args
+ .iter()
+ .flat_map(|s| s.split_whitespace())
+ .collect()
}
_ => Vec::new(),
}
pub fn rustc_args(&self) -> Vec<&str> {
match *self {
- Subcommand::Test { ref rustc_args, .. } => {
- rustc_args.iter().flat_map(|s| s.split_whitespace()).collect()
- }
+ Subcommand::Test { ref rustc_args, .. } => rustc_args
+ .iter()
+ .flat_map(|s| s.split_whitespace())
+ .collect(),
_ => Vec::new(),
}
}
pub fn compare_mode(&self) -> Option<&str> {
match *self {
- Subcommand::Test { ref compare_mode, .. } => compare_mode.as_ref().map(|s| &s[..]),
+ Subcommand::Test {
+ ref compare_mode, ..
+ } => compare_mode.as_ref().map(|s| &s[..]),
_ => None,
}
}
}
fn split(s: Vec<String>) -> Vec<String> {
- s.iter().flat_map(|s| s.split(',')).map(|s| s.to_string()).collect()
+ s.iter()
+ .flat_map(|s| s.split(','))
+ .map(|s| s.to_string())
+ .collect()
}
use std::env;
use std::ffi::OsString;
-use std::iter;
use std::fmt;
use std::fs::{self, File};
-use std::path::{PathBuf, Path};
-use std::process::Command;
use std::io::Read;
+use std::iter;
+use std::path::{Path, PathBuf};
+use std::process::Command;
use build_helper::{self, output};
-use builder::{Kind, RunConfig, ShouldRun, Builder, Compiler, Step};
-use Crate as CargoCrate;
-use cache::{INTERNER, Interned};
+use builder::{Builder, Compiler, Kind, RunConfig, ShouldRun, Step};
+use cache::{Interned, INTERNER};
use compile;
use dist;
+use flags::Subcommand;
use native;
use tool::{self, Tool};
-use util::{self, dylib_path, dylib_path_var};
-use {Mode, DocTests};
use toolstate::ToolState;
-use flags::Subcommand;
+use util::{self, dylib_path, dylib_path_var};
+use Crate as CargoCrate;
+use {DocTests, Mode};
const ADB_TEST_DIR: &str = "/data/tmp/work";
match kind {
Kind::Test => TestKind::Test,
Kind::Bench => TestKind::Bench,
- _ => panic!("unexpected kind in crate: {:?}", kind)
+ _ => panic!("unexpected kind in crate: {:?}", kind),
}
}
}
builder.default_doc(None);
let _time = util::timeit(&builder);
- try_run(builder, builder.tool_cmd(Tool::Linkchecker)
- .arg(builder.out.join(host).join("doc")));
+ try_run(
+ builder,
+ builder
+ .tool_cmd(Tool::Linkchecker)
+ .arg(builder.out.join(host).join("doc")),
+ );
}
fn should_run(run: ShouldRun) -> ShouldRun {
let builder = run.builder;
- run.path("src/tools/linkchecker").default_condition(builder.config.docs)
+ run.path("src/tools/linkchecker")
+ .default_condition(builder.config.docs)
}
fn make_run(run: RunConfig) {
/// test` to ensure that we don't regress the test suites there.
fn run(self, builder: &Builder) {
let compiler = builder.compiler(self.stage, self.host);
- builder.ensure(compile::Rustc { compiler, target: compiler.host });
+ builder.ensure(compile::Rustc {
+ compiler,
+ target: compiler.host,
+ });
// Note that this is a short, cryptic, and not scoped directory name. This
// is currently to minimize the length of path on Windows where we otherwise
let _time = util::timeit(&builder);
let mut cmd = builder.tool_cmd(Tool::CargoTest);
- try_run(builder, cmd.arg(&builder.initial_cargo)
- .arg(&out_dir)
- .env("RUSTC", builder.rustc(compiler))
- .env("RUSTDOC", builder.rustdoc(compiler.host)));
+ try_run(
+ builder,
+ cmd.arg(&builder.initial_cargo)
+ .arg(&out_dir)
+ .env("RUSTC", builder.rustc(compiler))
+ .env("RUSTDOC", builder.rustdoc(compiler.host)),
+ );
}
}
fn run(self, builder: &Builder) {
let compiler = builder.compiler(self.stage, self.host);
- builder.ensure(tool::Cargo { compiler, target: self.host });
+ builder.ensure(tool::Cargo {
+ compiler,
+ target: self.host,
+ });
let mut cargo = builder.cargo(compiler, Mode::Tool, self.host, "test");
- cargo.arg("--manifest-path").arg(builder.src.join("src/tools/cargo/Cargo.toml"));
+ cargo
+ .arg("--manifest-path")
+ .arg(builder.src.join("src/tools/cargo/Cargo.toml"));
if !builder.fail_fast {
cargo.arg("--no-fail-fast");
}
// available.
cargo.env("CFG_DISABLE_CROSS_TESTS", "1");
- try_run(builder, cargo.env("PATH", &path_for_cargo(builder, compiler)));
+ try_run(
+ builder,
+ cargo.env("PATH", &path_for_cargo(builder, compiler)),
+ );
}
}
return;
}
- let mut cargo = tool::prepare_tool_cargo(builder,
- compiler,
- host,
- "test",
- "src/tools/rls");
+ let mut cargo = tool::prepare_tool_cargo(builder, compiler, host, "test", "src/tools/rls");
// Don't build tests dynamically, just a pain to work with
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
return;
}
- let mut cargo = tool::prepare_tool_cargo(builder,
- compiler,
- host,
- "test",
- "src/tools/rustfmt");
+ let mut cargo =
+ tool::prepare_tool_cargo(builder, compiler, host, "test", "src/tools/rustfmt");
// Don't build tests dynamically, just a pain to work with
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
});
if let Some(miri) = miri {
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
- cargo.arg("--manifest-path").arg(builder.src.join("src/tools/miri/Cargo.toml"));
+ cargo
+ .arg("--manifest-path")
+ .arg(builder.src.join("src/tools/miri/Cargo.toml"));
// Don't build tests dynamically, just a pain to work with
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
});
if let Some(clippy) = clippy {
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
- cargo.arg("--manifest-path").arg(builder.src.join("src/tools/clippy/Cargo.toml"));
+ cargo
+ .arg("--manifest-path")
+ .arg(builder.src.join("src/tools/clippy/Cargo.toml"));
// Don't build tests dynamically, just a pain to work with
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
cargo.env("SYSROOT", builder.sysroot(compiler));
cargo.env("RUSTC_TEST_SUITE", builder.rustc(compiler));
cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler));
- let host_libs = builder.stage_out(compiler, Mode::Tool).join(builder.cargo_dir());
+ let host_libs = builder
+ .stage_out(compiler, Mode::Tool)
+ .join(builder.cargo_dir());
cargo.env("HOST_LIBS", host_libs);
// clippy tests need to find the driver
cargo.env("CLIPPY_DRIVER_PATH", clippy);
fn make_run(run: RunConfig) {
let compiler = run.builder.compiler(run.builder.top_stage, run.host);
- run.builder.ensure(RustdocTheme {
- compiler: compiler,
- });
+ run.builder.ensure(RustdocTheme { compiler: compiler });
}
fn run(self, builder: &Builder) {
let rustdoc = builder.out.join("bootstrap/debug/rustdoc");
let mut cmd = builder.tool_cmd(Tool::RustdocTheme);
cmd.arg(rustdoc.to_str().unwrap())
- .arg(builder.src.join("src/librustdoc/html/static/themes").to_str().unwrap())
- .env("RUSTC_STAGE", self.compiler.stage.to_string())
- .env("RUSTC_SYSROOT", builder.sysroot(self.compiler))
- .env("RUSTDOC_LIBDIR", builder.sysroot_libdir(self.compiler, self.compiler.host))
- .env("CFG_RELEASE_CHANNEL", &builder.config.channel)
- .env("RUSTDOC_REAL", builder.rustdoc(self.compiler.host))
- .env("RUSTDOC_CRATE_VERSION", builder.rust_version())
- .env("RUSTC_BOOTSTRAP", "1");
+ .arg(
+ builder
+ .src
+ .join("src/librustdoc/html/static/themes")
+ .to_str()
+ .unwrap(),
+ )
+ .env("RUSTC_STAGE", self.compiler.stage.to_string())
+ .env("RUSTC_SYSROOT", builder.sysroot(self.compiler))
+ .env(
+ "RUSTDOC_LIBDIR",
+ builder.sysroot_libdir(self.compiler, self.compiler.host),
+ )
+ .env("CFG_RELEASE_CHANNEL", &builder.config.channel)
+ .env("RUSTDOC_REAL", builder.rustdoc(self.compiler.host))
+ .env("RUSTDOC_CRATE_VERSION", builder.rust_version())
+ .env("RUSTC_BOOTSTRAP", "1");
if let Some(linker) = builder.linker(self.compiler.host) {
cmd.env("RUSTC_TARGET_LINKER", linker);
}
});
builder.run(&mut command);
} else {
- builder.info(&format!("No nodejs found, skipping \"src/test/rustdoc-js\" tests"));
+ builder.info(&format!(
+ "No nodejs found, skipping \"src/test/rustdoc-js\" tests"
+ ));
}
}
}
builder.ensure(dist::DebuggerScripts {
sysroot: builder.sysroot(compiler),
- host: target
+ host: target,
});
}
// FIXME: Does pretty need librustc compiled? Note that there are
// fulldeps test suites with mode = pretty as well.
mode == "pretty" ||
- mode == "rustdoc" {
+ mode == "rustdoc"
+ {
builder.ensure(compile::Rustc { compiler, target });
}
// compiletest currently has... a lot of arguments, so let's just pass all
// of them!
- cmd.arg("--compile-lib-path").arg(builder.rustc_libdir(compiler));
- cmd.arg("--run-lib-path").arg(builder.sysroot_libdir(compiler, target));
+ cmd.arg("--compile-lib-path")
+ .arg(builder.rustc_libdir(compiler));
+ cmd.arg("--run-lib-path")
+ .arg(builder.sysroot_libdir(compiler, target));
cmd.arg("--rustc-path").arg(builder.rustc(compiler));
let is_rustdoc_ui = suite.ends_with("rustdoc-ui");
// Avoid depending on rustdoc when we don't need it.
- if mode == "rustdoc" ||
- (mode == "run-make" && suite.ends_with("fulldeps")) ||
- (mode == "ui" && is_rustdoc_ui) {
- cmd.arg("--rustdoc-path").arg(builder.rustdoc(compiler.host));
+ if mode == "rustdoc"
+ || (mode == "run-make" && suite.ends_with("fulldeps"))
+ || (mode == "ui" && is_rustdoc_ui)
+ {
+ cmd.arg("--rustdoc-path")
+ .arg(builder.rustdoc(compiler.host));
}
- cmd.arg("--src-base").arg(builder.src.join("src/test").join(suite));
- cmd.arg("--build-base").arg(testdir(builder, compiler.host).join(suite));
- cmd.arg("--stage-id").arg(format!("stage{}-{}", compiler.stage, target));
+ cmd.arg("--src-base")
+ .arg(builder.src.join("src/test").join(suite));
+ cmd.arg("--build-base")
+ .arg(testdir(builder, compiler.host).join(suite));
+ cmd.arg("--stage-id")
+ .arg(format!("stage{}-{}", compiler.stage, target));
cmd.arg("--mode").arg(mode);
cmd.arg("--target").arg(target);
cmd.arg("--host").arg(&*compiler.host);
- cmd.arg("--llvm-filecheck").arg(builder.llvm_filecheck(builder.config.build));
+ cmd.arg("--llvm-filecheck")
+ .arg(builder.llvm_filecheck(builder.config.build));
if builder.config.cmd.bless() {
cmd.arg("--bless");
cmd.arg("--host-rustcflags").arg(hostflags.join(" "));
let mut targetflags = flags.clone();
- targetflags.push(format!("-Lnative={}",
- builder.test_helpers_out(target).display()));
+ targetflags.push(format!(
+ "-Lnative={}",
+ builder.test_helpers_out(target).display()
+ ));
cmd.arg("--target-rustcflags").arg(targetflags.join(" "));
cmd.arg("--docck-python").arg(builder.python());
// Get paths from cmd args
let paths = match &builder.config.cmd {
- Subcommand::Test { ref paths, ..} => &paths[..],
- _ => &[]
+ Subcommand::Test { ref paths, .. } => &paths[..],
+ _ => &[],
};
// Get test-args by striping suite path
- let mut test_args: Vec<&str> = paths.iter().filter(|p| p.starts_with(suite_path) &&
- p.is_file()).map(|p| p.strip_prefix(suite_path).unwrap().to_str().unwrap()).collect();
+ let mut test_args: Vec<&str> = paths
+ .iter()
+ .filter(|p| p.starts_with(suite_path) && p.is_file())
+ .map(|p| p.strip_prefix(suite_path).unwrap().to_str().unwrap())
+ .collect();
test_args.append(&mut builder.config.cmd.test_args());
if !builder.config.dry_run && suite == "run-make-fulldeps" {
let llvm_components = output(Command::new(&llvm_config).arg("--components"));
let llvm_cxxflags = output(Command::new(&llvm_config).arg("--cxxflags"));
- cmd.arg("--cc").arg(builder.cc(target))
- .arg("--cxx").arg(builder.cxx(target).unwrap())
- .arg("--cflags").arg(builder.cflags(target).join(" "))
- .arg("--llvm-components").arg(llvm_components.trim())
- .arg("--llvm-cxxflags").arg(llvm_cxxflags.trim());
+ cmd.arg("--cc")
+ .arg(builder.cc(target))
+ .arg("--cxx")
+ .arg(builder.cxx(target).unwrap())
+ .arg("--cflags")
+ .arg(builder.cflags(target).join(" "))
+ .arg("--llvm-components")
+ .arg(llvm_components.trim())
+ .arg("--llvm-cxxflags")
+ .arg(llvm_cxxflags.trim());
if let Some(ar) = builder.ar(target) {
cmd.arg("--ar").arg(ar);
}
}
}
if suite == "run-make-fulldeps" && !builder.config.llvm_enabled {
- builder.info(
- &format!("Ignoring run-make test suite as they generally don't work without LLVM"));
+ builder.info(&format!(
+ "Ignoring run-make test suite as they generally don't work without LLVM"
+ ));
return;
}
if suite != "run-make-fulldeps" {
- cmd.arg("--cc").arg("")
- .arg("--cxx").arg("")
- .arg("--cflags").arg("")
- .arg("--llvm-components").arg("")
- .arg("--llvm-cxxflags").arg("");
+ cmd.arg("--cc")
+ .arg("")
+ .arg("--cxx")
+ .arg("")
+ .arg("--cflags")
+ .arg("")
+ .arg("--llvm-components")
+ .arg("")
+ .arg("--llvm-cxxflags")
+ .arg("");
}
if builder.remote_tested(target) {
- cmd.arg("--remote-test-client").arg(builder.tool_exe(Tool::RemoteTestClient));
+ cmd.arg("--remote-test-client")
+ .arg(builder.tool_exe(Tool::RemoteTestClient));
}
// Running a C compiler on MSVC requires a few env vars to be set, to be
if target.contains("android") {
// Assume that cc for this target comes from the android sysroot
cmd.arg("--android-cross-path")
- .arg(builder.cc(target).parent().unwrap().parent().unwrap());
+ .arg(builder.cc(target).parent().unwrap().parent().unwrap());
} else {
cmd.arg("--android-cross-path").arg("");
}
builder.ci_env.force_coloring_in_ci(&mut cmd);
let _folder = builder.fold_output(|| format!("test_{}", suite));
- builder.info(&format!("Check compiletest suite={} mode={} ({} -> {})",
- suite, mode, &compiler.host, target));
+ builder.info(&format!(
+ "Check compiletest suite={} mode={} ({} -> {})",
+ suite, mode, &compiler.host, target
+ ));
let _time = util::timeit(&builder);
try_run(builder, &mut cmd);
if let Some(compare_mode) = compare_mode {
cmd.arg("--compare-mode").arg(compare_mode);
let _folder = builder.fold_output(|| format!("test_{}_{}", suite, compare_mode));
- builder.info(&format!("Check compiletest suite={} mode={} compare_mode={} ({} -> {})",
- suite, mode, compare_mode, &compiler.host, target));
+ builder.info(&format!(
+ "Check compiletest suite={} mode={} compare_mode={} ({} -> {})",
+ suite, mode, compare_mode, &compiler.host, target
+ ));
let _time = util::timeit(&builder);
try_run(builder, &mut cmd);
}
fn run(self, builder: &Builder) {
let compiler = self.compiler;
- builder.ensure(compile::Test { compiler, target: compiler.host });
+ 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`
while let Some(p) = stack.pop() {
if p.is_dir() {
stack.extend(t!(p.read_dir()).map(|p| t!(p).path()));
- continue
+ continue;
}
if p.extension().and_then(|s| s.to_str()) != Some("md") {
fn run(self, builder: &Builder) {
let compiler = self.compiler;
- builder.ensure(compile::Std { compiler, target: compiler.host });
+ builder.ensure(compile::Std {
+ compiler,
+ target: compiler.host,
+ });
let dir = testdir(builder, compiler.host);
t!(fs::create_dir_all(&dir));
.env("CFG_BUILD", &builder.config.build)
.env("RUSTC_ERROR_METADATA_DST", builder.extended_error_dir());
-
let _folder = builder.fold_output(|| "test_error_index");
builder.info(&format!("Testing error-index stage{}", compiler.stage));
let _time = util::timeit(&builder);
return true;
}
}
- Err(_) => {},
+ Err(_) => {}
}
builder.info(&format!("doc tests for: {}", markdown.display()));
}
}
-
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Crate {
pub compiler: Compiler,
let builder = run.builder;
run = run.krate("test");
for krate in run.builder.in_tree_crates("std") {
- if krate.is_local(&run.builder) &&
- !krate.name.contains("jemalloc") &&
- !(krate.name.starts_with("rustc_") && krate.name.ends_with("san")) &&
- krate.name != "dlmalloc" {
+ if krate.is_local(&run.builder)
+ && !krate.name.contains("jemalloc")
+ && !(krate.name.starts_with("rustc_") && krate.name.ends_with("san"))
+ && krate.name != "dlmalloc"
+ {
run = run.path(krate.local_path(&builder).to_str().unwrap());
}
}
}
if target.contains("emscripten") {
- cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target)),
- builder.config.nodejs.as_ref().expect("nodejs not configured"));
+ cargo.env(
+ format!("CARGO_TARGET_{}_RUNNER", envify(&target)),
+ builder
+ .config
+ .nodejs
+ .as_ref()
+ .expect("nodejs not configured"),
+ );
} else if target.starts_with("wasm32") {
// Warn about running tests without the `wasm_syscall` feature enabled.
// The javascript shim implements the syscall interface so that test
// output can be correctly reported.
if !builder.config.wasm_syscall {
- builder.info(&format!("Libstd was built without `wasm_syscall` feature enabled: \
- test output may not be visible."));
+ builder.info(&format!(
+ "Libstd was built without `wasm_syscall` feature enabled: \
+ test output may not be visible."
+ ));
}
// On the wasm32-unknown-unknown target we're using LTO which is
// incompatible with `-C prefer-dynamic`, so disable that here
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
- let node = builder.config.nodejs.as_ref()
+ let node = builder
+ .config
+ .nodejs
+ .as_ref()
.expect("nodejs not configured");
- let runner = format!("{} {}/src/etc/wasm32-shim.js",
- node.display(),
- builder.src.display());
+ let runner = format!(
+ "{} {}/src/etc/wasm32-shim.js",
+ node.display(),
+ builder.src.display()
+ );
cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target)), &runner);
} else if builder.remote_tested(target) {
- cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target)),
- format!("{} run",
- builder.tool_exe(Tool::RemoteTestClient).display()));
+ cargo.env(
+ format!("CARGO_TARGET_{}_RUNNER", envify(&target)),
+ format!("{} run", builder.tool_exe(Tool::RemoteTestClient).display()),
+ );
}
let _folder = builder.fold_output(|| {
- format!("{}_stage{}-{}", test_kind.subcommand(), compiler.stage, krate)
+ format!(
+ "{}_stage{}-{}",
+ test_kind.subcommand(),
+ compiler.stage,
+ krate
+ )
});
- builder.info(&format!("{} {} stage{} ({} -> {})", test_kind, krate, compiler.stage,
- &compiler.host, target));
+ builder.info(&format!(
+ "{} {} stage{} ({} -> {})",
+ test_kind, krate, compiler.stage, &compiler.host, target
+ ));
let _time = util::timeit(&builder);
try_run(builder, &mut cargo);
}
let compiler = builder.compiler(builder.top_stage, self.host);
let target = compiler.host;
- let mut cargo = tool::prepare_tool_cargo(builder,
- compiler,
- target,
- test_kind.subcommand(),
- "src/tools/rustdoc");
+ let mut cargo = tool::prepare_tool_cargo(
+ builder,
+ compiler,
+ target,
+ test_kind.subcommand(),
+ "src/tools/rustdoc",
+ );
if test_kind.subcommand() == "test" && !builder.fail_fast {
cargo.arg("--no-fail-fast");
}
cargo.arg("--quiet");
}
- let _folder = builder.fold_output(|| {
- format!("{}_stage{}-rustdoc", test_kind.subcommand(), compiler.stage)
- });
- builder.info(&format!("{} rustdoc stage{} ({} -> {})", test_kind, compiler.stage,
- &compiler.host, target));
+ let _folder = builder
+ .fold_output(|| format!("{}_stage{}-rustdoc", test_kind.subcommand(), compiler.stage));
+ builder.info(&format!(
+ "{} rustdoc stage{} ({} -> {})",
+ test_kind, compiler.stage, &compiler.host, target
+ ));
let _time = util::timeit(&builder);
try_run(builder, &mut cargo);
}
fn envify(s: &str) -> String {
- s.chars().map(|c| {
- match c {
+ s.chars()
+ .map(|c| match c {
'-' => '_',
c => c,
- }
- }).flat_map(|c| c.to_uppercase()).collect()
+ })
+ .flat_map(|c| c.to_uppercase())
+ .collect()
}
/// Some test suites are run inside emulators or on remote devices, and most
let compiler = self.compiler;
let target = self.target;
if !builder.remote_tested(target) {
- return
+ return;
}
builder.ensure(compile::Test { compiler, target });
let tool = builder.tool_exe(Tool::RemoteTestClient);
let mut cmd = Command::new(&tool);
cmd.arg("spawn-emulator")
- .arg(target)
- .arg(&server)
- .arg(builder.out.join("tmp"));
+ .arg(target)
+ .arg(&server)
+ .arg(builder.out.join("tmp"));
if let Some(rootfs) = builder.qemu_rootfs(target) {
cmd.arg(rootfs);
}
let f = t!(f);
let name = f.file_name().into_string().unwrap();
if util::is_dylib(&name) {
- builder.run(Command::new(&tool)
- .arg("push")
- .arg(f.path()));
+ builder.run(Command::new(&tool).arg("push").arg(f.path()));
}
}
}
let mut cmd = Command::new("tar");
cmd.arg("-xzf")
- .arg(builder.ensure(dist::PlainSourceTarball))
- .arg("--strip-components=1")
- .current_dir(&dir);
+ .arg(builder.ensure(dist::PlainSourceTarball))
+ .arg("--strip-components=1")
+ .current_dir(&dir);
builder.run(&mut cmd);
- builder.run(Command::new("./configure")
- .args(&builder.config.configure_args)
- .arg("--enable-vendor")
- .current_dir(&dir));
- builder.run(Command::new(build_helper::make(&builder.config.build))
- .arg("check")
- .current_dir(&dir));
+ builder.run(
+ Command::new("./configure")
+ .args(&builder.config.configure_args)
+ .arg("--enable-vendor")
+ .current_dir(&dir),
+ );
+ builder.run(
+ Command::new(build_helper::make(&builder.config.build))
+ .arg("check")
+ .current_dir(&dir),
+ );
// Now make sure that rust-src has all of libstd's dependencies
builder.info(&format!("Distcheck rust-src"));
let mut cmd = Command::new("tar");
cmd.arg("-xzf")
- .arg(builder.ensure(dist::Src))
- .arg("--strip-components=1")
- .current_dir(&dir);
+ .arg(builder.ensure(dist::Src))
+ .arg("--strip-components=1")
+ .current_dir(&dir);
builder.run(&mut cmd);
let toml = dir.join("rust-src/lib/rustlib/src/rust/src/libstd/Cargo.toml");
- builder.run(Command::new(&builder.initial_cargo)
- .arg("generate-lockfile")
- .arg("--manifest-path")
- .arg(&toml)
- .current_dir(&dir));
+ builder.run(
+ Command::new(&builder.initial_cargo)
+ .arg("generate-lockfile")
+ .arg("--manifest-path")
+ .arg(&toml)
+ .current_dir(&dir),
+ );
}
}
fn run(self, builder: &Builder) {
let mut cmd = Command::new(&builder.initial_cargo);
cmd.arg("test")
- .current_dir(builder.src.join("src/bootstrap"))
- .env("RUSTFLAGS", "-Cdebuginfo=2")
- .env("CARGO_TARGET_DIR", builder.out.join("bootstrap"))
- .env("RUSTC_BOOTSTRAP", "1")
- .env("RUSTC", &builder.initial_rustc);
+ .current_dir(builder.src.join("src/bootstrap"))
+ .env("RUSTFLAGS", "-Cdebuginfo=2")
+ .env("CARGO_TARGET_DIR", builder.out.join("bootstrap"))
+ .env("RUSTC_BOOTSTRAP", "1")
+ .env("RUSTC", &builder.initial_rustc);
if let Some(flags) = option_env!("RUSTFLAGS") {
// Use the same rustc flags for testing as for "normal" compilation,
// so that Cargo doesn’t recompile the entire dependency graph every time: