Skip to content

Commit

Permalink
Auto merge of #33597 - eddyb:rollup, r=eddyb
Browse files Browse the repository at this point in the history
Rollup of 23 pull requests

- Successful merges: #33282, #33342, #33393, #33450, #33513, #33517, #33531, #33532, #33533, #33534, #33538, #33541, #33544, #33552, #33555, #33560, #33563, #33565, #33566, #33572, #33580, #33590, #33596
- Failed merges: #33578
  • Loading branch information
bors committed May 12, 2016
2 parents e88defe + dbd5968 commit 2c5ce8c
Show file tree
Hide file tree
Showing 72 changed files with 2,637 additions and 2,147 deletions.
79 changes: 77 additions & 2 deletions src/bootstrap/build/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
//! This file implements the various regression test suites that we execute on
//! our CI.

use std::fs;
use std::env;
use std::fs::{self, File};
use std::io::prelude::*;
use std::path::{PathBuf, Path};
use std::process::Command;

use build_helper::output;
use bootstrap::{dylib_path, dylib_path_var};

use build::{Build, Compiler};
use build::{Build, Compiler, Mode};

/// Runs the `linkchecker` tool as compiled in `stage` by the `host` compiler.
///
Expand Down Expand Up @@ -222,3 +225,75 @@ fn markdown_test(build: &Build, compiler: &Compiler, markdown: &Path) {
cmd.arg("--test-args").arg(build.flags.args.join(" "));
build.run(&mut cmd);
}

/// Run all unit tests plus documentation tests for an entire crate DAG defined
/// by a `Cargo.toml`
///
/// This is what runs tests for crates like the standard library, compiler, etc.
/// It essentially is the driver for running `cargo test`.
///
/// Currently this runs all tests for a DAG by passing a bunch of `-p foo`
/// arguments, and those arguments are discovered from `Cargo.lock`.
pub fn krate(build: &Build,
compiler: &Compiler,
target: &str,
mode: Mode) {
let (name, path, features) = match mode {
Mode::Libstd => ("libstd", "src/rustc/std_shim", build.std_features()),
Mode::Libtest => ("libtest", "src/rustc/test_shim", String::new()),
Mode::Librustc => ("librustc", "src/rustc", build.rustc_features()),
_ => panic!("can only test libraries"),
};
println!("Testing {} stage{} ({} -> {})", name, compiler.stage,
compiler.host, target);

// Build up the base `cargo test` command.
let mut cargo = build.cargo(compiler, mode, target, "test");
cargo.arg("--manifest-path")
.arg(build.src.join(path).join("Cargo.toml"))
.arg("--features").arg(features);

// Generate a list of `-p` arguments to pass to the `cargo test` invocation
// by crawling the corresponding Cargo.lock file.
let lockfile = build.src.join(path).join("Cargo.lock");
let mut contents = String::new();
t!(t!(File::open(&lockfile)).read_to_string(&mut contents));
let mut lines = contents.lines();
while let Some(line) = lines.next() {
let prefix = "name = \"";
if !line.starts_with(prefix) {
continue
}
lines.next(); // skip `version = ...`

// skip crates.io or otherwise non-path crates
if let Some(line) = lines.next() {
if line.starts_with("source") {
continue
}
}

let crate_name = &line[prefix.len()..line.len() - 1];

// Right now jemalloc is our only target-specific crate in the sense
// that it's not present on all platforms. Custom skip it here for now,
// but if we add more this probably wants to get more generalized.
if crate_name.contains("jemalloc") {
continue
}

cargo.arg("-p").arg(crate_name);
}

// The tests are going to run with the *target* libraries, so we need to
// ensure that those libraries show up in the LD_LIBRARY_PATH equivalent.
//
// Note that to run the compiler we need to run with the *host* libraries,
// but our wrapper scripts arrange for that to be the case anyway.
let mut dylib_path = dylib_path();
dylib_path.insert(0, build.sysroot_libdir(compiler, target));
cargo.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
cargo.args(&build.flags.args);

build.run(&mut cargo);
}
11 changes: 10 additions & 1 deletion src/bootstrap/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,15 @@ impl Build {
check::compiletest(self, &compiler, target.target,
"run-make", "run-make")
}
CheckCrateStd { compiler } => {
check::krate(self, &compiler, target.target, Mode::Libstd)
}
CheckCrateTest { compiler } => {
check::krate(self, &compiler, target.target, Mode::Libtest)
}
CheckCrateRustc { compiler } => {
check::krate(self, &compiler, target.target, Mode::Librustc)
}

