Skip to content

Commit f9a71e0

Browse files
committed
Fix stage0 run-make tests
1 parent d5bd74b commit f9a71e0

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed

src/tools/compiletest/src/runtest/run_make.rs

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,17 @@ impl TestCx<'_> {
259259
p
260260
};
261261

262-
// run-make-support and run-make tests are compiled using the bootstrap compiler
263-
let bootstrap_rustc = {
262+
// run-make-support and run-make tests are compiled using the stage0 compiler
263+
// If the stage is 0, then the compiler that we test (either bootstrap or an explicitly
264+
// set compiler) is the one that actually compiled run-make-support.
265+
let stage0_rustc = if self.config.stage == 0 {
266+
self.config.rustc_path.clone()
267+
} else {
264268
let mut p = build_root.join("stage0").join("bin").join("rustc");
265269
p.set_extension(env::consts::EXE_EXTENSION);
266270
p
267271
};
268-
let mut rustc = Command::new(bootstrap_rustc);
272+
let mut rustc = Command::new(stage0_rustc);
269273
rustc
270274
.arg("-o")
271275
.arg(&recipe_bin)
@@ -298,15 +302,29 @@ impl TestCx<'_> {
298302
// These dylib directories are needed to **execute the recipe**.
299303
let recipe_dylib_search_paths = {
300304
let mut paths = base_dylib_search_paths.clone();
301-
// This is the bootstrap stdlib required to run the rmake recipe itself
302-
paths.push(
303-
build_root
304-
.join("stage0")
305-
.join("lib")
306-
.join("rustlib")
307-
.join(&self.config.host)
308-
.join("lib"),
309-
);
305+
// This is the stage0 stdlib required to run the rmake recipe itself
306+
if self.config.stage == 0 {
307+
// If we're on stage0, the compiler that compiled rmake is the same one that we
308+
// are testing.
309+
// But we cannot use self.config.run_lib_path, because that is stage0 + in-tree
310+
// std. So we build the path ourselves.
311+
paths.push(
312+
self.config
313+
.compile_lib_path
314+
.join("rustlib")
315+
.join(&self.config.host)
316+
.join("lib"),
317+
);
318+
} else {
319+
paths.push(
320+
build_root
321+
.join("stage0")
322+
.join("lib")
323+
.join("rustlib")
324+
.join(&self.config.host)
325+
.join("lib"),
326+
);
327+
}
310328
paths
311329
};
312330

0 commit comments

Comments
 (0)