Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustbuild: Implement distcheck #38256

Merged
merged 1 commit into from
Dec 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use std::process::Command;
use build_helper::output;

use {Build, Compiler, Mode};
use dist;
use util::{self, dylib_path, dylib_path_var};

const ADB_TEST_DIR: &'static str = "/data/tmp";
Expand Down Expand Up @@ -517,3 +518,32 @@ pub fn android_copy_libs(build: &Build,
}
}
}

/// Run "distcheck", a 'make check' from a tarball
pub fn distcheck(build: &Build) {
if build.config.build != "x86_64-unknown-linux-gnu" {
return
}
if !build.config.host.iter().any(|s| s == "x86_64-unknown-linux-gnu") {
return
}
if !build.config.target.iter().any(|s| s == "x86_64-unknown-linux-gnu") {
return
}

let dir = build.out.join("tmp").join("distcheck");
let _ = fs::remove_dir_all(&dir);
t!(fs::create_dir_all(&dir));

let mut cmd = Command::new("tar");
cmd.arg("-xzf")
.arg(dist::rust_src_location(build))
.arg("--strip-components=1")
.current_dir(&dir);
build.run(&mut cmd);
build.run(Command::new("./configure")
.current_dir(&dir));
build.run(Command::new("make")
.arg("check")
.current_dir(&dir));
}
7 changes: 6 additions & 1 deletion src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ pub fn std(build: &Build, compiler: &Compiler, target: &str) {
t!(fs::remove_dir_all(&image));
}

pub fn rust_src_location(build: &Build) -> PathBuf {
let plain_name = format!("rustc-{}-src", package_vers(build));
distdir(build).join(&format!("{}.tar.gz", plain_name))
}

/// Creates the `rust-src` installer component and the plain source tarball
pub fn rust_src(build: &Build) {
println!("Dist src");
Expand Down Expand Up @@ -374,7 +379,7 @@ pub fn rust_src(build: &Build) {

// Create plain source tarball
let mut cmd = Command::new("tar");
cmd.arg("-czf").arg(sanitize_sh(&distdir(build).join(&format!("{}.tar.gz", plain_name))))
cmd.arg("-czf").arg(sanitize_sh(&rust_src_location(build)))
.arg(&plain_name)
.current_dir(&dst);
build.run(&mut cmd);
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/mk/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ check-cargotest:
$(Q)$(BOOTSTRAP) test src/tools/cargotest $(BOOTSTRAP_ARGS)
dist:
$(Q)$(BOOTSTRAP) dist $(BOOTSTRAP_ARGS)
distcheck:
$(Q)$(BOOTSTRAP) test distcheck
install:
$(Q)$(BOOTSTRAP) dist --install $(BOOTSTRAP_ARGS)
tidy:
Expand Down
12 changes: 4 additions & 8 deletions src/bootstrap/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,6 @@ pub fn build_rules(build: &Build) -> Rules {
});
}
for (krate, path, default) in krates("rustc-main") {
// We hijacked the `src/rustc` path above for "build just the compiler"
// so let's not reinterpret it here as everything and redirect the
// `src/rustc` path to a nonexistent path.
let path = if path == "src/rustc" {
"path/to/nowhere"
} else {
path
};
rules.build(&krate.build_step, path)
.dep(|s| s.name("libtest"))
.dep(move |s| s.name("llvm").host(&build.config.build).stage(0))
Expand Down Expand Up @@ -403,6 +395,10 @@ pub fn build_rules(build: &Build) -> Rules {
.default(true)
.host(true)
.run(move |s| check::docs(build, &s.compiler()));
rules.test("check-distcheck", "distcheck")
.dep(|s| s.name("dist-src"))
.run(move |_| check::distcheck(build));


rules.build("test-helpers", "src/rt/rust_test_helpers.c")
.run(move |s| native::test_helpers(build, s.target));
Expand Down