Skip to content

Commit acf4fe7

Browse files
Add LLVM bin directory to PATH for running run-make tests.
1 parent 60cae43 commit acf4fe7

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
@@ -971,7 +971,7 @@ impl Step for Compiletest {
971971

972972
// Only pass correct values for these flags for the `run-make` suite as it
973973
// requires that a C++ compiler was configured which isn't always the case.
974-
if !builder.config.dry_run && suite == "run-make-fulldeps" {
974+
if !builder.config.dry_run && mode == "run-make" {
975975
let llvm_components = output(Command::new(&llvm_config).arg("--components"));
976976
let llvm_cxxflags = output(Command::new(&llvm_config).arg("--cxxflags"));
977977
cmd.arg("--cc").arg(builder.cc(target))
@@ -982,15 +982,26 @@ impl Step for Compiletest {
982982
if let Some(ar) = builder.ar(target) {
983983
cmd.arg("--ar").arg(ar);
984984
}
985+
986+
// Add the llvm/bin directory to PATH since it contains lots of
987+
// useful, platform-independent tools
988+
let llvm_bin_path = llvm_config.parent()
989+
.expect("Expected llvm-config to be contained in directory");
990+
assert!(llvm_bin_path.is_dir());
991+
let old_path = env::var_os("PATH").unwrap_or_default();
992+
let new_path = env::join_paths(iter::once(llvm_bin_path.to_path_buf())
993+
.chain(env::split_paths(&old_path)))
994+
.expect("");
995+
cmd.env("PATH", new_path);
985996
}
986997
}
987-
if suite == "run-make-fulldeps" && !builder.config.llvm_enabled {
998+
if mode == "run-make" && !builder.config.llvm_enabled {
988999
builder.info(
9891000
&format!("Ignoring run-make test suite as they generally don't work without LLVM"));
9901001
return;
9911002
}
9921003

993-
if suite != "run-make-fulldeps" {
1004+
if mode != "run-make" {
9941005
cmd.arg("--cc").arg("")
9951006
.arg("--cxx").arg("")
9961007
.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)