Skip to content

Commit

Permalink
A few small test fixes and such from rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Dec 30, 2016
1 parent 3eb459f commit e484197
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
24 changes: 17 additions & 7 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,11 @@ use {Build, Compiler, Mode};
/// created will also be linked into the sysroot directory.
pub fn std(build: &Build, target: &str, compiler: &Compiler) {
let libdir = build.sysroot_libdir(compiler, target);
let _ = fs::remove_dir_all(&libdir);
t!(fs::create_dir_all(&libdir));

println!("Building stage{} std artifacts ({} -> {})", compiler.stage,
compiler.host, target);

// Some platforms have startup objects that may be required to produce the
// libstd dynamic library, for example.
build_startup_objects(build, target, &libdir);

let out_dir = build.cargo_out(compiler, Mode::Libstd, target);
build.clear_if_dirty(&out_dir, &build.compiler_path(compiler));
let mut cargo = build.cargo(compiler, Mode::Libstd, target, "build");
Expand Down Expand Up @@ -111,20 +106,23 @@ fn copy_musl_third_party_objects(build: &Build, target: &str, into: &Path) {
/// They don't require any library support as they're just plain old object
/// files, so we just use the nightly snapshot compiler to always build them (as
/// no other compilers are guaranteed to be available).
fn build_startup_objects(build: &Build, target: &str, into: &Path) {
pub fn build_startup_objects(build: &Build, for_compiler: &Compiler, target: &str) {
if !target.contains("pc-windows-gnu") {
return
}

let compiler = Compiler::new(0, &build.config.build);
let compiler_path = build.compiler_path(&compiler);
let into = build.sysroot_libdir(for_compiler, target);
t!(fs::create_dir_all(&into));

for file in t!(fs::read_dir(build.src.join("src/rtstartup"))) {
let file = t!(file);
let mut cmd = Command::new(&compiler_path);
build.run(cmd.env("RUSTC_BOOTSTRAP", "1")
.arg("--target").arg(target)
.arg("--emit=obj")
.arg("--out-dir").arg(into)
.arg("--out-dir").arg(&into)
.arg(file.path()));
}

Expand Down Expand Up @@ -155,6 +153,12 @@ pub fn test_link(build: &Build,
compiler: &Compiler,
target_compiler: &Compiler,
target: &str) {
println!("Copying stage{} test from stage{} ({} -> {} / {})",
target_compiler.stage,
compiler.stage,
compiler.host,
target_compiler.host,
target);
let libdir = build.sysroot_libdir(&target_compiler, target);
let out_dir = build.cargo_out(&compiler, Mode::Libtest, target);
add_to_sysroot(&out_dir, &libdir);
Expand Down Expand Up @@ -224,6 +228,12 @@ pub fn rustc_link(build: &Build,
compiler: &Compiler,
target_compiler: &Compiler,
target: &str) {
println!("Copying stage{} rustc from stage{} ({} -> {} / {})",
target_compiler.stage,
compiler.stage,
compiler.host,
target_compiler.host,
target);
let libdir = build.sysroot_libdir(&target_compiler, target);
let out_dir = build.cargo_out(&compiler, Mode::Librustc, target);
add_to_sysroot(&out_dir, &libdir);
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
# support. You'll need to write a target specification at least, and most
# likely, teach rustc about the C ABI of the target. Get in touch with the
# Rust team and file an issue if you need assistance in porting!
#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc"
#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX"

# =============================================================================
# General build configuration options
Expand Down
7 changes: 7 additions & 0 deletions src/bootstrap/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
"libstd-link",
"build-crate-std_shim",
compile::std_link)
.dep(|s| s.name("startup-objects"))
.dep(|s| s.name("create-sysroot").target(s.host));
crate_rule(build,
&mut rules,
Expand All @@ -264,6 +265,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {

for (krate, path, _default) in krates("std_shim") {
rules.build(&krate.build_step, path)
.dep(|s| s.name("startup-objects"))
.dep(move |s| s.name("rustc").host(&build.config.build).target(s.host))
.run(move |s| compile::std(build, s.target, &s.compiler()));
}
Expand All @@ -279,6 +281,10 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
.run(move |s| compile::rustc(build, s.target, &s.compiler()));
}

rules.build("startup-objects", "src/rtstartup")
.dep(|s| s.name("create-sysroot").target(s.host))
.run(move |s| compile::build_startup_objects(build, &s.compiler(), s.target));

// ========================================================================
// Test targets
//
Expand Down Expand Up @@ -349,6 +355,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
let mut suite = |name, path, mode, dir| {
rules.test(name, path)
.dep(|s| s.name("librustc"))
.dep(|s| s.name("test-helpers"))
.dep(|s| s.name("tool-compiletest").target(s.host))
.default(mode != "pretty")
.host(true)
Expand Down
6 changes: 0 additions & 6 deletions src/tools/cargotest/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ const TEST_REPOS: &'static [Test] = &[
sha: "999001b223152441198f117a68fb81f57bc086dd",
lock: None,
},
Test {
name: "xsv",
repo: "https://github.com/BurntSushi/xsv",
sha: "5ec4fff4a3f507eda887049469897f02c6fae036",
lock: None,
},
];

fn main() {
Expand Down
3 changes: 1 addition & 2 deletions src/tools/compiletest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,7 @@ pub fn run_tests(config: &Config) {
Mode::Codegen |
Mode::CodegenUnits |
Mode::Pretty |
Mode::Rustdoc |
Mode::Incremental => {}
Mode::Rustdoc => {}

_ => {
env::set_var("RUST_TEST_THREADS", "1");
Expand Down

0 comments on commit e484197

Please sign in to comment.