Skip to content

Commit 04a3369

Browse files
committed
Add test for check cross-compilation
1 parent 273e86f commit 04a3369

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

src/bootstrap/src/core/build_steps/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ fn prepare_compiler_for_check(
253253
// library crates (e.g. compiletest needs libtest).
254254
let build_compiler = builder.compiler(builder.top_stage, host);
255255
builder.std(build_compiler, host);
256-
builder.std(build_compiler, target);
256+
builder.ensure(Std::new(build_compiler, target));
257257
build_compiler
258258
}
259259
Mode::ToolRustc | Mode::Codegen => {

src/bootstrap/src/core/builder/tests.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,6 +1294,38 @@ mod snapshot {
12941294
");
12951295
}
12961296

1297+
#[test]
1298+
fn check_cross_compile() {
1299+
let ctx = TestCtx::new();
1300+
insta::assert_snapshot!(
1301+
ctx.config("check")
1302+
.stage(2)
1303+
.targets(&[TEST_TRIPLE_1])
1304+
.hosts(&[TEST_TRIPLE_1])
1305+
.render_steps(), @r"
1306+
[build] llvm <host>
1307+
[build] rustc 0 <host> -> rustc 1 <host>
1308+
[build] rustc 1 <host> -> std 1 <host>
1309+
[build] rustc 1 <host> -> std 1 <target1>
1310+
[build] llvm <target1>
1311+
[check] rustc 1 <host> -> rustc 2 <target1>
1312+
[check] rustc 1 <host> -> Rustdoc 2 <target1>
1313+
[check] rustc 1 <host> -> cranelift 2 <target1>
1314+
[check] rustc 1 <host> -> gcc 2 <target1>
1315+
[check] rustc 1 <host> -> Clippy 2 <target1>
1316+
[check] rustc 1 <host> -> Miri 2 <target1>
1317+
[check] rustc 1 <host> -> CargoMiri 2 <target1>
1318+
[check] rustc 0 <host> -> MiroptTestTools 1 <target1>
1319+
[check] rustc 1 <host> -> Rustfmt 2 <target1>
1320+
[check] rustc 1 <host> -> rust-analyzer 2 <target1>
1321+
[build] rustc 1 <host> -> rustc 2 <host>
1322+
[build] rustc 2 <host> -> std 2 <host>
1323+
[check] rustc 2 <host> -> std 2 <target1>
1324+
[check] rustc 2 <host> -> TestFloatParse 3 <target1>
1325+
[check] rustc 0 <host> -> FeaturesStatusDump 1 <target1>
1326+
");
1327+
}
1328+
12971329
#[test]
12981330
fn check_library_no_explicit_stage() {
12991331
let ctx = TestCtx::new();
@@ -1344,6 +1376,21 @@ mod snapshot {
13441376
");
13451377
}
13461378

1379+
#[test]
1380+
fn check_library_cross_compile() {
1381+
let ctx = TestCtx::new();
1382+
insta::assert_snapshot!(
1383+
ctx.config("check")
1384+
.paths(&["core", "alloc", "std"])
1385+
.targets(&[TEST_TRIPLE_1, TEST_TRIPLE_2])
1386+
.render_steps(), @r"
1387+
[build] llvm <host>
1388+
[build] rustc 0 <host> -> rustc 1 <host>
1389+
[check] rustc 1 <host> -> std 1 <target1>
1390+
[check] rustc 1 <host> -> std 1 <target2>
1391+
");
1392+
}
1393+
13471394
#[test]
13481395
fn check_miri_no_explicit_stage() {
13491396
let ctx = TestCtx::new();

0 commit comments

Comments
 (0)