提交 35c76c68 编写于 作者: S Scott Olson

Ignore non-Rust files in run-pass.

Specifically, Vim's .<filename>.swp files were being run as tests.
上级 51edf7ed
...@@ -52,20 +52,23 @@ fn compile_test() { ...@@ -52,20 +52,23 @@ fn compile_test() {
for_all_targets(&sysroot, |target| { for_all_targets(&sysroot, |target| {
for file in std::fs::read_dir("tests/run-pass").unwrap() { for file in std::fs::read_dir("tests/run-pass").unwrap() {
let file = file.unwrap(); let file = file.unwrap();
if !file.metadata().unwrap().is_file() { let path = file.path();
if !file.metadata().unwrap().is_file() || !path.to_str().unwrap().ends_with(".rs") {
continue; continue;
} }
let file = file.path();
let stderr = std::io::stderr(); let stderr = std::io::stderr();
write!(stderr.lock(), "test [miri-pass] {} ", file.to_str().unwrap()).unwrap(); write!(stderr.lock(), "test [miri-pass] {} ... ", path.display()).unwrap();
let mut cmd = std::process::Command::new("target/debug/miri"); let mut cmd = std::process::Command::new("target/debug/miri");
cmd.arg(file); cmd.arg(path);
cmd.arg("-Dwarnings"); cmd.arg("-Dwarnings");
cmd.arg(format!("--target={}", target)); cmd.arg(format!("--target={}", target));
let libs = Path::new(&sysroot).join("lib"); let libs = Path::new(&sysroot).join("lib");
let sysroot = libs.join("rustlib").join(&target).join("lib"); let sysroot = libs.join("rustlib").join(&target).join("lib");
let paths = std::env::join_paths(&[libs, sysroot]).unwrap(); let paths = std::env::join_paths(&[libs, sysroot]).unwrap();
cmd.env(compiletest::procsrv::dylib_env_var(), paths); cmd.env(compiletest::procsrv::dylib_env_var(), paths);
match cmd.output() { match cmd.output() {
Ok(ref output) if output.status.success() => writeln!(stderr.lock(), "ok").unwrap(), Ok(ref output) if output.status.success() => writeln!(stderr.lock(), "ok").unwrap(),
Ok(output) => { Ok(output) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册