Skip to content

Commit

Permalink
Support clang-based run-make tests in rustbuild.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwoerister committed Jan 17, 2019
1 parent 50b2510 commit ea4fb95
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions src/bootstrap/test.rs
Expand Up @@ -1106,13 +1106,13 @@ impl Step for Compiletest {
}).to_string()
})
};
let lldb_exe = if builder.config.lldb_enabled && !target.contains("emscripten") {
let (lldb_exe, clang_exe) =
if builder.config.lldb_enabled && !target.contains("emscripten") {
// Test against the lldb that was just built.
builder.llvm_out(target)
.join("bin")
.join("lldb")
(builder.llvm_out(target).join("bin").join("lldb"),
builder.llvm_out(target).join("bin").join("clang"))
} else {
PathBuf::from("lldb")
(PathBuf::from("lldb"), PathBuf::from("clang"))
};
let lldb_version = Command::new(&lldb_exe)
.arg("--version")
Expand All @@ -1127,6 +1127,31 @@ impl Step for Compiletest {
}
}

let clang_version = Command::new(&clang_exe)
.arg("--version")
.output()
.map(|output| { String::from_utf8_lossy(&output.stdout).to_string() })
.ok();
if let Some(ref vers) = clang_version {
cmd.arg("--clang-version").arg(vers);
}

if let Some(var) = env::var_os("RUSTBUILD_FORCE_CLANG_BASED_TESTS") {
match &var.to_string_lossy()[..] {
"1" | "yes" | "on" => {
cmd.arg("--force-clang-based-tests");
}
"0" | "no" | "off" => {
// Nothing to do.
}
other => {
// Let's make sure typos don't get unnoticed
panic!("Unrecognized option '{}' set in \
RUSTBUILD_FORCE_CLANG_BASED_TESTS", other);
}
}
}

// Get paths from cmd args
let paths = match &builder.config.cmd {
Subcommand::Test { ref paths, .. } => &paths[..],
Expand Down

0 comments on commit ea4fb95

Please sign in to comment.