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