DistDocs { stage } => dist::docs(self, stage, target.target),
DistMingw { _dummy } => dist::mingw(self, target.target),
Expand Down Expand Up @@ -485,6 +494,7 @@ impl Build {
self.config.rust_debug_assertions.to_string())
.env("RUSTC_SNAPSHOT", &self.rustc)
.env("RUSTC_SYSROOT", self.sysroot(compiler))
.env("RUSTC_LIBDIR", self.rustc_libdir(compiler))
.env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_snapshot_libdir())
.env("RUSTC_RPATH", self.config.rust_rpath.to_string())
.env("RUSTDOC", self.out.join("bootstrap/debug/rustdoc"))
Expand Down Expand Up @@ -520,7 +530,6 @@ impl Build {
if self.config.rust_optimize {
cargo.arg("--release");
}
self.add_rustc_lib_path(compiler, &mut cargo);
return cargo
}

Expand Down
15 changes: 15 additions & 0 deletions src/bootstrap/build/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ macro_rules! targets {
(check_docs, CheckDocs { compiler: Compiler<'a> }),
(check_error_index, CheckErrorIndex { compiler: Compiler<'a> }),
(check_rmake, CheckRMake { compiler: Compiler<'a> }),
(check_crate_std, CheckCrateStd { compiler: Compiler<'a> }),
(check_crate_test, CheckCrateTest { compiler: Compiler<'a> }),
(check_crate_rustc, CheckCrateRustc { compiler: Compiler<'a> }),

// Distribution targets, creating tarballs
(dist, Dist { stage: u32 }),
Expand Down Expand Up @@ -376,6 +379,9 @@ impl<'a> Step<'a> {
self.check_cfail(compiler),
self.check_rfail(compiler),
self.check_pfail(compiler),
self.check_crate_std(compiler),
self.check_crate_test(compiler),
self.check_crate_rustc(compiler),
self.check_codegen(compiler),
self.check_codegen_units(compiler),
self.check_debuginfo(compiler),
Expand Down Expand Up @@ -437,6 +443,15 @@ impl<'a> Step<'a> {
Source::CheckErrorIndex { compiler } => {
vec![self.libstd(compiler), self.tool_error_index(compiler.stage)]
}
Source::CheckCrateStd { compiler } => {
vec![self.libtest(compiler)]
}
Source::CheckCrateTest { compiler } => {
vec![self.libtest(compiler)]
}
Source::CheckCrateRustc { compiler } => {
vec![self.libtest(compiler)]
}

Source::ToolLinkchecker { stage } |
Source::ToolTidy { stage } => {
Expand Down
15 changes: 11 additions & 4 deletions src/bootstrap/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern crate bootstrap;

use std::env;
use std::ffi::OsString;
use std::path::PathBuf;
use std::process::Command;

fn main() {
Expand All @@ -43,16 +44,22 @@ fn main() {
// have the standard library built yet and may not be able to produce an
// executable. Otherwise we just use the standard compiler we're
// bootstrapping with.
let rustc = if target.is_none() {
env::var_os("RUSTC_SNAPSHOT").unwrap()
let (rustc, libdir) = if target.is_none() {
("RUSTC_SNAPSHOT", "RUSTC_SNAPSHOT_LIBDIR")
} else {
env::var_os("RUSTC_REAL").unwrap()
("RUSTC_REAL", "RUSTC_LIBDIR")
};
let stage = env::var("RUSTC_STAGE").unwrap();

let rustc = env::var_os(rustc).unwrap();
let libdir = env::var_os(libdir).unwrap();
let mut dylib_path = bootstrap::dylib_path();
dylib_path.insert(0, PathBuf::from(libdir));

let mut cmd = Command::new(rustc);
cmd.args(&args)
.arg("--cfg").arg(format!("stage{}", stage));
.arg("--cfg").arg(format!("stage{}", stage))
.env(bootstrap::dylib_path_var(), env::join_paths(&dylib_path).unwrap());

if let Some(target) = target {
// The stage0 compiler has a special sysroot distinct from what we
Expand Down
10 changes: 9 additions & 1 deletion src/bootstrap/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,25 @@
//!
//! See comments in `src/bootstrap/rustc.rs` for more information.

extern crate bootstrap;

use std::env;
use std::process::Command;
use std::path::PathBuf;

fn main() {
let args = env::args_os().skip(1).collect::<Vec<_>>();
let rustdoc = env::var_os("RUSTDOC_REAL").unwrap();
let libdir = env::var_os("RUSTC_LIBDIR").unwrap();

let mut dylib_path = bootstrap::dylib_path();
dylib_path.insert(0, PathBuf::from(libdir));

let mut cmd = Command::new(rustdoc);
cmd.args(&args)
.arg("--cfg").arg(format!("stage{}", env::var("RUSTC_STAGE").unwrap()))
.arg("--cfg").arg("dox");
.arg("--cfg").arg("dox")
.env(bootstrap::dylib_path_var(), env::join_paths(&dylib_path).unwrap());
std::process::exit(match cmd.status() {
Ok(s) => s.code().unwrap_or(1),
Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e),
Expand Down
8 changes: 8 additions & 0 deletions src/etc/local_stage0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}extra*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_D
cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}rust*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}std*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}syntax*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}flate*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}fmt_macros*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}getopts*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}graphviz*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}log*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}rbml*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}serialize*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}term*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/

# do not fail if one of the above fails, as all we need is a working rustc!
exit 0
1 change: 0 additions & 1 deletion src/liballoc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ version = "0.0.0"
[lib]
name = "alloc"
path = "lib.rs"
test = false

[dependencies]
core = { path = "../libcore" }
12 changes: 8 additions & 4 deletions src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,14 +525,16 @@ impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for Box<I> {}
/// }
/// ```
#[rustc_paren_sugar]
#[unstable(feature = "fnbox", reason = "Newly introduced", issue = "28796")]
#[unstable(feature = "fnbox",
reason = "will be deprecated if and when Box<FnOnce> becomes usable", issue = "28796")]
pub trait FnBox<A> {
type Output;

fn call_box(self: Box<Self>, args: A) -> Self::Output;
}

#[unstable(feature = "fnbox", reason = "Newly introduced", issue = "28796")]
#[unstable(feature = "fnbox",
reason = "will be deprecated if and when Box<FnOnce> becomes usable", issue = "28796")]
impl<A, F> FnBox<A> for F where F: FnOnce<A>
{
type Output = F::Output;
Expand All @@ -542,7 +544,8 @@ impl<A, F> FnBox<A> for F where F: FnOnce<A>
}
}

#[unstable(feature = "fnbox", reason = "Newly introduced", issue = "28796")]
#[unstable(feature = "fnbox",
reason = "will be deprecated if and when Box<FnOnce> becomes usable", issue = "28796")]
impl<'a, A, R> FnOnce<A> for Box<FnBox<A, Output = R> + 'a> {
type Output = R;

Expand All @@ -551,7 +554,8 @@ impl<'a, A, R> FnOnce<A> for Box<FnBox<A, Output = R> + 'a> {
}
}

#[unstable(feature = "fnbox", reason = "Newly introduced", issue = "28796")]
#[unstable(feature = "fnbox",
reason = "will be deprecated if and when Box<FnOnce> becomes usable", issue = "28796")]
impl<'a, A, R> FnOnce<A> for Box<FnBox<A, Output = R> + Send + 'a> {
type Output = R;

Expand Down
16 changes: 16 additions & 0 deletions src/liballoc_jemalloc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![deny(warnings)]

extern crate build_helper;
extern crate gcc;

Expand All @@ -18,6 +20,7 @@ use build_helper::run;

fn main() {
println!("cargo:rustc-cfg=cargobuild");
println!("cargo:rerun-if-changed=build.rs");

let target = env::var("TARGET").unwrap();
let host = env::var("HOST").unwrap();
Expand All @@ -40,6 +43,19 @@ fn main() {
let cflags = compiler.args().iter().map(|s| s.to_str().unwrap())
.collect::<Vec<_>>().join(" ");

let mut stack = src_dir.join("../jemalloc")
.read_dir().unwrap()
.map(|e| e.unwrap())
.collect::<Vec<_>>();
while let Some(entry) = stack.pop() {
let path = entry.path();
if entry.file_type().unwrap().is_dir() {
stack.extend(path.read_dir().unwrap().map(|e| e.unwrap()));
} else {
println!("cargo:rerun-if-changed={}", path.display());
}
}

let mut cmd = Command::new("sh");
cmd.arg(src_dir.join("../jemalloc/configure").to_str().unwrap()
.replace("C:\\", "/c/")
Expand Down
5 changes: 4 additions & 1 deletion src/libcollections/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ version = "0.0.0"
[lib]
name = "collections"
path = "lib.rs"
test = false

[dependencies]
alloc = { path = "../liballoc" }
core = { path = "../libcore" }
rustc_unicode = { path = "../librustc_unicode" }

[[test]]
name = "collectionstest"
path = "../libcollectionstest/lib.rs"
4 changes: 4 additions & 0 deletions src/libcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ build = "build.rs"
name = "core"
path = "lib.rs"
test = false

[[test]]
name = "coretest"
path = "../libcoretest/lib.rs"
3 changes: 3 additions & 0 deletions src/libcore/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![deny(warnings)]

fn main() {
// Remove this whenever snapshots and rustbuild nightlies are synced.
println!("cargo:rustc-cfg=cargobuild");
println!("cargo:rerun-if-changed=build.rs")
}
4 changes: 2 additions & 2 deletions src/libcore/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ pub enum Ordering {
#[stable(feature = "rust1", since = "1.0.0")]
Relaxed,
/// When coupled with a store, all previous writes become visible
/// to another thread that performs a load with `Acquire` ordering
/// to the other threads that perform a load with `Acquire` ordering
/// on the same value.
#[stable(feature = "rust1", since = "1.0.0")]
Release,
/// When coupled with a load, all subsequent loads will see data
/// written before a store with `Release` ordering on the same value
/// in another thread.
/// in other threads.
#[stable(feature = "rust1", since = "1.0.0")]
Acquire,
/// When coupled with a load, uses `Acquire` ordering, and with a store
Expand Down
Loading

0 comments on commit 2c5ce8c

Please sign in to comment.