]> git.lizzy.rs Git - rust.git/blob - src/bootstrap/check.rs
Rollup merge of #38699 - japaric:lsan, r=alexcrichton
[rust.git] / src / bootstrap / check.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 //! Implementation of the test-related targets of the build system.
12 //!
13 //! This file implements the various regression test suites that we execute on
14 //! our CI.
15
16 extern crate build_helper;
17
18 use std::collections::HashSet;
19 use std::env;
20 use std::fmt;
21 use std::fs;
22 use std::path::{PathBuf, Path};
23 use std::process::Command;
24
25 use build_helper::output;
26
27 use {Build, Compiler, Mode};
28 use dist;
29 use util::{self, dylib_path, dylib_path_var, exe};
30
31 const ADB_TEST_DIR: &'static str = "/data/tmp";
32
33 /// The two modes of the test runner; tests or benchmarks.
34 #[derive(Copy, Clone)]
35 pub enum TestKind {
36     /// Run `cargo test`
37     Test,
38     /// Run `cargo bench`
39     Bench,
40 }
41
42 impl TestKind {
43     // Return the cargo subcommand for this test kind
44     fn subcommand(self) -> &'static str {
45         match self {
46             TestKind::Test => "test",
47             TestKind::Bench => "bench",
48         }
49     }
50 }
51
52 impl fmt::Display for TestKind {
53     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
54         f.write_str(match *self {
55             TestKind::Test => "Testing",
56             TestKind::Bench => "Benchmarking",
57         })
58     }
59 }
60
61 /// Runs the `linkchecker` tool as compiled in `stage` by the `host` compiler.
62 ///
63 /// This tool in `src/tools` will verify the validity of all our links in the
64 /// documentation to ensure we don't have a bunch of dead ones.
65 pub fn linkcheck(build: &Build, host: &str) {
66     println!("Linkcheck ({})", host);
67     let compiler = Compiler::new(0, host);
68
69     let _time = util::timeit();
70     build.run(build.tool_cmd(&compiler, "linkchecker")
71                    .arg(build.out.join(host).join("doc")));
72 }
73
74 /// Runs the `cargotest` tool as compiled in `stage` by the `host` compiler.
75 ///
76 /// This tool in `src/tools` will check out a few Rust projects and run `cargo
77 /// test` to ensure that we don't regress the test suites there.
78 pub fn cargotest(build: &Build, stage: u32, host: &str) {
79     let ref compiler = Compiler::new(stage, host);
80
81     // Configure PATH to find the right rustc. NB. we have to use PATH
82     // and not RUSTC because the Cargo test suite has tests that will
83     // fail if rustc is not spelled `rustc`.
84     let path = build.sysroot(compiler).join("bin");
85     let old_path = ::std::env::var("PATH").expect("");
86     let sep = if cfg!(windows) { ";" } else {":" };
87     let ref newpath = format!("{}{}{}", path.display(), sep, old_path);
88
89     // Note that this is a short, cryptic, and not scoped directory name. This
90     // is currently to minimize the length of path on Windows where we otherwise
91     // quickly run into path name limit constraints.
92     let out_dir = build.out.join("ct");
93     t!(fs::create_dir_all(&out_dir));
94
95     let _time = util::timeit();
96     let mut cmd = Command::new(build.tool(&Compiler::new(0, host), "cargotest"));
97     build.prepare_tool_cmd(compiler, &mut cmd);
98     build.run(cmd.env("PATH", newpath)
99                  .arg(&build.cargo)
100                  .arg(&out_dir));
101 }
102
103 /// Runs the `tidy` tool as compiled in `stage` by the `host` compiler.
104 ///
105 /// This tool in `src/tools` checks up on various bits and pieces of style and
106 /// otherwise just implements a few lint-like checks that are specific to the
107 /// compiler itself.
108 pub fn tidy(build: &Build, host: &str) {
109     println!("tidy check ({})", host);
110     let compiler = Compiler::new(0, host);
111     build.run(build.tool_cmd(&compiler, "tidy")
112                    .arg(build.src.join("src")));
113 }
114
115 fn testdir(build: &Build, host: &str) -> PathBuf {
116     build.out.join(host).join("test")
117 }
118
119 /// Executes the `compiletest` tool to run a suite of tests.
120 ///
121 /// Compiles all tests with `compiler` for `target` with the specified
122 /// compiletest `mode` and `suite` arguments. For example `mode` can be
123 /// "run-pass" or `suite` can be something like `debuginfo`.
124 pub fn compiletest(build: &Build,
125                    compiler: &Compiler,
126                    target: &str,
127                    mode: &str,
128                    suite: &str) {
129     println!("Check compiletest suite={} mode={} ({} -> {})",
130              suite, mode, compiler.host, target);
131     let mut cmd = Command::new(build.tool(&Compiler::new(0, compiler.host),
132                                           "compiletest"));
133     build.prepare_tool_cmd(compiler, &mut cmd);
134
135     // compiletest currently has... a lot of arguments, so let's just pass all
136     // of them!
137
138     cmd.arg("--compile-lib-path").arg(build.rustc_libdir(compiler));
139     cmd.arg("--run-lib-path").arg(build.sysroot_libdir(compiler, target));
140     cmd.arg("--rustc-path").arg(build.compiler_path(compiler));
141     cmd.arg("--rustdoc-path").arg(build.rustdoc(compiler));
142     cmd.arg("--src-base").arg(build.src.join("src/test").join(suite));
143     cmd.arg("--build-base").arg(testdir(build, compiler.host).join(suite));
144     cmd.arg("--stage-id").arg(format!("stage{}-{}", compiler.stage, target));
145     cmd.arg("--mode").arg(mode);
146     cmd.arg("--target").arg(target);
147     cmd.arg("--host").arg(compiler.host);
148     cmd.arg("--llvm-filecheck").arg(build.llvm_filecheck(&build.config.build));
149
150     if let Some(nodejs) = build.config.nodejs.as_ref() {
151         cmd.arg("--nodejs").arg(nodejs);
152     }
153
154     let mut flags = vec!["-Crpath".to_string()];
155     if build.config.rust_optimize_tests {
156         flags.push("-O".to_string());
157     }
158     if build.config.rust_debuginfo_tests {
159         flags.push("-g".to_string());
160     }
161
162     let mut hostflags = build.rustc_flags(&compiler.host);
163     hostflags.extend(flags.clone());
164     cmd.arg("--host-rustcflags").arg(hostflags.join(" "));
165
166     let mut targetflags = build.rustc_flags(&target);
167     targetflags.extend(flags);
168     targetflags.push(format!("-Lnative={}",
169                              build.test_helpers_out(target).display()));
170     cmd.arg("--target-rustcflags").arg(targetflags.join(" "));
171
172     cmd.arg("--docck-python").arg(build.python());
173
174     if build.config.build.ends_with("apple-darwin") {
175         // Force /usr/bin/python on OSX for LLDB tests because we're loading the
176         // LLDB plugin's compiled module which only works with the system python
177         // (namely not Homebrew-installed python)
178         cmd.arg("--lldb-python").arg("/usr/bin/python");
179     } else {
180         cmd.arg("--lldb-python").arg(build.python());
181     }
182
183     if let Some(ref gdb) = build.config.gdb {
184         cmd.arg("--gdb").arg(gdb);
185     }
186     if let Some(ref vers) = build.lldb_version {
187         cmd.arg("--lldb-version").arg(vers);
188     }
189     if let Some(ref dir) = build.lldb_python_dir {
190         cmd.arg("--lldb-python-dir").arg(dir);
191     }
192     let llvm_config = build.llvm_config(target);
193     let llvm_version = output(Command::new(&llvm_config).arg("--version"));
194     cmd.arg("--llvm-version").arg(llvm_version);
195
196     cmd.args(&build.flags.cmd.test_args());
197
198     if build.config.verbose() || build.flags.verbose() {
199         cmd.arg("--verbose");
200     }
201
202     if build.config.quiet_tests {
203         cmd.arg("--quiet");
204     }
205
206     // Only pass correct values for these flags for the `run-make` suite as it
207     // requires that a C++ compiler was configured which isn't always the case.
208     if suite == "run-make" {
209         let llvm_components = output(Command::new(&llvm_config).arg("--components"));
210         let llvm_cxxflags = output(Command::new(&llvm_config).arg("--cxxflags"));
211         cmd.arg("--cc").arg(build.cc(target))
212            .arg("--cxx").arg(build.cxx(target))
213            .arg("--cflags").arg(build.cflags(target).join(" "))
214            .arg("--llvm-components").arg(llvm_components.trim())
215            .arg("--llvm-cxxflags").arg(llvm_cxxflags.trim());
216     } else {
217         cmd.arg("--cc").arg("")
218            .arg("--cxx").arg("")
219            .arg("--cflags").arg("")
220            .arg("--llvm-components").arg("")
221            .arg("--llvm-cxxflags").arg("");
222     }
223
224     if build.qemu_rootfs(target).is_some() {
225         cmd.arg("--qemu-test-client")
226            .arg(build.tool(&Compiler::new(0, &build.config.build),
227                            "qemu-test-client"));
228     }
229
230     // Running a C compiler on MSVC requires a few env vars to be set, to be
231     // sure to set them here.
232     //
233     // Note that if we encounter `PATH` we make sure to append to our own `PATH`
234     // rather than stomp over it.
235     if target.contains("msvc") {
236         for &(ref k, ref v) in build.cc[target].0.env() {
237             if k != "PATH" {
238                 cmd.env(k, v);
239             }
240         }
241     }
242     cmd.env("RUSTC_BOOTSTRAP", "1");
243     build.add_rust_test_threads(&mut cmd);
244
245     if build.config.sanitizers {
246         cmd.env("SANITIZER_SUPPORT", "1");
247     }
248
249     cmd.arg("--adb-path").arg("adb");
250     cmd.arg("--adb-test-dir").arg(ADB_TEST_DIR);
251     if target.contains("android") {
252         // Assume that cc for this target comes from the android sysroot
253         cmd.arg("--android-cross-path")
254            .arg(build.cc(target).parent().unwrap().parent().unwrap());
255     } else {
256         cmd.arg("--android-cross-path").arg("");
257     }
258
259     let _time = util::timeit();
260     build.run(&mut cmd);
261 }
262
263 /// Run `rustdoc --test` for all documentation in `src/doc`.
264 ///
265 /// This will run all tests in our markdown documentation (e.g. the book)
266 /// located in `src/doc`. The `rustdoc` that's run is the one that sits next to
267 /// `compiler`.
268 pub fn docs(build: &Build, compiler: &Compiler) {
269     // Do a breadth-first traversal of the `src/doc` directory and just run
270     // tests for all files that end in `*.md`
271     let mut stack = vec![build.src.join("src/doc")];
272     let _time = util::timeit();
273
274     while let Some(p) = stack.pop() {
275         if p.is_dir() {
276             stack.extend(t!(p.read_dir()).map(|p| t!(p).path()));
277             continue
278         }
279
280         if p.extension().and_then(|s| s.to_str()) != Some("md") {
281             continue
282         }
283
284         println!("doc tests for: {}", p.display());
285         markdown_test(build, compiler, &p);
286     }
287 }
288
289 /// Run the error index generator tool to execute the tests located in the error
290 /// index.
291 ///
292 /// The `error_index_generator` tool lives in `src/tools` and is used to
293 /// generate a markdown file from the error indexes of the code base which is
294 /// then passed to `rustdoc --test`.
295 pub fn error_index(build: &Build, compiler: &Compiler) {
296     println!("Testing error-index stage{}", compiler.stage);
297
298     let dir = testdir(build, compiler.host);
299     t!(fs::create_dir_all(&dir));
300     let output = dir.join("error-index.md");
301
302     let _time = util::timeit();
303     build.run(build.tool_cmd(&Compiler::new(0, compiler.host),
304                              "error_index_generator")
305                    .arg("markdown")
306                    .arg(&output)
307                    .env("CFG_BUILD", &build.config.build));
308
309     markdown_test(build, compiler, &output);
310 }
311
312 fn markdown_test(build: &Build, compiler: &Compiler, markdown: &Path) {
313     let mut cmd = Command::new(build.rustdoc(compiler));
314     build.add_rustc_lib_path(compiler, &mut cmd);
315     build.add_rust_test_threads(&mut cmd);
316     cmd.arg("--test");
317     cmd.arg(markdown);
318     cmd.env("RUSTC_BOOTSTRAP", "1");
319
320     let mut test_args = build.flags.cmd.test_args().join(" ");
321     if build.config.quiet_tests {
322         test_args.push_str(" --quiet");
323     }
324     cmd.arg("--test-args").arg(test_args);
325
326     build.run(&mut cmd);
327 }
328
329 /// Run all unit tests plus documentation tests for an entire crate DAG defined
330 /// by a `Cargo.toml`
331 ///
332 /// This is what runs tests for crates like the standard library, compiler, etc.
333 /// It essentially is the driver for running `cargo test`.
334 ///
335 /// Currently this runs all tests for a DAG by passing a bunch of `-p foo`
336 /// arguments, and those arguments are discovered from `cargo metadata`.
337 pub fn krate(build: &Build,
338              compiler: &Compiler,
339              target: &str,
340              mode: Mode,
341              test_kind: TestKind,
342              krate: Option<&str>) {
343     let (name, path, features, root) = match mode {
344         Mode::Libstd => {
345             ("libstd", "src/rustc/std_shim", build.std_features(), "std_shim")
346         }
347         Mode::Libtest => {
348             ("libtest", "src/rustc/test_shim", String::new(), "test_shim")
349         }
350         Mode::Librustc => {
351             ("librustc", "src/rustc", build.rustc_features(), "rustc-main")
352         }
353         _ => panic!("can only test libraries"),
354     };
355     println!("{} {} stage{} ({} -> {})", test_kind, name, compiler.stage,
356              compiler.host, target);
357
358     // If we're not doing a full bootstrap but we're testing a stage2 version of
359     // libstd, then what we're actually testing is the libstd produced in
360     // stage1. Reflect that here by updating the compiler that we're working
361     // with automatically.
362     let compiler = if build.force_use_stage1(compiler, target) {
363         Compiler::new(1, compiler.host)
364     } else {
365         compiler.clone()
366     };
367
368     // Build up the base `cargo test` command.
369     //
370     // Pass in some standard flags then iterate over the graph we've discovered
371     // in `cargo metadata` with the maps above and figure out what `-p`
372     // arguments need to get passed.
373     let mut cargo = build.cargo(&compiler, mode, target, test_kind.subcommand());
374     cargo.arg("--manifest-path")
375          .arg(build.src.join(path).join("Cargo.toml"))
376          .arg("--features").arg(features);
377
378     match krate {
379         Some(krate) => {
380             cargo.arg("-p").arg(krate);
381         }
382         None => {
383             let mut visited = HashSet::new();
384             let mut next = vec![root];
385             while let Some(name) = next.pop() {
386                 // Right now jemalloc is our only target-specific crate in the
387                 // sense that it's not present on all platforms. Custom skip it
388                 // here for now, but if we add more this probably wants to get
389                 // more generalized.
390                 //
391                 // Also skip `build_helper` as it's not compiled normally for
392                 // target during the bootstrap and it's just meant to be a
393                 // helper crate, not tested. If it leaks through then it ends up
394                 // messing with various mtime calculations and such.
395                 if !name.contains("jemalloc") && name != "build_helper" {
396                     cargo.arg("-p").arg(&format!("{}:0.0.0", name));
397                 }
398                 for dep in build.crates[name].deps.iter() {
399                     if visited.insert(dep) {
400                         next.push(dep);
401                     }
402                 }
403             }
404         }
405     }
406
407     // The tests are going to run with the *target* libraries, so we need to
408     // ensure that those libraries show up in the LD_LIBRARY_PATH equivalent.
409     //
410     // Note that to run the compiler we need to run with the *host* libraries,
411     // but our wrapper scripts arrange for that to be the case anyway.
412     let mut dylib_path = dylib_path();
413     dylib_path.insert(0, build.sysroot_libdir(&compiler, target));
414     cargo.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
415
416     if target.contains("android") ||
417        target.contains("emscripten") ||
418        build.qemu_rootfs(target).is_some() {
419         cargo.arg("--no-run");
420     }
421
422     cargo.arg("--");
423
424     if build.config.quiet_tests {
425         cargo.arg("--quiet");
426     }
427
428     let _time = util::timeit();
429
430     if target.contains("android") {
431         build.run(&mut cargo);
432         krate_android(build, &compiler, target, mode);
433     } else if target.contains("emscripten") {
434         build.run(&mut cargo);
435         krate_emscripten(build, &compiler, target, mode);
436     } else if build.qemu_rootfs(target).is_some() {
437         build.run(&mut cargo);
438         krate_qemu(build, &compiler, target, mode);
439     } else {
440         cargo.args(&build.flags.cmd.test_args());
441         build.run(&mut cargo);
442     }
443 }
444
445 fn krate_android(build: &Build,
446                  compiler: &Compiler,
447                  target: &str,
448                  mode: Mode) {
449     let mut tests = Vec::new();
450     let out_dir = build.cargo_out(compiler, mode, target);
451     find_tests(&out_dir, target, &mut tests);
452     find_tests(&out_dir.join("deps"), target, &mut tests);
453
454     for test in tests {
455         build.run(Command::new("adb").arg("push").arg(&test).arg(ADB_TEST_DIR));
456
457         let test_file_name = test.file_name().unwrap().to_string_lossy();
458         let log = format!("{}/check-stage{}-T-{}-H-{}-{}.log",
459                           ADB_TEST_DIR,
460                           compiler.stage,
461                           target,
462                           compiler.host,
463                           test_file_name);
464         let quiet = if build.config.quiet_tests { "--quiet" } else { "" };
465         let program = format!("(cd {dir}; \
466                                 LD_LIBRARY_PATH=./{target} ./{test} \
467                                     --logfile {log} \
468                                     {quiet} \
469                                     {args})",
470                               dir = ADB_TEST_DIR,
471                               target = target,
472                               test = test_file_name,
473                               log = log,
474                               quiet = quiet,
475                               args = build.flags.cmd.test_args().join(" "));
476
477         let output = output(Command::new("adb").arg("shell").arg(&program));
478         println!("{}", output);
479
480         t!(fs::create_dir_all(build.out.join("tmp")));
481         build.run(Command::new("adb")
482                           .arg("pull")
483                           .arg(&log)
484                           .arg(build.out.join("tmp")));
485         build.run(Command::new("adb").arg("shell").arg("rm").arg(&log));
486         if !output.contains("result: ok") {
487             panic!("some tests failed");
488         }
489     }
490 }
491
492 fn krate_emscripten(build: &Build,
493                     compiler: &Compiler,
494                     target: &str,
495                     mode: Mode) {
496     let mut tests = Vec::new();
497     let out_dir = build.cargo_out(compiler, mode, target);
498     find_tests(&out_dir, target, &mut tests);
499     find_tests(&out_dir.join("deps"), target, &mut tests);
500
501     for test in tests {
502         let test_file_name = test.to_string_lossy().into_owned();
503         println!("running {}", test_file_name);
504         let nodejs = build.config.nodejs.as_ref().expect("nodejs not configured");
505         let mut cmd = Command::new(nodejs);
506         cmd.arg(&test_file_name);
507         if build.config.quiet_tests {
508             cmd.arg("--quiet");
509         }
510         build.run(&mut cmd);
511     }
512 }
513
514 fn krate_qemu(build: &Build,
515               compiler: &Compiler,
516               target: &str,
517               mode: Mode) {
518     let mut tests = Vec::new();
519     let out_dir = build.cargo_out(compiler, mode, target);
520     find_tests(&out_dir, target, &mut tests);
521     find_tests(&out_dir.join("deps"), target, &mut tests);
522
523     let tool = build.tool(&Compiler::new(0, &build.config.build),
524                           "qemu-test-client");
525     for test in tests {
526         let mut cmd = Command::new(&tool);
527         cmd.arg("run")
528            .arg(&test);
529         if build.config.quiet_tests {
530             cmd.arg("--quiet");
531         }
532         cmd.args(&build.flags.cmd.test_args());
533         build.run(&mut cmd);
534     }
535 }
536
537
538 fn find_tests(dir: &Path,
539               target: &str,
540               dst: &mut Vec<PathBuf>) {
541     for e in t!(dir.read_dir()).map(|e| t!(e)) {
542         let file_type = t!(e.file_type());
543         if !file_type.is_file() {
544             continue
545         }
546         let filename = e.file_name().into_string().unwrap();
547         if (target.contains("windows") && filename.ends_with(".exe")) ||
548            (!target.contains("windows") && !filename.contains(".")) ||
549            (target.contains("emscripten") && filename.contains(".js")){
550             dst.push(e.path());
551         }
552     }
553 }
554
555 pub fn emulator_copy_libs(build: &Build, compiler: &Compiler, target: &str) {
556     if target.contains("android") {
557         android_copy_libs(build, compiler, target)
558     } else if let Some(s) = build.qemu_rootfs(target) {
559         qemu_copy_libs(build, compiler, target, s)
560     }
561 }
562
563 fn android_copy_libs(build: &Build, compiler: &Compiler, target: &str) {
564     println!("Android copy libs to emulator ({})", target);
565     build.run(Command::new("adb").arg("wait-for-device"));
566     build.run(Command::new("adb").arg("remount"));
567     build.run(Command::new("adb").args(&["shell", "rm", "-r", ADB_TEST_DIR]));
568     build.run(Command::new("adb").args(&["shell", "mkdir", ADB_TEST_DIR]));
569     build.run(Command::new("adb")
570                       .arg("push")
571                       .arg(build.src.join("src/etc/adb_run_wrapper.sh"))
572                       .arg(ADB_TEST_DIR));
573
574     let target_dir = format!("{}/{}", ADB_TEST_DIR, target);
575     build.run(Command::new("adb").args(&["shell", "mkdir", &target_dir[..]]));
576
577     for f in t!(build.sysroot_libdir(compiler, target).read_dir()) {
578         let f = t!(f);
579         let name = f.file_name().into_string().unwrap();
580         if util::is_dylib(&name) {
581             build.run(Command::new("adb")
582                               .arg("push")
583                               .arg(f.path())
584                               .arg(&target_dir));
585         }
586     }
587 }
588
589 fn qemu_copy_libs(build: &Build,
590                   compiler: &Compiler,
591                   target: &str,
592                   rootfs: &Path) {
593     println!("QEMU copy libs to emulator ({})", target);
594     assert!(target.starts_with("arm"), "only works with arm for now");
595     t!(fs::create_dir_all(build.out.join("tmp")));
596
597     // Copy our freshly compiled test server over to the rootfs
598     let server = build.cargo_out(compiler, Mode::Tool, target)
599                       .join(exe("qemu-test-server", target));
600     t!(fs::copy(&server, rootfs.join("testd")));
601
602     // Spawn the emulator and wait for it to come online
603     let tool = build.tool(&Compiler::new(0, &build.config.build),
604                           "qemu-test-client");
605     build.run(Command::new(&tool)
606                       .arg("spawn-emulator")
607                       .arg(rootfs)
608                       .arg(build.out.join("tmp")));
609
610     // Push all our dylibs to the emulator
611     for f in t!(build.sysroot_libdir(compiler, target).read_dir()) {
612         let f = t!(f);
613         let name = f.file_name().into_string().unwrap();
614         if util::is_dylib(&name) {
615             build.run(Command::new(&tool)
616                               .arg("push")
617                               .arg(f.path()));
618         }
619     }
620 }
621
622 /// Run "distcheck", a 'make check' from a tarball
623 pub fn distcheck(build: &Build) {
624     if build.config.build != "x86_64-unknown-linux-gnu" {
625         return
626     }
627     if !build.config.host.iter().any(|s| s == "x86_64-unknown-linux-gnu") {
628         return
629     }
630     if !build.config.target.iter().any(|s| s == "x86_64-unknown-linux-gnu") {
631         return
632     }
633
634     let dir = build.out.join("tmp").join("distcheck");
635     let _ = fs::remove_dir_all(&dir);
636     t!(fs::create_dir_all(&dir));
637
638     let mut cmd = Command::new("tar");
639     cmd.arg("-xzf")
640        .arg(dist::rust_src_location(build))
641        .arg("--strip-components=1")
642        .current_dir(&dir);
643     build.run(&mut cmd);
644     build.run(Command::new("./configure")
645                      .args(&build.config.configure_args)
646                      .current_dir(&dir));
647     build.run(Command::new(build_helper::make(&build.config.build))
648                      .arg("check")
649                      .current_dir(&dir));
650 }
651
652 /// Test the build system itself
653 pub fn bootstrap(build: &Build) {
654     let mut cmd = Command::new(&build.cargo);
655     cmd.arg("test")
656        .current_dir(build.src.join("src/bootstrap"))
657        .env("CARGO_TARGET_DIR", build.out.join("bootstrap"))
658        .env("RUSTC", &build.rustc);
659     cmd.arg("--").args(&build.flags.cmd.test_args());
660     build.run(&mut cmd);
661 }