Extract Compiler creation from tests.rs
This commit is contained in:
parent
b16dd916f0
commit
808cba2251
@ -2,7 +2,7 @@ use super::build_sysroot;
|
||||
use super::config;
|
||||
use super::path::{Dirs, RelPath};
|
||||
use super::prepare::GitRepo;
|
||||
use super::rustc_info::{get_cargo_path, get_wrapper_file_name};
|
||||
use super::rustc_info::get_wrapper_file_name;
|
||||
use super::utils::{
|
||||
hyperfine_command, spawn_and_wait, spawn_and_wait_with_input, CargoProject, Compiler,
|
||||
};
|
||||
@ -507,11 +507,6 @@ impl TestRunner {
|
||||
let jit_supported =
|
||||
target_triple.contains("x86_64") && is_native && !host_triple.contains("windows");
|
||||
|
||||
let rustc_clif =
|
||||
RelPath::DIST.to_path(&dirs).join(get_wrapper_file_name("rustc-clif", "bin"));
|
||||
let rustdoc_clif =
|
||||
RelPath::DIST.to_path(&dirs).join(get_wrapper_file_name("rustdoc-clif", "bin"));
|
||||
|
||||
let mut rustflags = env::var("RUSTFLAGS").ok().unwrap_or("".to_string());
|
||||
let mut runner = vec![];
|
||||
|
||||
@ -550,25 +545,11 @@ impl TestRunner {
|
||||
rustflags = format!("{} -Clink-arg=-undefined -Clink-arg=dynamic_lookup", rustflags);
|
||||
}
|
||||
|
||||
let host_compiler = Compiler {
|
||||
cargo: get_cargo_path(),
|
||||
rustc: rustc_clif.clone(),
|
||||
rustdoc: rustdoc_clif.clone(),
|
||||
rustflags: String::new(),
|
||||
rustdocflags: String::new(),
|
||||
triple: host_triple,
|
||||
runner: vec![],
|
||||
};
|
||||
let host_compiler = Compiler::clif_with_triple(&dirs, host_triple);
|
||||
|
||||
let target_compiler = Compiler {
|
||||
cargo: get_cargo_path(),
|
||||
rustc: rustc_clif,
|
||||
rustdoc: rustdoc_clif,
|
||||
rustflags: rustflags.clone(),
|
||||
rustdocflags: rustflags,
|
||||
triple: target_triple,
|
||||
runner,
|
||||
};
|
||||
let mut target_compiler = Compiler::clif_with_triple(&dirs, target_triple);
|
||||
target_compiler.rustflags = rustflags;
|
||||
target_compiler.runner = runner;
|
||||
|
||||
Self { is_native, jit_supported, dirs, host_compiler, target_compiler }
|
||||
}
|
||||
|
@ -5,7 +5,9 @@ use std::path::{Path, PathBuf};
|
||||
use std::process::{self, Command, Stdio};
|
||||
|
||||
use super::path::{Dirs, RelPath};
|
||||
use super::rustc_info::{get_cargo_path, get_host_triple, get_rustc_path, get_rustdoc_path};
|
||||
use super::rustc_info::{
|
||||
get_cargo_path, get_host_triple, get_rustc_path, get_rustdoc_path, get_wrapper_file_name,
|
||||
};
|
||||
|
||||
pub(crate) struct Compiler {
|
||||
pub(crate) cargo: PathBuf,
|
||||
@ -41,6 +43,23 @@ impl Compiler {
|
||||
runner: vec![],
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn clif_with_triple(dirs: &Dirs, triple: String) -> Compiler {
|
||||
let rustc_clif =
|
||||
RelPath::DIST.to_path(&dirs).join(get_wrapper_file_name("rustc-clif", "bin"));
|
||||
let rustdoc_clif =
|
||||
RelPath::DIST.to_path(&dirs).join(get_wrapper_file_name("rustdoc-clif", "bin"));
|
||||
|
||||
Compiler {
|
||||
cargo: get_cargo_path(),
|
||||
rustc: rustc_clif.clone(),
|
||||
rustdoc: rustdoc_clif.clone(),
|
||||
rustflags: String::new(),
|
||||
rustdocflags: String::new(),
|
||||
triple,
|
||||
runner: vec![],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct CargoProject {
|
||||
|
Loading…
x
Reference in New Issue
Block a user