sysroot_kind,
cg_clif_dylib,
bootstrap_host_compiler,
- &bootstrap_host_compiler.triple,
+ bootstrap_host_compiler.triple.clone(),
);
eprintln!("Running abi-cafe");
sysroot_kind: SysrootKind,
cg_clif_dylib_src: &Path,
bootstrap_host_compiler: &Compiler,
- target_triple: &str,
-) {
+ target_triple: String,
+) -> Compiler {
eprintln!("[BUILD] sysroot {:?}", sysroot_kind);
DIST_DIR.ensure_fresh(dirs);
BIN_DIR.ensure_exists(dirs);
LIB_DIR.ensure_exists(dirs);
+ let is_native = bootstrap_host_compiler.triple == target_triple;
+
// Copy the backend
let cg_clif_dylib_path = if cfg!(windows) {
// Windows doesn't have rpath support, so the cg_clif dylib needs to be next to the
let host_rustlib_lib =
RUSTLIB_DIR.to_path(dirs).join(&bootstrap_host_compiler.triple).join("lib");
- let target_rustlib_lib = RUSTLIB_DIR.to_path(dirs).join(target_triple).join("lib");
+ let target_rustlib_lib = RUSTLIB_DIR.to_path(dirs).join(&target_triple).join("lib");
fs::create_dir_all(&host_rustlib_lib).unwrap();
fs::create_dir_all(&target_rustlib_lib).unwrap();
if target_triple == "x86_64-pc-windows-gnu" {
- if !default_sysroot.join("lib").join("rustlib").join(target_triple).join("lib").exists() {
+ if !default_sysroot.join("lib").join("rustlib").join(&target_triple).join("lib").exists() {
eprintln!(
"The x86_64-pc-windows-gnu target needs to be installed first before it is possible \
to compile a sysroot for it.",
process::exit(1);
}
for file in fs::read_dir(
- default_sysroot.join("lib").join("rustlib").join(target_triple).join("lib"),
+ default_sysroot.join("lib").join("rustlib").join(&target_triple).join("lib"),
)
.unwrap()
{
try_hard_link(&file, host_rustlib_lib.join(file.file_name().unwrap()));
}
- if target_triple != bootstrap_host_compiler.triple {
+ if !is_native {
for file in fs::read_dir(
- default_sysroot.join("lib").join("rustlib").join(target_triple).join("lib"),
+ default_sysroot.join("lib").join("rustlib").join(&target_triple).join("lib"),
)
.unwrap()
{
&cg_clif_dylib_path,
);
- if bootstrap_host_compiler.triple != target_triple {
+ if !is_native {
build_clif_sysroot_for_triple(
dirs,
channel,
{
let mut bootstrap_target_compiler = bootstrap_host_compiler.clone();
- bootstrap_target_compiler.triple = target_triple.to_owned();
+ bootstrap_target_compiler.triple = target_triple.clone();
bootstrap_target_compiler.set_cross_linker_and_runner();
bootstrap_target_compiler
},
}
}
}
+
+ let mut target_compiler = Compiler::clif_with_triple(&dirs, target_triple);
+ if !is_native {
+ target_compiler.set_cross_linker_and_runner();
+ }
+ target_compiler
}
pub(crate) static ORIG_BUILD_SYSROOT: RelPath = RelPath::SOURCE.join("build_sysroot");
sysroot_kind,
&cg_clif_dylib,
&bootstrap_host_compiler,
- &target_triple,
+ target_triple.clone(),
);
if bootstrap_host_compiler.triple == target_triple {
sysroot_kind,
&cg_clif_dylib,
&bootstrap_host_compiler,
- &target_triple,
+ target_triple,
);
}
Command::Bench => {
sysroot_kind,
&cg_clif_dylib,
&bootstrap_host_compiler,
- &target_triple,
+ target_triple,
);
bench::benchmark(&dirs, &bootstrap_host_compiler);
}
sysroot_kind: SysrootKind,
cg_clif_dylib: &Path,
bootstrap_host_compiler: &Compiler,
- target_triple: &str,
+ target_triple: String,
) {
- let runner =
- TestRunner::new(dirs.clone(), target_triple.to_owned(), get_host_triple() == target_triple);
-
if config::get_bool("testsuite.no_sysroot") {
- build_sysroot::build_sysroot(
+ let target_compiler = build_sysroot::build_sysroot(
dirs,
channel,
SysrootKind::None,
cg_clif_dylib,
bootstrap_host_compiler,
- &target_triple,
+ target_triple.clone(),
);
+ let runner =
+ TestRunner::new(dirs.clone(), target_compiler, get_host_triple() == target_triple);
+
BUILD_EXAMPLE_OUT_DIR.ensure_fresh(dirs);
runner.run_testsuite(NO_SYSROOT_SUITE);
} else {
let run_extended_sysroot = config::get_bool("testsuite.extended_sysroot");
if run_base_sysroot || run_extended_sysroot {
- build_sysroot::build_sysroot(
+ let target_compiler = build_sysroot::build_sysroot(
dirs,
channel,
sysroot_kind,
cg_clif_dylib,
bootstrap_host_compiler,
- &target_triple,
+ target_triple.clone(),
);
- }
- if run_base_sysroot {
- runner.run_testsuite(BASE_SYSROOT_SUITE);
- } else {
- eprintln!("[SKIP] base_sysroot tests");
- }
+ let runner =
+ TestRunner::new(dirs.clone(), target_compiler, get_host_triple() == target_triple);
- if run_extended_sysroot {
- runner.run_testsuite(EXTENDED_SYSROOT_SUITE);
- } else {
- eprintln!("[SKIP] extended_sysroot tests");
+ if run_base_sysroot {
+ runner.run_testsuite(BASE_SYSROOT_SUITE);
+ } else {
+ eprintln!("[SKIP] base_sysroot tests");
+ }
+
+ if run_extended_sysroot {
+ runner.run_testsuite(EXTENDED_SYSROOT_SUITE);
+ } else {
+ eprintln!("[SKIP] extended_sysroot tests");
+ }
}
}
}
impl TestRunner {
- pub fn new(dirs: Dirs, target_triple: String, is_native: bool) -> Self {
- let mut target_compiler = Compiler::clif_with_triple(&dirs, target_triple);
- if !is_native {
- target_compiler.set_cross_linker_and_runner();
- }
+ pub fn new(dirs: Dirs, mut target_compiler: Compiler, is_native: bool) -> Self {
if let Ok(rustflags) = env::var("RUSTFLAGS") {
target_compiler.rustflags.push(' ');
target_compiler.rustflags.push_str(&rustflags);