[polly] r301096 - [CMake] Fix polly-isl-test execution in out-of-LLVM-tree builds.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 22 16:02:53 PDT 2017


Author: meinersbur
Date: Sat Apr 22 18:02:53 2017
New Revision: 301096

URL: http://llvm.org/viewvc/llvm-project?rev=301096&view=rev
Log:
[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.

Modified:
    polly/trunk/CMakeLists.txt
    polly/trunk/test/UnitIsl/lit.cfg
    polly/trunk/test/UnitIsl/lit.site.cfg.in

Modified: polly/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/CMakeLists.txt?rev=301096&r1=301095&r2=301096&view=diff
==============================================================================
--- polly/trunk/CMakeLists.txt (original)
+++ polly/trunk/CMakeLists.txt Sat Apr 22 18:02:53 2017
@@ -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)

Modified: polly/trunk/test/UnitIsl/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/UnitIsl/lit.cfg?rev=301096&r1=301095&r2=301096&view=diff
==============================================================================
--- polly/trunk/test/UnitIsl/lit.cfg (original)
+++ polly/trunk/test/UnitIsl/lit.cfg Sat Apr 22 18:02:53 2017
@@ -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')

Modified: polly/trunk/test/UnitIsl/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/UnitIsl/lit.site.cfg.in?rev=301096&r1=301095&r2=301096&view=diff
==============================================================================
--- polly/trunk/test/UnitIsl/lit.site.cfg.in (original)
+++ polly/trunk/test/UnitIsl/lit.site.cfg.in Sat Apr 22 18:02:53 2017
@@ -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")




More information about the llvm-commits mailing list