Fix tests from the rollup
This commit is contained in:
parent
e126f3c6c6
commit
11251e59b9
@ -16,6 +16,7 @@
|
|||||||
//! directory as we want that cached between builds.
|
//! directory as we want that cached between builds.
|
||||||
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
use std::io::{self, ErrorKind};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use Build;
|
use Build;
|
||||||
@ -35,14 +36,47 @@ pub fn clean(build: &Build) {
|
|||||||
if entry.file_name().to_str() == Some("llvm") {
|
if entry.file_name().to_str() == Some("llvm") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
t!(fs::remove_dir_all(&entry.path()));
|
rm_rf(build, &entry.path());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn rm_rf(build: &Build, path: &Path) {
|
fn rm_rf(build: &Build, path: &Path) {
|
||||||
if path.exists() {
|
if !path.exists() {
|
||||||
build.verbose(&format!("removing `{}`", path.display()));
|
return
|
||||||
t!(fs::remove_dir_all(path));
|
}
|
||||||
|
|
||||||
|
for file in t!(fs::read_dir(path)) {
|
||||||
|
let file = t!(file).path();
|
||||||
|
|
||||||
|
if file.is_dir() {
|
||||||
|
rm_rf(build, &file);
|
||||||
|
} else {
|
||||||
|
// On windows we can't remove a readonly file, and git will
|
||||||
|
// often clone files as readonly. As a result, we have some
|
||||||
|
// special logic to remove readonly files on windows.
|
||||||
|
do_op(&file, "remove file", |p| fs::remove_file(p));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
do_op(path, "remove dir", |p| fs::remove_dir(p));
|
||||||
|
}
|
||||||
|
|
||||||
|
fn do_op<F>(path: &Path, desc: &str, mut f: F)
|
||||||
|
where F: FnMut(&Path) -> io::Result<()>
|
||||||
|
{
|
||||||
|
match f(path) {
|
||||||
|
Ok(()) => {}
|
||||||
|
Err(ref e) if cfg!(windows) &&
|
||||||
|
e.kind() == ErrorKind::PermissionDenied => {
|
||||||
|
let mut p = t!(path.metadata()).permissions();
|
||||||
|
p.set_readonly(false);
|
||||||
|
t!(fs::set_permissions(path, p));
|
||||||
|
f(path).unwrap_or_else(|e| {
|
||||||
|
panic!("failed to {} {}: {}", desc, path.display(), e);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
panic!("failed to {} {}: {}", desc, path.display(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -454,6 +454,30 @@ impl Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
fn parse_configure_path(path: &str) -> PathBuf {
|
||||||
|
path.into()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
fn parse_configure_path(path: &str) -> PathBuf {
|
||||||
|
// on windows, configure produces unix style paths e.g. /c/some/path but we
|
||||||
|
// only want real windows paths
|
||||||
|
|
||||||
|
use std::process::Command;
|
||||||
|
use build_helper;
|
||||||
|
|
||||||
|
// '/' is invalid in windows paths, so we can detect unix paths by the presence of it
|
||||||
|
if !path.contains('/') {
|
||||||
|
return path.into();
|
||||||
|
}
|
||||||
|
|
||||||
|
let win_path = build_helper::output(Command::new("cygpath").arg("-w").arg(path));
|
||||||
|
let win_path = win_path.trim();
|
||||||
|
|
||||||
|
win_path.into()
|
||||||
|
}
|
||||||
|
|
||||||
fn set<T>(field: &mut T, val: Option<T>) {
|
fn set<T>(field: &mut T, val: Option<T>) {
|
||||||
if let Some(v) = val {
|
if let Some(v) = val {
|
||||||
*field = v;
|
*field = v;
|
||||||
|
@ -288,13 +288,13 @@ pub fn build_rules(build: &Build) -> Rules {
|
|||||||
None));
|
None));
|
||||||
for (krate, path, _default) in krates("rustc-main") {
|
for (krate, path, _default) in krates("rustc-main") {
|
||||||
rules.test(&krate.test_step, path)
|
rules.test(&krate.test_step, path)
|
||||||
.dep(|s| s.name("libtest"))
|
.dep(|s| s.name("librustc"))
|
||||||
.host(true)
|
.host(true)
|
||||||
.run(move |s| check::krate(build, &s.compiler(), s.target,
|
.run(move |s| check::krate(build, &s.compiler(), s.target,
|
||||||
Mode::Librustc, Some(&krate.name)));
|
Mode::Librustc, Some(&krate.name)));
|
||||||
}
|
}
|
||||||
rules.test("check-rustc-all", "path/to/nowhere")
|
rules.test("check-rustc-all", "path/to/nowhere")
|
||||||
.dep(|s| s.name("libtest"))
|
.dep(|s| s.name("librustc"))
|
||||||
.default(true)
|
.default(true)
|
||||||
.host(true)
|
.host(true)
|
||||||
.run(move |s| check::krate(build, &s.compiler(), s.target, Mode::Librustc,
|
.run(move |s| check::krate(build, &s.compiler(), s.target, Mode::Librustc,
|
||||||
|
@ -722,7 +722,7 @@ pub const KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeGat
|
|||||||
("windows_subsystem", Whitelisted, Gated(Stability::Unstable,
|
("windows_subsystem", Whitelisted, Gated(Stability::Unstable,
|
||||||
"windows_subsystem",
|
"windows_subsystem",
|
||||||
"the windows subsystem attribute \
|
"the windows subsystem attribute \
|
||||||
id currently unstable",
|
is currently unstable",
|
||||||
cfg_fn!(windows_subsystem))),
|
cfg_fn!(windows_subsystem))),
|
||||||
|
|
||||||
// Crate level attributes
|
// Crate level attributes
|
||||||
|
@ -8,8 +8,9 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
// error-pattern: invalid windows subsystem `wrong`, only `windows` and `console` are allowed
|
||||||
|
|
||||||
#![feature(windows_subsystem)]
|
#![feature(windows_subsystem)]
|
||||||
#![windows_subsystem = "wrong"]
|
#![windows_subsystem = "wrong"]
|
||||||
//~^ ERROR: invalid subsystem `wrong`, only `windows` and `console` are allowed
|
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user