[PATCH] [libcxx] Don't assume LIT_EXECUTABLE points to a Python script
Greg Fitzgerald
garious at gmail.com
Sat Jan 31 09:23:10 PST 2015
Hi mclow.lists,
lit.py's shebang allows it to masquerade as an executable. The
CMake build ignores that and assumes it is a Python script. If
LIT_EXECUTABLE was actually an executable, the build would fall
over.
This patch cleans things up. It assumes LIT_EXECUTABLE is
an actual executable. If it is a Python script, we'll use its
shebang to find a Python interpreter.
REPOSITORY
rL LLVM
http://reviews.llvm.org/D7315
Files:
test/CMakeLists.txt
Index: test/CMakeLists.txt
===================================================================
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -6,20 +6,26 @@
endif()
endmacro()
-include(FindPythonInterp)
-if(PYTHONINTERP_FOUND)
- if(LIBCXX_BUILT_STANDALONE)
- set(LIT_EXECUTABLE "" CACHE FILEPATH "Path to LLVM's lit.py.")
- # Make sure we can use the console pool for recent cmake and ninja > 1.5
- if(CMAKE_VERSION VERSION_LESS 3.1.20141117)
- set(cmake_3_2_USES_TERMINAL)
- else()
- set(cmake_3_2_USES_TERMINAL USES_TERMINAL)
- endif()
+set(LIT_EXECUTABLE "" CACHE FILEPATH "Path to LLVM's llvm-lit.")
+
+if(LIBCXX_BUILT_STANDALONE)
+ # Make sure we can use the console pool for recent cmake and ninja > 1.5
+ if(CMAKE_VERSION VERSION_LESS 3.1.20141117)
+ set(cmake_3_2_USES_TERMINAL)
else()
- set(LIT_EXECUTABLE "${CMAKE_SOURCE_DIR}/utils/lit/lit.py")
+ set(cmake_3_2_USES_TERMINAL USES_TERMINAL)
endif()
+else()
+ include(FindPythonInterp)
+ if(PYTHONINTERP_FOUND)
+ set(LIT_EXECUTABLE
+ "${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/utils/lit/lit.py")
+ else()
+ message(WARNING "Could not find Python, cannot set LIT_EXECUTABLE.")
+ endif()
+endif()
+if (LIT_EXECUTABLE)
set(LIT_ARGS_DEFAULT "-sv --show-unsupported --show-xfail")
if (MSVC OR XCODE)
set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
@@ -47,13 +53,13 @@
@ONLY)
add_custom_target(check-libcxx
- COMMAND ${PYTHON_EXECUTABLE}
- ${LIT_EXECUTABLE}
+ COMMAND ${LIT_EXECUTABLE}
${LIT_ARGS}
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS cxx
COMMENT "Running libcxx tests"
${cmake_3_2_USES_TERMINAL})
else()
- message(WARNING "Could not find Python, no check target will be available!")
+ message(WARNING
+ "LIT_EXECUTABLE not set, no check-libcxx target will be available!")
endif()
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7315.19096.patch
Type: text/x-patch
Size: 1909 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150131/f9fd2f2e/attachment.bin>
More information about the llvm-commits
mailing list