From 68b692436342813c85f37e63f2d55760e37df242 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Thu, 25 Apr 2019 15:30:23 +0200 Subject: compiletest: Make the LLVM FileCheck tool available to run-make tests. --- src/tools/compiletest/src/runtest.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/tools/compiletest') diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 9db16b69e5f..0dff218d88a 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2691,6 +2691,10 @@ impl<'test> TestCx<'test> { cmd.env("CLANG", clang); } + if let Some(ref filecheck) = self.config.llvm_filecheck { + cmd.env("LLVM_FILECHECK", filecheck); + } + // We don't want RUSTFLAGS set from the outside to interfere with // compiler flags set in the test cases: cmd.env_remove("RUSTFLAGS"); -- cgit 1.4.1-3-g733a5 From 29cf3f54ab937b56dd1655a384bbf4941f9f1124 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Mon, 29 Apr 2019 14:38:25 +0200 Subject: compiletest: Make LLVM's bin directory available to run-make-fulldeps tests. --- src/bootstrap/test.rs | 7 +++++++ src/tools/compiletest/src/common.rs | 3 +++ src/tools/compiletest/src/main.rs | 4 +++- src/tools/compiletest/src/runtest.rs | 4 ++++ 4 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src/tools/compiletest') diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index a443b7b5863..8082e2468c5 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1231,6 +1231,13 @@ impl Step for Compiletest { if let Some(ar) = builder.ar(target) { cmd.arg("--ar").arg(ar); } + + // The llvm/bin directory contains many useful cross-platform + // tools. Pass the path to run-make tests so they can use them. + let llvm_bin_path = llvm_config.parent() + .expect("Expected llvm-config to be contained in directory"); + assert!(llvm_bin_path.is_dir()); + cmd.arg("--llvm-bin-dir").arg(llvm_bin_path); } } diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 089cbc7b78a..4699dee1716 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -144,6 +144,9 @@ pub struct Config { /// The LLVM `FileCheck` binary path. pub llvm_filecheck: Option, + /// Path to LLVM's bin directory. + pub llvm_bin_dir: Option, + /// The valgrind path. pub valgrind_path: Option, diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 431fd7969be..dc5d1b9a853 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -221,6 +221,7 @@ pub fn parse_config(args: Vec) -> Config { "LIST", ) .reqopt("", "llvm-cxxflags", "C++ flags for LLVM", "FLAGS") + .optopt("", "llvm-bin-dir", "Path to LLVM's `bin` directory", "PATH") .optopt("", "nodejs", "the name of nodejs", "PATH") .optopt( "", @@ -306,7 +307,8 @@ pub fn parse_config(args: Vec) -> Config { valgrind_path: matches.opt_str("valgrind-path"), force_valgrind: matches.opt_present("force-valgrind"), run_clang_based_tests_with: matches.opt_str("run-clang-based-tests-with"), - llvm_filecheck: matches.opt_str("llvm-filecheck").map(|s| PathBuf::from(&s)), + llvm_filecheck: matches.opt_str("llvm-filecheck").map(PathBuf::from), + llvm_bin_dir: matches.opt_str("llvm-bin-dir").map(PathBuf::from), src_base, build_base: opt_path(matches, "build-base"), stage_id: matches.opt_str("stage-id").unwrap(), diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 0dff218d88a..42f9cdb7886 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2695,6 +2695,10 @@ impl<'test> TestCx<'test> { cmd.env("LLVM_FILECHECK", filecheck); } + if let Some(ref llvm_bin_dir) = self.config.llvm_bin_dir { + cmd.env("LLVM_BIN_DIR", llvm_bin_dir); + } + // We don't want RUSTFLAGS set from the outside to interfere with // compiler flags set in the test cases: cmd.env_remove("RUSTFLAGS"); -- cgit 1.4.1-3-g733a5