Skip to content

Commit 29cf3f5

Browse files
compiletest: Make LLVM's bin directory available to run-make-fulldeps tests.
1 parent 4dc3b99 commit 29cf3f5

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

src/bootstrap/test.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,13 @@ impl Step for Compiletest {
12311231
if let Some(ar) = builder.ar(target) {
12321232
cmd.arg("--ar").arg(ar);
12331233
}
1234+
1235+
// The llvm/bin directory contains many useful cross-platform
1236+
// tools. Pass the path to run-make tests so they can use them.
1237+
let llvm_bin_path = llvm_config.parent()
1238+
.expect("Expected llvm-config to be contained in directory");
1239+
assert!(llvm_bin_path.is_dir());
1240+
cmd.arg("--llvm-bin-dir").arg(llvm_bin_path);
12341241
}
12351242
}
12361243

src/tools/compiletest/src/common.rs

+3
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ pub struct Config {
144144
/// The LLVM `FileCheck` binary path.
145145
pub llvm_filecheck: Option<PathBuf>,
146146

147+
/// Path to LLVM's bin directory.
148+
pub llvm_bin_dir: Option<PathBuf>,
149+
147150
/// The valgrind path.
148151
pub valgrind_path: Option<String>,
149152

src/tools/compiletest/src/main.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
221221
"LIST",
222222
)
223223
.reqopt("", "llvm-cxxflags", "C++ flags for LLVM", "FLAGS")
224+
.optopt("", "llvm-bin-dir", "Path to LLVM's `bin` directory", "PATH")
224225
.optopt("", "nodejs", "the name of nodejs", "PATH")
225226
.optopt(
226227
"",
@@ -306,7 +307,8 @@ pub fn parse_config(args: Vec<String>) -> Config {
306307
valgrind_path: matches.opt_str("valgrind-path"),
307308
force_valgrind: matches.opt_present("force-valgrind"),
308309
run_clang_based_tests_with: matches.opt_str("run-clang-based-tests-with"),
309-
llvm_filecheck: matches.opt_str("llvm-filecheck").map(|s| PathBuf::from(&s)),
310+
llvm_filecheck: matches.opt_str("llvm-filecheck").map(PathBuf::from),
311+
llvm_bin_dir: matches.opt_str("llvm-bin-dir").map(PathBuf::from),
310312
src_base,
311313
build_base: opt_path(matches, "build-base"),
312314
stage_id: matches.opt_str("stage-id").unwrap(),

src/tools/compiletest/src/runtest.rs

+4
Original file line numberDiff line numberDiff line change
@@ -2695,6 +2695,10 @@ impl<'test> TestCx<'test> {
26952695
cmd.env("LLVM_FILECHECK", filecheck);
26962696
}
26972697

2698+
if let Some(ref llvm_bin_dir) = self.config.llvm_bin_dir {
2699+
cmd.env("LLVM_BIN_DIR", llvm_bin_dir);
2700+
}
2701+
26982702
// We don't want RUSTFLAGS set from the outside to interfere with
26992703
// compiler flags set in the test cases:
27002704
cmd.env_remove("RUSTFLAGS");

0 commit comments

Comments
 (0)