fn run(self, builder: &Builder<'_>) {
        let compiler = self.compiler;
        let target = self.target;
        let mode = self.mode;
        let test_kind = self.test_kind;
        let krate = self.krate;

        builder.ensure(compile::Std { compiler, target });
        builder.ensure(RemoteCopyLibs { compiler, target });

        // If we're not doing a full bootstrap but we're testing a stage2
        // version of libstd, then what we're actually testing is the libstd
        // produced in stage1. Reflect that here by updating the compiler that
        // we're working with automatically.
        let compiler = builder.compiler_for(compiler.stage, compiler.host, target);

        let mut cargo =
            builder.cargo(compiler, mode, SourceType::InTree, target, test_kind.subcommand());
        match mode {
            Mode::Std => {
                compile::std_cargo(builder, target, compiler.stage, &mut cargo);
            }
            Mode::Rustc => {
                builder.ensure(compile::Rustc { compiler, target });
                compile::rustc_cargo(builder, &mut cargo, target);
            }
            _ => panic!("can only test libraries"),
        };

        // Build up the base `cargo test` command.
        //
        // Pass in some standard flags then iterate over the graph we've discovered
        // in `cargo metadata` with the maps above and figure out what `-p`
        // arguments need to get passed.
        if test_kind.subcommand() == "test" && !builder.fail_fast {
            cargo.arg("--no-fail-fast");
        }
        match builder.doc_tests {
            DocTests::Only => {
                cargo.arg("--doc");
            }
            DocTests::No => {
                cargo.args(&["--lib", "--bins", "--examples", "--tests", "--benches"]);
            }
            DocTests::Yes => {}
        }

        cargo.arg("-p").arg(krate);

        // The tests are going to run with the *target* libraries, so we need to
        // ensure that those libraries show up in the LD_LIBRARY_PATH equivalent.
        //
        // Note that to run the compiler we need to run with the *host* libraries,
        // but our wrapper scripts arrange for that to be the case anyway.
        let mut dylib_path = dylib_path();
        dylib_path.insert(0, PathBuf::from(&*builder.sysroot_libdir(compiler, target)));
        cargo.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());

        cargo.arg("--");
        cargo.args(&builder.config.cmd.test_args());

        if !builder.config.verbose_tests {
            cargo.arg("--quiet");
        }

        if target.contains("emscripten") {
            cargo.env(
                format!("CARGO_TARGET_{}_RUNNER", envify(&target)),
                builder.config.nodejs.as_ref().expect("nodejs not configured"),
            );
        } else if target.starts_with("wasm32") {
            let node = builder.config.nodejs.as_ref().expect("nodejs not configured");
            let runner =
                format!("{} {}/src/etc/wasm32-shim.js", node.display(), builder.src.display());
            cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target)), &runner);
        } else if builder.remote_tested(target) {
            cargo.env(
                format!("CARGO_TARGET_{}_RUNNER", envify(&target)),
                format!("{} run 0", builder.tool_exe(Tool::RemoteTestClient).display()),
            );
        }

        builder.info(&format!(
            "{} {} stage{} ({} -> {})",
            test_kind, krate, compiler.stage, &compiler.host, target
        ));
        let _time = util::timeit(&builder);
        try_run(builder, &mut cargo.into());
    }
/// Runs all unit tests plus documentation tests for a given crate defined
/// by a `Cargo.toml` (single manifest)
///
/// This is what runs tests for crates like the standard library, compiler, etc.
/// It essentially is the driver for running `cargo test`.
///
/// Currently this runs all tests for a DAG by passing a bunch of `-p foo`
/// arguments, and those arguments are discovered from `cargo metadata`.
Runs all unit tests plus documentation tests for a given crate defined
by a `Cargo.toml` (single manifest)

This is what runs tests for crates like the standard library, compiler, etc.
It essentially is the driver for running `cargo test`.

