Skip to content

Commit d6af19b

Browse files
committed
Auto merge of #32348 - brson:cargotest, r=alexcrichton
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
2 parents 8ba2ea5 + 3a790ac commit d6af19b

File tree

8 files changed

+529
-0
lines changed

8 files changed

+529
-0
lines changed

src/bootstrap/build/check.rs

+8
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,11 @@ pub fn linkcheck(build: &Build, stage: u32, host: &str) {
1616
build.run(build.tool_cmd(&compiler, "linkchecker")
1717
.arg(build.out.join(host).join("doc")));
1818
}
19+
20+
pub fn cargotest(build: &Build, stage: u32, host: &str) {
21+
let ref compiler = Compiler::new(stage, host);
22+
build.run(build.tool_cmd(compiler, "cargotest")
23+
.env("RUSTC", build.compiler_path(compiler))
24+
.env("RUSTDOC", build.rustdoc(compiler))
25+
.arg(&build.cargo));
26+
}

src/bootstrap/build/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ impl Build {
183183
compile::tool(self, stage, target.target,
184184
"error_index_generator");
185185
}
186+
ToolCargoTest { stage } => {
187+
compile::tool(self, stage, target.target, "cargotest");
188+
}
186189
DocBook { stage } => {
187190
doc::rustbook(self, stage, target.target, "book", &doc_out);
188191
}
@@ -210,6 +213,9 @@ impl Build {
210213
CheckLinkcheck { stage } => {
211214
check::linkcheck(self, stage, target.target);
212215
}
216+
CheckCargoTest { stage } => {
217+
check::cargotest(self, stage, target.target);
218+
}
213219

214220
DistDocs { stage } => dist::docs(self, stage, target.target),
215221
DistMingw { _dummy } => dist::mingw(self, target.target),

src/bootstrap/build/step.rs

+8
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ macro_rules! targets {
4747
(tool_linkchecker, ToolLinkchecker { stage: u32 }),
4848
(tool_rustbook, ToolRustbook { stage: u32 }),
4949
(tool_error_index, ToolErrorIndex { stage: u32 }),
50+
(tool_cargotest, ToolCargoTest { stage: u32 }),
5051

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

7779
// Distribution targets, creating tarballs
7880
(dist, Dist { stage: u32 }),
@@ -292,6 +294,9 @@ impl<'a> Step<'a> {
292294
Source::CheckLinkcheck { stage } => {
293295
vec![self.tool_linkchecker(stage), self.doc(stage)]
294296
}
297+
Source::CheckCargoTest { stage } => {
298+
vec![self.tool_cargotest(stage)]
299+
}
295300

296301
Source::ToolLinkchecker { stage } => {
297302
vec![self.libstd(self.compiler(stage))]
@@ -300,6 +305,9 @@ impl<'a> Step<'a> {
300305
Source::ToolRustbook { stage } => {
301306
vec![self.librustc(self.compiler(stage))]
302307
}
308+
Source::ToolCargoTest { stage } => {
309+
vec![self.libstd(self.compiler(stage))]
310+
}
303311

304312
Source::DistDocs { stage } => vec![self.doc(stage)],
305313
Source::DistMingw { _dummy: _ } => Vec::new(),

src/bootstrap/mk/Makefile.in

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ standalone-docs:
3838
$(Q)$(BOOTSTRAP) --step doc-standalone
3939
check:
4040
$(Q)$(BOOTSTRAP) --step check
41+
cargotest:
42+
$(Q)$(BOOTSTRAP) --step cargotest
4143
dist:
4244
$(Q)$(BOOTSTRAP) --step dist
4345

src/tools/cargotest/Cargo.lock

+28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tools/cargotest/Cargo.toml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "cargotest"
3+
version = "0.1.0"
4+
authors = ["Brian Anderson <[email protected]>"]
5+
6+
[dependencies]
7+
tempdir = "0.3.4"
8+
9+
[[bin]]
10+
name = "cargotest"
11+
path = "main.rs"

0 commit comments

Comments
 (0)