Skip to content

Commit ea4fb95

Browse files
Support clang-based run-make tests in rustbuild.
1 parent 50b2510 commit ea4fb95

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

src/bootstrap/test.rs

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,13 +1106,13 @@ impl Step for Compiletest {
11061106
}).to_string()
11071107
})
11081108
};
1109-
let lldb_exe = if builder.config.lldb_enabled && !target.contains("emscripten") {
1109+
let (lldb_exe, clang_exe) =
1110+
if builder.config.lldb_enabled && !target.contains("emscripten") {
11101111
// Test against the lldb that was just built.
1111-
builder.llvm_out(target)
1112-
.join("bin")
1113-
.join("lldb")
1112+
(builder.llvm_out(target).join("bin").join("lldb"),
1113+
builder.llvm_out(target).join("bin").join("clang"))
11141114
} else {
1115-
PathBuf::from("lldb")
1115+
(PathBuf::from("lldb"), PathBuf::from("clang"))
11161116
};
11171117
let lldb_version = Command::new(&lldb_exe)
11181118
.arg("--version")
@@ -1127,6 +1127,31 @@ impl Step for Compiletest {
11271127
}
11281128
}
11291129

1130+
let clang_version = Command::new(&clang_exe)
1131+
.arg("--version")
1132+
.output()
1133+
.map(|output| { String::from_utf8_lossy(&output.stdout).to_string() })
1134+
.ok();
1135+
if let Some(ref vers) = clang_version {
1136+
cmd.arg("--clang-version").arg(vers);
1137+
}
1138+
1139+
if let Some(var) = env::var_os("RUSTBUILD_FORCE_CLANG_BASED_TESTS") {
1140+
match &var.to_string_lossy()[..] {
1141+
"1" | "yes" | "on" => {
1142+
cmd.arg("--force-clang-based-tests");
1143+
}
1144+
"0" | "no" | "off" => {
1145+
// Nothing to do.
1146+
}
1147+
other => {
1148+
// Let's make sure typos don't get unnoticed
1149+
panic!("Unrecognized option '{}' set in \
1150+
RUSTBUILD_FORCE_CLANG_BASED_TESTS", other);
1151+
}
1152+
}
1153+
}
1154+
11301155
// Get paths from cmd args
11311156
let paths = match &builder.config.cmd {
11321157
Subcommand::Test { ref paths, .. } => &paths[..],

0 commit comments

Comments
 (0)