Currently this runs all tests for a DAG by passing a bunch of `-p foo`
arguments, and those arguments are discovered from `cargo metadata`.
Runs all unit tests plus documentation tests for a given crate defined by a ` Cargo . toml ` ( single manifest ) This is what runs tests for crates like the standard library compiler etc . It essentially is the driver for running ` cargo test ` . Currently this runs all tests for a DAG by passing a bunch of ` - p foo ` arguments and those arguments are discovered from ` cargo metadata ` .
fn run(self, builder: &Builder<'_>) {
        let compiler = self.compiler;
        let target = self.target;
        let mode = self.mode;
        let test_kind = self.test_kind;
        let krate = self.krate;
        builder.ensure(compile::Std { compiler, target });
        builder.ensure(RemoteCopyLibs { compiler, target });
        // If we're not doing a full bootstrap but we're testing a stage2
        // version of libstd, then what we're actually testing is the libstd
        // produced in stage1. Reflect that here by updating the compiler that
        // we're working with automatically.
        let compiler = builder.compiler_for(compiler.stage, compiler.host, target);
        let mut cargo =
            builder.cargo(compiler, mode, SourceType::InTree, target, test_kind.subcommand());
        match mode {
            Mode::Std => {
                compile::std_cargo(builder, target, compiler.stage, &mut cargo);
            }
            Mode::Rustc => {
                builder.ensure(compile::Rustc { compiler, target });
                compile::rustc_cargo(builder, &mut cargo, target);
            }
            _ => panic!("can only test libraries"),
        };
        // Build up the base `cargo test` command.
        //
        // Pass in some standard flags then iterate over the graph we've discovered
        // in `cargo metadata` with the maps above and figure out what `-p`
        // arguments need to get passed.
        if test_kind.subcommand() == "test" && !builder.fail_fast {
            cargo.arg("--no-fail-fast");
        }
        match builder.doc_tests {
            DocTests::Only => {
                cargo.arg("--doc");
            }
            DocTests::No => {
                cargo.args(&["--lib", "--bins", "--examples", "--tests", "--benches"]);
            }
            DocTests::Yes => {}
        }
        cargo.arg("-p").arg(krate);
        // The tests are going to run with the *target* libraries, so we need to
        // ensure that those libraries show up in the LD_LIBRARY_PATH equivalent.
        //
        // Note that to run the compiler we need to run with the *host* libraries,
        // but our wrapper scripts arrange for that to be the case anyway.
        let mut dylib_path = dylib_path();
        dylib_path.insert(0, PathBuf::from(&*builder.sysroot_libdir(compiler, target)));
        cargo.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
        cargo.arg("--");
        cargo.args(&builder.config.cmd.test_args());
        if !builder.config.verbose_tests {
            cargo.arg("--quiet");
        }
        if target.contains("emscripten") {
            cargo.env(
                format!("CARGO_TARGET_{}_RUNNER", envify(&target)),
                builder.config.nodejs.as_ref().expect("nodejs not configured"),
            );
        } else if target.starts_with("wasm32") {
            let node = builder.config.nodejs.as_ref().expect("nodejs not configured");
            let runner =
                format!("{} {}/src/etc/wasm32-shim.js", node.display(), builder.src.display());
            cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target)), &runner);
        } else if builder.remote_tested(target) {
            cargo.env(
                format!("CARGO_TARGET_{}_RUNNER", envify(&target)),
                format!("{} run 0", builder.tool_exe(Tool::RemoteTestClient).display()),
            );
        }
        builder.info(&format!(
            "{} {} stage{} ({} -> {})",
            test_kind, krate, compiler.stage, &compiler.host, target
        ));
        let _time = util::timeit(&builder);
        try_run(builder, &mut cargo.into());
    }
fn run ( self , builder : & Builder < ' _ > ) { let compiler = self . compiler ; let target = self . target ; let mode = self . mode ; let test_kind = self . test_kind ; let krate = self . krate ; builder . ensure ( compile :: Std { compiler , target } ) ; builder . ensure ( RemoteCopyLibs { compiler , target } ) ; // If we're not doing a full bootstrap but we're testing a stage2 // version of libstd, then what we're actually testing is the libstd // produced in stage1. Reflect that here by updating the compiler that // we're working with automatically. let compiler = builder . compiler_for ( compiler . stage , compiler . host , target ) ; let mut cargo = builder . cargo ( compiler , mode , SourceType :: InTree , target , test_kind . subcommand ( ) ) ; match mode { Mode :: Std => { compile :: std_cargo ( builder , target , compiler . stage , & mut cargo ) ; } Mode :: Rustc => { builder . ensure ( compile :: Rustc { compiler , target } ) ; compile :: rustc_cargo ( builder , & mut cargo , target ) ; } _ => panic ! ( " " ) , } ; // Build up the base `cargo test` command. // // Pass in some standard flags then iterate over the graph we've discovered // in `cargo metadata` with the maps above and figure out what `-p` // arguments need to get passed. if test_kind . subcommand ( ) == " " && ! builder . fail_fast { cargo . arg ( " " ) ; } match builder . doc_tests { DocTests :: Only => { cargo . arg ( " " ) ; } DocTests :: No => { cargo . args ( & [ " " , " " , " " , " " , " " ] ) ; } DocTests :: Yes => { } } cargo . arg ( " " ) . arg ( krate ) ; // The tests are going to run with the *target* libraries, so we need to // ensure that those libraries show up in the LD_LIBRARY_PATH equivalent. // // Note that to run the compiler we need to run with the *host* libraries, // but our wrapper scripts arrange for that to be the case anyway. let mut dylib_path = dylib_path ( ) ; dylib_path . insert ( 0 , PathBuf :: from ( & * builder . sysroot_libdir ( compiler , target ) ) ) ; cargo . env ( dylib_path_var ( ) , env :: join_paths ( & dylib_path ) . unwrap ( ) ) ; cargo . arg ( " " ) ; cargo . args ( & builder . config . cmd . test_args ( ) ) ; if ! builder . config . verbose_tests { cargo . arg ( " " ) ; } if target . contains ( " " ) { cargo . env ( format ! ( " " envify ( target ) ) , builder . config . nodejs . as_ref ( ) . expect ( " " ) , ) ; } else if target . starts_with ( " " ) { let node = builder . config . nodejs . as_ref ( ) . expect ( " " ) ; let runner = format ! ( " " node display ( ) builder src display ( ) ) ; cargo . env ( format ! ( " " envify ( target ) ) , & runner ) ; } else if builder . remote_tested ( target ) { cargo . env ( format ! ( " " envify ( target ) ) , format ! ( " " builder tool_exe ( Tool RemoteTestClient ) display ( ) ) , ) ; } builder . info ( & format ! ( " " test_kind krate compiler stage compiler host target ) ) ; let _time = util :: timeit ( & builder ) ; try_run ( builder , & mut cargo . into ( ) ) ; }
Runs all unit tests plus documentation tests for a given crate defined
by a `Cargo.toml` (single manifest)
Runs all unit tests plus documentation tests for a given crate defined by a ` Cargo . toml ` ( single manifest )
self
builder
&Builder<'_>
self
builder
&Builder<'_>