Skip to content

Commit 0a1b5e8

Browse files
Move rule configs out of step
1 parent ae98ebf commit 0a1b5e8

File tree

7 files changed

+737
-1
lines changed

7 files changed

+737
-1
lines changed

src/bootstrap/check.rs

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ fn try_run_quiet(build: &Build, cmd: &mut Command) {
8181
}
8282
}
8383

84+
// rules.test("check-linkchecker", "src/tools/linkchecker")
85+
// .dep(|s| s.name("tool-linkchecker").stage(0))
86+
// .dep(|s| s.name("default:doc"))
87+
// .default(build.config.docs)
88+
// .host(true)
89+
// .run(move |s| check::linkcheck(build, s.target));
8490
/// Runs the `linkchecker` tool as compiled in `stage` by the `host` compiler.
8591
///
8692
/// This tool in `src/tools` will verify the validity of all our links in the
@@ -94,6 +100,11 @@ pub fn linkcheck(build: &Build, host: &str) {
94100
.arg(build.out.join(host).join("doc")));
95101
}
96102

103+
// rules.test("check-cargotest", "src/tools/cargotest")
104+
// .dep(|s| s.name("tool-cargotest").stage(0))
105+
// .dep(|s| s.name("librustc"))
106+
// .host(true)
107+
// .run(move |s| check::cargotest(build, s.stage, s.target));
97108
/// Runs the `cargotest` tool as compiled in `stage` by the `host` compiler.
98109
///
99110
/// This tool in `src/tools` will check out a few Rust projects and run `cargo
@@ -116,6 +127,10 @@ pub fn cargotest(build: &Build, stage: u32, host: &str) {
116127
.env("RUSTDOC", build.rustdoc(&compiler)));
117128
}
118129

