A few small test fixes and such from rollup
This commit is contained in:
parent
3eb459ff5f
commit
e484197482
@ -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");
|
||||
@ -111,12 +106,15 @@ 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);
|
||||
@ -124,7 +122,7 @@ fn build_startup_objects(build: &Build, target: &str, into: &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()));
|
||||
}
|
||||
|
||||
@ -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);
|
||||
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
@ -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()));
|
||||
}
|
||||
@ -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
|
||||
//
|
||||
@ -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)
|
||||
|
@ -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() {
|
||||
|
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user