Skip to content

Commit 54b0e07

Browse files
Add LLVM bin directory to PATH for running run-make tests.
1 parent 98bf62a commit 54b0e07

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/bootstrap/test.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ impl Step for Compiletest {
10191019

10201020
// Only pass correct values for these flags for the `run-make` suite as it
10211021
// requires that a C++ compiler was configured which isn't always the case.
1022-
if !builder.config.dry_run && suite == "run-make-fulldeps" {
1022+
if !builder.config.dry_run && mode == "run-make" {
10231023
let llvm_components = output(Command::new(&llvm_config).arg("--components"));
10241024
let llvm_cxxflags = output(Command::new(&llvm_config).arg("--cxxflags"));
10251025
cmd.arg("--cc").arg(builder.cc(target))
@@ -1030,15 +1030,26 @@ impl Step for Compiletest {
10301030
if let Some(ar) = builder.ar(target) {
10311031
cmd.arg("--ar").arg(ar);
10321032
}
1033+
1034+
// Add the llvm/bin directory to PATH since it contains lots of
1035+
// useful, platform-independent tools
1036+
let llvm_bin_path = llvm_config.parent()
1037+
.expect("Expected llvm-config to be contained in directory");
1038+
assert!(llvm_bin_path.is_dir());
1039+
let old_path = env::var_os("PATH").unwrap_or_default();
1040+
let new_path = env::join_paths(iter::once(llvm_bin_path.to_path_buf())
1041+
.chain(env::split_paths(&old_path)))
1042+
.expect("");
1043+
cmd.env("PATH", new_path);
10331044
}
10341045
}
1035-
if suite == "run-make-fulldeps" && !builder.config.llvm_enabled {
1046+
if mode == "run-make" && !builder.config.llvm_enabled {
10361047
builder.info(
10371048
&format!("Ignoring run-make test suite as they generally don't work without LLVM"));
10381049
return;
10391050
}
10401051

1041-
if suite != "run-make-fulldeps" {
1052+
if mode != "run-make" {
10421053
cmd.arg("--cc").arg("")
10431054
.arg("--cxx").arg("")
10441055
.arg("--cflags").arg("")

src/test/run-make/cross-lang-lto/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ifeq ($(UNAME),Darwin)
1111
endif
1212

1313

14-
OBJDUMP=$(HOST_RPATH_DIR)/../../llvm/bin/llvm-objdump
14+
OBJDUMP=llvm-objdump
1515
SECTION_HEADERS=$(OBJDUMP) -section-headers
1616

1717
BUILD_LIB=$(RUSTC) lib.rs -Copt-level=2 -Z cross-lang-lto -Ccodegen-units=1

0 commit comments

Comments
 (0)