130+
//rules.test("check-cargo", "cargo")
131+
// .dep(|s| s.name("tool-cargo"))
132+
// .host(true)
133+
// .run(move |s| check::cargo(build, s.stage, s.target));
119134
/// Runs `cargo test` for `cargo` packaged with Rust.
120135
pub fn cargo(build: &Build, stage: u32, host: &str) {
121136
let compiler = &Compiler::new(stage, host);
@@ -160,6 +175,12 @@ fn path_for_cargo(build: &Build, compiler: &Compiler) -> OsString {
160175
env::join_paths(iter::once(path).chain(env::split_paths(&old_path))).expect("")
161176
}
162177

178+
//rules.test("check-tidy", "src/tools/tidy")
179+
// .dep(|s| s.name("tool-tidy").stage(0))
180+
// .default(true)
181+
// .host(true)
182+
// .only_build(true)
183+
// .run(move |s| check::tidy(build, s.target));
163184
/// Runs the `tidy` tool as compiled in `stage` by the `host` compiler.
164185
///
165186
/// This tool in `src/tools` checks up on various bits and pieces of style and
@@ -184,6 +205,104 @@ fn testdir(build: &Build, host: &str) -> PathBuf {
184205
build.out.join(host).join("test")
185206
}
186207

208+
// // ========================================================================
209+
// // Test targets
210+
// //
211+
// // Various unit tests and tests suites we can run
212+
// {
213+
// let mut suite = |name, path, mode, dir| {
214+
// rules.test(name, path)
215+
// .dep(|s| s.name("libtest"))
216+
// .dep(|s| s.name("tool-compiletest").target(s.host).stage(0))
217+
// .dep(|s| s.name("test-helpers"))
218+
// .dep(|s| s.name("remote-copy-libs"))
219+
// .default(mode != "pretty") // pretty tests don't run everywhere
220+
// .run(move |s| {
221+
// check::compiletest(build, &s.compiler(), s.target, mode, dir)
222+
// });
223+
// };
224+
//
225+
// suite("check-ui", "src/test/ui", "ui", "ui");
226+
// suite("check-rpass", "src/test/run-pass", "run-pass", "run-pass");
227+
// suite("check-cfail", "src/test/compile-fail", "compile-fail", "compile-fail");
228+
// suite("check-pfail", "src/test/parse-fail", "parse-fail", "parse-fail");
229+
// suite("check-rfail", "src/test/run-fail", "run-fail", "run-fail");
230+
// suite("check-rpass-valgrind", "src/test/run-pass-valgrind",
231+
// "run-pass-valgrind", "run-pass-valgrind");
232+
// suite("check-mir-opt", "src/test/mir-opt", "mir-opt", "mir-opt");
233+
// if build.config.codegen_tests {
234+
// suite("check-codegen", "src/test/codegen", "codegen", "codegen");
235+
// }
236+
// suite("check-codegen-units", "src/test/codegen-units", "codegen-units",
237+
// "codegen-units");
238+
// suite("check-incremental", "src/test/incremental", "incremental",
239+
// "incremental");
240+
// }
241+
//
242+
// if build.build.contains("msvc") {
243+
// // nothing to do for debuginfo tests
244+
// } else {
245+
// rules.test("check-debuginfo-lldb", "src/test/debuginfo-lldb")
246+
// .dep(|s| s.name("libtest"))
247+
// .dep(|s| s.name("tool-compiletest").target(s.host).stage(0))
248+
// .dep(|s| s.name("test-helpers"))
249+
// .dep(|s| s.name("debugger-scripts"))
250+
// .run(move |s| check::compiletest(build, &s.compiler(), s.target,
251+
// "debuginfo-lldb", "debuginfo"));
252+
// rules.test("check-debuginfo-gdb", "src/test/debuginfo-gdb")
253+
// .dep(|s| s.name("libtest"))
254+
// .dep(|s| s.name("tool-compiletest").target(s.host).stage(0))
255+
// .dep(|s| s.name("test-helpers"))
256+
// .dep(|s| s.name("debugger-scripts"))
257+
// .dep(|s| s.name("remote-copy-libs"))
258+
// .run(move |s| check::compiletest(build, &s.compiler(), s.target,
259+
// "debuginfo-gdb", "debuginfo"));
260+
// let mut rule = rules.test("check-debuginfo", "src/test/debuginfo");
261+
// rule.default(true);
262+
// if build.build.contains("apple") {
263+
// rule.dep(|s| s.name("check-debuginfo-lldb"));
264+
// } else {
265+
// rule.dep(|s| s.name("check-debuginfo-gdb"));
266+
// }
267+
// }
268+
//
269+
//
270+
//
271+
// {
272+
// let mut suite = |name, path, mode, dir| {
273+
// rules.test(name, path)
274+
// .dep(|s| s.name("librustc"))
275+
// .dep(|s| s.name("test-helpers"))
276+
// .dep(|s| s.name("tool-compiletest").target(s.host).stage(0))
277+
// .default(mode != "pretty")
278+
// .host(true)
279+
// .run(move |s| {
280+
// check::compiletest(build, &s.compiler(), s.target, mode, dir)
281+
// });
282+
// };
283+
//
284+
// suite("check-ui-full", "src/test/ui-fulldeps", "ui", "ui-fulldeps");
285+
// suite("check-rpass-full", "src/test/run-pass-fulldeps",
286+
// "run-pass", "run-pass-fulldeps");
287+
// suite("check-rfail-full", "src/test/run-fail-fulldeps",
288+
// "run-fail", "run-fail-fulldeps");
289+
// suite("check-cfail-full", "src/test/compile-fail-fulldeps",
290+
// "compile-fail", "compile-fail-fulldeps");
291+
// suite("check-rmake", "src/test/run-make", "run-make", "run-make");
292+
// suite("check-rustdoc", "src/test/rustdoc", "rustdoc", "rustdoc");
293+
// suite("check-pretty", "src/test/pretty", "pretty", "pretty");
294+
// suite("check-pretty-rpass", "src/test/run-pass/pretty", "pretty",
295+
// "run-pass");
296+
// suite("check-pretty-rfail", "src/test/run-fail/pretty", "pretty",
297+
// "run-fail");
298+
// suite("check-pretty-valgrind", "src/test/run-pass-valgrind/pretty", "pretty",
299+
// "run-pass-valgrind");
300+
// suite("check-pretty-rpass-full", "src/test/run-pass-fulldeps/pretty",
301+
// "pretty", "run-pass-fulldeps");
302+
// suite("check-pretty-rfail-full", "src/test/run-fail-fulldeps/pretty",
303+
// "pretty", "run-fail-fulldeps");
304+
// }
305+
187306
/// Executes the `compiletest` tool to run a suite of tests.
188307
///
189308
/// Compiles all tests with `compiler` for `target` with the specified
@@ -338,6 +457,11 @@ pub fn compiletest(build: &Build,
338457
try_run(build, &mut cmd);
339458
}
340459

460+
// rules.test("check-docs", "src/doc")
461+
// .dep(|s| s.name("libtest"))
462+
// .default(true)
463+
// .host(true)
464+
// .run(move |s| check::docs(build, &s.compiler()));
341465
/// Run `rustdoc --test` for all documentation in `src/doc`.
342466
///
343467
/// This will run all tests in our markdown documentation (e.g. the book)
@@ -370,6 +494,12 @@ pub fn docs(build: &Build, compiler: &Compiler) {
370494
}
371495
}
372496

