Stub out less code
This commit is contained in:
@@ -691,7 +691,7 @@ impl<'a> Builder<'a> {
|
|||||||
// the options through environment variables that are fetched and understood by both.
|
// the options through environment variables that are fetched and understood by both.
|
||||||
//
|
//
|
||||||
// FIXME: the guard against msvc shouldn't need to be here
|
// FIXME: the guard against msvc shouldn't need to be here
|
||||||
if !target.contains("msvc") && !cfg!(test) {
|
if !target.contains("msvc") {
|
||||||
let ccache = self.config.ccache.as_ref();
|
let ccache = self.config.ccache.as_ref();
|
||||||
let ccacheify = |s: &Path| {
|
let ccacheify = |s: &Path| {
|
||||||
let ccache = match ccache {
|
let ccache = match ccache {
|
||||||
@@ -874,6 +874,8 @@ mod __test {
|
|||||||
|
|
||||||
fn configure(host: &[&str], target: &[&str]) -> Config {
|
fn configure(host: &[&str], target: &[&str]) -> Config {
|
||||||
let mut config = Config::default_opts();
|
let mut config = Config::default_opts();
|
||||||
|
// don't save toolstates
|
||||||
|
config.save_toolstates = None;
|
||||||
config.run_host_only = true;
|
config.run_host_only = true;
|
||||||
config.build = INTERNER.intern_str("A");
|
config.build = INTERNER.intern_str("A");
|
||||||
config.hosts = vec![config.build].clone().into_iter()
|
config.hosts = vec![config.build].clone().into_iter()
|
||||||
|
|||||||
@@ -722,7 +722,6 @@ impl Step for CodegenBackend {
|
|||||||
fn copy_codegen_backends_to_sysroot(builder: &Builder,
|
fn copy_codegen_backends_to_sysroot(builder: &Builder,
|
||||||
compiler: Compiler,
|
compiler: Compiler,
|
||||||
target_compiler: Compiler) {
|
target_compiler: Compiler) {
|
||||||
if cfg!(test) { return; }
|
|
||||||
let build = builder.build;
|
let build = builder.build;
|
||||||
let target = target_compiler.host;
|
let target = target_compiler.host;
|
||||||
|
|
||||||
|
|||||||
@@ -817,7 +817,6 @@ impl Step for UnstableBookGen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn symlink_dir_force(src: &Path, dst: &Path) -> io::Result<()> {
|
fn symlink_dir_force(src: &Path, dst: &Path) -> io::Result<()> {
|
||||||
if cfg!(test) { return Ok(()); }
|
|
||||||
if let Ok(m) = fs::symlink_metadata(dst) {
|
if let Ok(m) = fs::symlink_metadata(dst) {
|
||||||
if m.file_type().is_dir() {
|
if m.file_type().is_dir() {
|
||||||
try!(fs::remove_dir_all(dst));
|
try!(fs::remove_dir_all(dst));
|
||||||
|
|||||||
@@ -367,20 +367,20 @@ impl Build {
|
|||||||
cc_detect::find(&mut build);
|
cc_detect::find(&mut build);
|
||||||
build.verbose("running sanity check");
|
build.verbose("running sanity check");
|
||||||
sanity::check(&mut build);
|
sanity::check(&mut build);
|
||||||
if !cfg!(test) {
|
|
||||||
// If local-rust is the same major.minor as the current version, then force a
|
// If local-rust is the same major.minor as the current version, then force a
|
||||||
// local-rebuild
|
// local-rebuild
|
||||||
let local_version_verbose = output(
|
let local_version_verbose = output(
|
||||||
Command::new(&build.initial_rustc).arg("--version").arg("--verbose"));
|
Command::new(&build.initial_rustc).arg("--version").arg("--verbose"));
|
||||||
let local_release = local_version_verbose
|
let local_release = local_version_verbose
|
||||||
.lines().filter(|x| x.starts_with("release:"))
|
.lines().filter(|x| x.starts_with("release:"))
|
||||||
.next().unwrap().trim_left_matches("release:").trim();
|
.next().unwrap().trim_left_matches("release:").trim();
|
||||||
let my_version = channel::CFG_RELEASE_NUM;
|
let my_version = channel::CFG_RELEASE_NUM;
|
||||||
if local_release.split('.').take(2).eq(my_version.split('.').take(2)) {
|
if local_release.split('.').take(2).eq(my_version.split('.').take(2)) {
|
||||||
build.verbose(&format!("auto-detected local-rebuild {}", local_release));
|
build.verbose(&format!("auto-detected local-rebuild {}", local_release));
|
||||||
build.local_rebuild = true;
|
build.local_rebuild = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
build.verbose("learning about cargo");
|
build.verbose("learning about cargo");
|
||||||
metadata::build(&mut build);
|
metadata::build(&mut build);
|
||||||
|
|
||||||
@@ -426,7 +426,6 @@ impl Build {
|
|||||||
///
|
///
|
||||||
/// After this executes, it will also ensure that `dir` exists.
|
/// After this executes, it will also ensure that `dir` exists.
|
||||||
fn clear_if_dirty(&self, dir: &Path, input: &Path) -> bool {
|
fn clear_if_dirty(&self, dir: &Path, input: &Path) -> bool {
|
||||||
if cfg!(test) { return true; }
|
|
||||||
let stamp = dir.join(".stamp");
|
let stamp = dir.join(".stamp");
|
||||||
let mut cleared = false;
|
let mut cleared = false;
|
||||||
if mtime(&stamp) < mtime(input) {
|
if mtime(&stamp) < mtime(input) {
|
||||||
@@ -697,7 +696,6 @@ impl Build {
|
|||||||
|
|
||||||
/// Returns the path to the linker for the given target if it needs to be overridden.
|
/// Returns the path to the linker for the given target if it needs to be overridden.
|
||||||
fn linker(&self, target: Interned<String>) -> Option<&Path> {
|
fn linker(&self, target: Interned<String>) -> Option<&Path> {
|
||||||
if cfg!(test) { return None; }
|
|
||||||
if let Some(linker) = self.config.target_config.get(&target)
|
if let Some(linker) = self.config.target_config.get(&target)
|
||||||
.and_then(|c| c.linker.as_ref()) {
|
.and_then(|c| c.linker.as_ref()) {
|
||||||
Some(linker)
|
Some(linker)
|
||||||
|
|||||||
@@ -199,11 +199,7 @@ impl Step for ToolBuild {
|
|||||||
|
|
||||||
if !is_expected {
|
if !is_expected {
|
||||||
if !is_ext_tool {
|
if !is_ext_tool {
|
||||||
if cfg!(test) {
|
exit(1);
|
||||||
panic!("unexpected failure -- would have hard exited");
|
|
||||||
} else {
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ pub fn staticlib(name: &str, target: &str) -> String {
|
|||||||
|
|
||||||
/// Copies a file from `src` to `dst`
|
/// Copies a file from `src` to `dst`
|
||||||
pub fn copy(src: &Path, dst: &Path) {
|
pub fn copy(src: &Path, dst: &Path) {
|
||||||
if cfg!(test) { return; }
|
|
||||||
let _ = fs::remove_file(&dst);
|
let _ = fs::remove_file(&dst);
|
||||||
// Attempt to "easy copy" by creating a hard link (symlinks don't work on
|
// Attempt to "easy copy" by creating a hard link (symlinks don't work on
|
||||||
// windows), but if that fails just fall back to a slow `copy` operation.
|
// windows), but if that fails just fall back to a slow `copy` operation.
|
||||||
@@ -67,7 +66,6 @@ pub fn replace_in_file(path: &Path, replacements: &[(&str, &str)]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn read_stamp_file(stamp: &Path) -> Vec<PathBuf> {
|
pub fn read_stamp_file(stamp: &Path) -> Vec<PathBuf> {
|
||||||
if cfg!(test) { return vec![]; }
|
|
||||||
let mut paths = Vec::new();
|
let mut paths = Vec::new();
|
||||||
let mut contents = Vec::new();
|
let mut contents = Vec::new();
|
||||||
t!(t!(File::open(stamp)).read_to_end(&mut contents));
|
t!(t!(File::open(stamp)).read_to_end(&mut contents));
|
||||||
|
|||||||
Reference in New Issue
Block a user