Skip to content

Commit

Permalink
Auto merge of #32348 - brson:cargotest, r=alexcrichton
Browse files Browse the repository at this point in the history
Introduce 'cargotest' and the check-cargotest buildstep

This is a new suite of tests that verifies that the compiler builds specific revisions of select crates from crates.io.

It does not run by default. It is intended that bors runs these tests against all PRs, and gates on them. In this way we will make it harder still to break important swaths of the ecosystem, even on nightly.

This is a very basic implementation intended for feedback. The biggest thing it probably should do but doesn't is use a lockfile for every project it builds.

r? @alexcrichton cc @rust-lang/lang @rust-lang/libs
  • Loading branch information
bors committed Mar 23, 2016
2 parents 8ba2ea5 + 3a790ac commit d6af19b
Show file tree
Hide file tree
Showing 8 changed files with 529 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/bootstrap/build/check.rs
Expand Up @@ -16,3 +16,11 @@ pub fn linkcheck(build: &Build, stage: u32, host: &str) {
build.run(build.tool_cmd(&compiler, "linkchecker")
.arg(build.out.join(host).join("doc")));
}

pub fn cargotest(build: &Build, stage: u32, host: &str) {
let ref compiler = Compiler::new(stage, host);
build.run(build.tool_cmd(compiler, "cargotest")
.env("RUSTC", build.compiler_path(compiler))
.env("RUSTDOC", build.rustdoc(compiler))
.arg(&build.cargo));
}
6 changes: 6 additions & 0 deletions src/bootstrap/build/mod.rs
Expand Up @@ -183,6 +183,9 @@ impl Build {
compile::tool(self, stage, target.target,
"error_index_generator");
}
ToolCargoTest { stage } => {
compile::tool(self, stage, target.target, "cargotest");
}
DocBook { stage } => {
doc::rustbook(self, stage, target.target, "book", &doc_out);
}
Expand Down Expand Up @@ -210,6 +213,9 @@ impl Build {
CheckLinkcheck { stage } => {
check::linkcheck(self, stage, target.target);
}
CheckCargoTest { stage } => {
check::cargotest(self, stage, target.target);
}

DistDocs { stage } => dist::docs(self, stage, target.target),
DistMingw { _dummy } => dist::mingw(self, target.target),
Expand Down
8 changes: 8 additions & 0 deletions src/bootstrap/build/step.rs
Expand Up @@ -47,6 +47,7 @@ macro_rules! targets {
(tool_linkchecker, ToolLinkchecker { stage: u32 }),
(tool_rustbook, ToolRustbook { stage: u32 }),
(tool_error_index, ToolErrorIndex { stage: u32 }),
(tool_cargotest, ToolCargoTest { stage: u32 }),

// Steps for long-running native builds. Ideally these wouldn't
// actually exist and would be part of build scripts, but for now
Expand All @@ -73,6 +74,7 @@ macro_rules! targets {
// target to depend on a bunch of others.
(check, Check { stage: u32, compiler: Compiler<'a> }),
(check_linkcheck, CheckLinkcheck { stage: u32 }),
(check_cargotest, CheckCargoTest { stage: u32 }),

// Distribution targets, creating tarballs
(dist, Dist { stage: u32 }),
Expand Down Expand Up @@ -292,6 +294,9 @@ impl<'a> Step<'a> {
Source::CheckLinkcheck { stage } => {
vec![self.tool_linkchecker(stage), self.doc(stage)]
}
Source::CheckCargoTest { stage } => {
vec![self.tool_cargotest(stage)]
}

Source::ToolLinkchecker { stage } => {
vec![self.libstd(self.compiler(stage))]
Expand All @@ -300,6 +305,9 @@ impl<'a> Step<'a> {
Source::ToolRustbook { stage } => {
vec![self.librustc(self.compiler(stage))]
}
Source::ToolCargoTest { stage } => {
vec![self.libstd(self.compiler(stage))]
}

Source::DistDocs { stage } => vec![self.doc(stage)],
Source::DistMingw { _dummy: _ } => Vec::new(),
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/mk/Makefile.in
Expand Up @@ -38,6 +38,8 @@ standalone-docs:
$(Q)$(BOOTSTRAP) --step doc-standalone
check:
$(Q)$(BOOTSTRAP) --step check
cargotest:
$(Q)$(BOOTSTRAP) --step cargotest
dist:
$(Q)$(BOOTSTRAP) --step dist

Expand Down
28 changes: 28 additions & 0 deletions src/tools/cargotest/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/tools/cargotest/Cargo.toml
@@ -0,0 +1,11 @@
[package]
name = "cargotest"
version = "0.1.0"
authors = ["Brian Anderson <banderson@mozilla.com>"]

[dependencies]
tempdir = "0.3.4"

[[bin]]
name = "cargotest"
path = "main.rs"

0 comments on commit d6af19b

Please sign in to comment.