497+
//rules.test("check-error-index", "src/tools/error_index_generator")
498+
// .dep(|s| s.name("libstd"))
499+
// .dep(|s| s.name("tool-error-index").host(s.host).stage(0))
500+
// .default(true)
501+
// .host(true)
502+
// .run(move |s| check::error_index(build, &s.compiler()));
373503
/// Run the error index generator tool to execute the tests located in the error
374504
/// index.
375505
///
@@ -420,6 +550,68 @@ fn markdown_test(build: &Build, compiler: &Compiler, markdown: &Path) {
420550
}
421551
}
422552

553+
// for (krate, path, _default) in krates("std") {
554+
// rules.test(&krate.test_step, path)
555+
// .dep(|s| s.name("libtest"))
556+
// .dep(|s| s.name("remote-copy-libs"))
557+
// .run(move |s| check::krate(build, &s.compiler(), s.target,
558+
// Mode::Libstd, TestKind::Test,
559+
// Some(&krate.name)));
560+
// }
561+
// rules.test("check-std-all", "path/to/nowhere")
562+
// .dep(|s| s.name("libtest"))
563+
// .dep(|s| s.name("remote-copy-libs"))
564+
// .default(true)
565+
// .run(move |s| check::krate(build, &s.compiler(), s.target,
566+
// Mode::Libstd, TestKind::Test, None));
567+
//
568+
// // std benchmarks
569+
// for (krate, path, _default) in krates("std") {
570+
// rules.bench(&krate.bench_step, path)
571+
// .dep(|s| s.name("libtest"))
572+
// .dep(|s| s.name("remote-copy-libs"))
573+
// .run(move |s| check::krate(build, &s.compiler(), s.target,
574+
// Mode::Libstd, TestKind::Bench,
575+
// Some(&krate.name)));
576+
// }
577+
// rules.bench("bench-std-all", "path/to/nowhere")
578+
// .dep(|s| s.name("libtest"))
579+
// .dep(|s| s.name("remote-copy-libs"))
580+
// .default(true)
581+
// .run(move |s| check::krate(build, &s.compiler(), s.target,
582+
// Mode::Libstd, TestKind::Bench, None));
583+
//
584+
// for (krate, path, _default) in krates("test") {
585+
// rules.test(&krate.test_step, path)
586+
// .dep(|s| s.name("libtest"))
587+
// .dep(|s| s.name("remote-copy-libs"))
588+
// .run(move |s| check::krate(build, &s.compiler(), s.target,
589+
// Mode::Libtest, TestKind::Test,
590+
// Some(&krate.name)));
591+
// }
592+
// rules.test("check-test-all", "path/to/nowhere")
593+
// .dep(|s| s.name("libtest"))
594+
// .dep(|s| s.name("remote-copy-libs"))
595+
// .default(true)
596+
// .run(move |s| check::krate(build, &s.compiler(), s.target,
597+
// Mode::Libtest, TestKind::Test, None));
598+
// for (krate, path, _default) in krates("rustc-main") {
599+
// rules.test(&krate.test_step, path)
600+
// .dep(|s| s.name("librustc"))
601+
// .dep(|s| s.name("remote-copy-libs"))
602+
// .host(true)
603+
// .run(move |s| check::krate(build, &s.compiler(), s.target,
604+
// Mode::Librustc, TestKind::Test,
605+
// Some(&krate.name)));
606+
// }
607+
// rules.test("check-rustc-all", "path/to/nowhere")
608+
// .dep(|s| s.name("librustc"))
609+
// .dep(|s| s.name("remote-copy-libs"))
610+
// .default(true)
611+
// .host(true)
612+
// .run(move |s| check::krate(build, &s.compiler(), s.target,
613+
// Mode::Librustc, TestKind::Test, None));
614+
423615
/// Run all unit tests plus documentation tests for an entire crate DAG defined
424616
/// by a `Cargo.toml`
425617
///
@@ -596,6 +788,34 @@ fn find_tests(dir: &Path, target: &str) -> Vec<PathBuf> {
596788
dst
597789
}
598790

