Skip to content
/ rust Public
forked from rust-lang/rust

Commit c568da9

Browse files
committed
make bootstrap self test to use bootstrap cargo
Signed-off-by: onur-ozkan <[email protected]>
1 parent b605c65 commit c568da9

File tree

2 files changed

+26
-15
lines changed

2 files changed

+26
-15
lines changed

src/bootstrap/src/core/build_steps/test.rs

+25-14
Original file line numberDiff line numberDiff line change
@@ -3113,23 +3113,34 @@ impl Step for Bootstrap {
31133113
// Use `python -m unittest` manually if you want to pass arguments.
31143114
check_bootstrap.delay_failure().run(builder);
31153115

3116-
let mut cmd = command(&builder.initial_cargo);
3117-
cmd.arg("test")
3118-
.current_dir(builder.src.join("src/bootstrap"))
3119-
.env("RUSTFLAGS", "--cfg test -Cdebuginfo=2")
3116+
let mut cargo = tool::prepare_tool_cargo(
3117+
builder,
3118+
compiler,
3119+
Mode::ToolBootstrap,
3120+
host,
3121+
Kind::Test,
3122+
"src/bootstrap",
3123+
SourceType::InTree,
3124+
&[],
3125+
);
3126+
3127+
cargo
3128+
.rustflag("-Cdebuginfo=2")
31203129
.env("CARGO_TARGET_DIR", builder.out.join("bootstrap"))
3121-
.env("RUSTC_BOOTSTRAP", "1")
3122-
.env("RUSTDOC", builder.rustdoc(compiler))
3123-
.env("RUSTC", &builder.initial_rustc);
3124-
if let Some(flags) = option_env!("RUSTFLAGS") {
3125-
// Use the same rustc flags for testing as for "normal" compilation,
3126-
// so that Cargo doesn’t recompile the entire dependency graph every time:
3127-
// https://github.com/rust-lang/rust/issues/49215
3128-
cmd.env("RUSTFLAGS", flags);
3129-
}
3130+
.env("RUSTC_BOOTSTRAP", "1");
3131+
31303132
// bootstrap tests are racy on directory creation so just run them one at a time.
31313133
// Since there's not many this shouldn't be a problem.
3132-
run_cargo_test(cmd, &["--test-threads=1"], &[], "bootstrap", None, compiler, host, builder);
3134+
run_cargo_test(
3135+
cargo,
3136+
&["--test-threads=1"],
3137+
&[],
3138+
"bootstrap",
3139+
None,
3140+
compiler,
3141+
host,
3142+
builder,
3143+
);
31333144
}
31343145

31353146
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {

src/bootstrap/src/core/config/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn detect_src_and_out() {
9292
// `{build-dir}/bootstrap/debug/deps/bootstrap-c7ee91d5661e2804`
9393
// `{build-dir}` can be anywhere, not just in the rust project directory.
9494
let dep = Path::new(args.first().unwrap());
95-
let expected_out = dep.ancestors().nth(4).unwrap();
95+
let expected_out = dep.ancestors().nth(5).unwrap();
9696

9797
assert_eq!(&cfg.out, expected_out);
9898
}

0 commit comments

Comments
 (0)