From abf05b18dbcdfa6990a480d8e351bddd2a90e069 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Sat, 22 Apr 2017 23:02:53 +0000 Subject: [PATCH] [CMake] Fix polly-isl-test execution in out-of-LLVM-tree builds. The isl unittest modified its PATH variable to point to the LLVM bin dir. When building out-of-LLVM-tree, it does not contain the polly-isl-test executable, hence the test fails. Ensure that the polly-isl-test is written to a bin directory in the build root, just like it would happen in an inside-LLVM build. Then, change PATH to include that dir such that the executable in it is prioritized before any other location. llvm-svn: 301096 --- polly/CMakeLists.txt | 3 +++ polly/test/UnitIsl/lit.cfg | 13 ++++++------- polly/test/UnitIsl/lit.site.cfg.in | 1 + 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/polly/CMakeLists.txt b/polly/CMakeLists.txt index e7bdda4..a5db358 100644 --- a/polly/CMakeLists.txt +++ b/polly/CMakeLists.txt @@ -114,6 +114,9 @@ if (NOT DEFINED LLVM_MAIN_SRC_DIR) # Make sure the isl c files are built as fPIC set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") + + # Set directory for polly-isl-test. + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin") else () set(LLVM_SOURCE_ROOT "${LLVM_MAIN_SRC_DIR}") set(POLLY_GTEST_AVAIL 1) diff --git a/polly/test/UnitIsl/lit.cfg b/polly/test/UnitIsl/lit.cfg index 874875a..9c732a15 100644 --- a/polly/test/UnitIsl/lit.cfg +++ b/polly/test/UnitIsl/lit.cfg @@ -34,13 +34,12 @@ if polly_obj_root is not None: config.llvm_src_root = getattr(config, 'llvm_src_root', None) config.llvm_obj_root = getattr(config, 'llvm_obj_root', None) -# Tweak the PATH to include the tools dir and the scripts dir. -if polly_obj_root is not None: - llvm_tools_dir = getattr(config, 'llvm_tools_dir', None) - if not llvm_tools_dir: - lit_config.fatal('No LLVM tools dir set!') - path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH'])) - config.environment['PATH'] = path +# Tweak the PATH to ensure that built files are the ones executed. +bin_dir = getattr(config, 'bin_dir', None) +if bin_dir is None: + lit_config.fatal('No executable dir set!') +path = os.path.pathsep.join((bin_dir, config.environment['PATH'])) +config.environment['PATH'] = path config.environment['srcdir'] = os.path.join(config.test_source_root, '../../lib/External/isl') diff --git a/polly/test/UnitIsl/lit.site.cfg.in b/polly/test/UnitIsl/lit.site.cfg.in index b0ad505..80de8fc 100644 --- a/polly/test/UnitIsl/lit.site.cfg.in +++ b/polly/test/UnitIsl/lit.site.cfg.in @@ -4,6 +4,7 @@ import sys config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" config.polly_obj_root = "@POLLY_BINARY_DIR@" +config.bin_dir = "@CMAKE_RUNTIME_OUTPUT_DIRECTORY@" # Let the main config do the real work. lit_config.load_config(config, "@POLLY_SOURCE_DIR@/test/UnitIsl/lit.cfg") -- 2.7.4