791+
// // Some test suites are run inside emulators or on remote devices, and most
792+
// // of our test binaries are linked dynamically which means we need to ship
793+
// // the standard library and such to the emulator ahead of time. This step
794+
// // represents this and is a dependency of all test suites.
795+
// //
796+
// // Most of the time this step is a noop (the `check::emulator_copy_libs`
797+
// // only does work if necessary). For some steps such as shipping data to
798+
// // QEMU we have to build our own tools so we've got conditional dependencies
799+
// // on those programs as well. Note that the remote test client is built for
800+
// // the build target (us) and the server is built for the target.
801+
// rules.test("remote-copy-libs", "path/to/nowhere")
802+
// .dep(|s| s.name("libtest"))
803+
// .dep(move |s| {
804+
// if build.remote_tested(s.target) {
805+
// s.name("tool-remote-test-client").target(s.host).stage(0)
806+
// } else {
807+
// Step::noop()
808+
// }
809+
// })
810+
// .dep(move |s| {
811+
// if build.remote_tested(s.target) {
812+
// s.name("tool-remote-test-server")
813+
// } else {
814+
// Step::noop()
815+
// }
816+
// })
817+
// .run(move |s| check::remote_copy_libs(build, &s.compiler(), s.target));
818+
//
599819
pub fn remote_copy_libs(build: &Build, compiler: &Compiler, target: &str) {
600820
if !build.remote_tested(target) {
601821
return
@@ -632,6 +852,11 @@ pub fn remote_copy_libs(build: &Build, compiler: &Compiler, target: &str) {
632852
}
633853
}
634854

855+
//rules.test("check-distcheck", "distcheck")
856+
// .dep(|s| s.name("dist-plain-source-tarball"))
857+
// .dep(|s| s.name("dist-src"))
858+
// .run(move |_| check::distcheck(build));
859+
635860
/// Run "distcheck", a 'make check' from a tarball
636861
pub fn distcheck(build: &Build) {
637862
if build.build != "x86_64-unknown-linux-gnu" {
@@ -684,6 +909,12 @@ pub fn distcheck(build: &Build) {
684909
.current_dir(&dir));
685910
}
686911

912+
//rules.test("check-bootstrap", "src/bootstrap")
913+
// .default(true)
914+
// .host(true)
915+
// .only_build(true)
916+
// .run(move |_| check::bootstrap(build));
917+
//
687918
/// Test the build system itself
688919
pub fn bootstrap(build: &Build) {
689920
let mut cmd = Command::new(&build.initial_cargo);

0 commit comments

Comments
 (0)