[clang-tools-extra] r359763 - [clangd] Restore conventional names for lit configs, and .in/.py split. Fix build_mode indirection.
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Thu May 2 01:00:39 PDT 2019
Author: sammccall
Date: Thu May 2 01:00:39 2019
New Revision: 359763
URL: http://llvm.org/viewvc/llvm-project?rev=359763&view=rev
Log:
[clangd] Restore conventional names for lit configs, and .in/.py split. Fix build_mode indirection.
Added:
clang-tools-extra/trunk/clangd/test/lit.cfg.py
clang-tools-extra/trunk/clangd/test/lit.site.cfg.py.in
clang-tools-extra/trunk/clangd/unittests/lit.cfg.py
- copied, changed from r359674, clang-tools-extra/trunk/clangd/unittests/lit.cfg.in
clang-tools-extra/trunk/clangd/unittests/lit.site.cfg.py.in
Removed:
clang-tools-extra/trunk/clangd/test/lit.cfg.in
clang-tools-extra/trunk/clangd/unittests/lit.cfg.in
Modified:
clang-tools-extra/trunk/clangd/test/CMakeLists.txt
clang-tools-extra/trunk/clangd/unittests/CMakeLists.txt
Modified: clang-tools-extra/trunk/clangd/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/test/CMakeLists.txt?rev=359763&r1=359762&r2=359763&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/test/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clangd/test/CMakeLists.txt Thu May 2 01:00:39 2019
@@ -1,3 +1,13 @@
+# Set CLANG_TOOLS_DIR to buildtree/bin, or buildtree/%(build_mode)s/bin if the
+# location is dynamic. The latter must be interpolated by lit configs.
+# FIXME: this is duplicated in many places.
+if (CMAKE_CFG_INTDIR STREQUAL ".")
+ set(LLVM_BUILD_MODE ".")
+else ()
+ set(LLVM_BUILD_MODE "%(build_mode)s")
+endif ()
+string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
+
set(CLANGD_TEST_DEPS
clangd
ClangdTests
@@ -18,8 +28,8 @@ foreach(dep FileCheck count not)
endforeach()
configure_lit_site_cfg(
- ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.in
- ${CMAKE_CURRENT_BINARY_DIR}/lit.cfg)
+ ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
+ ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py)
add_lit_testsuite(check-clangd "Running the Clangd regression tests"
${CMAKE_CURRENT_BINARY_DIR}/../unittests;${CMAKE_CURRENT_BINARY_DIR}
Removed: clang-tools-extra/trunk/clangd/test/lit.cfg.in
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/test/lit.cfg.in?rev=359762&view=auto
==============================================================================
--- clang-tools-extra/trunk/clangd/test/lit.cfg.in (original)
+++ clang-tools-extra/trunk/clangd/test/lit.cfg.in (removed)
@@ -1,30 +0,0 @@
- at LIT_SITE_CFG_IN_HEADER@
-
-import lit.llvm
-import lit.formats
-
-# Reuse clang configuration (PATH setup, etc).
-config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
-config.clang_tools_dir = "@CLANG_TOOLS_DIR@"
-config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
-config.clang_libs_dir = "@CLANG_LIBS_DIR@"
-config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
-config.target_triple = "@TARGET_TRIPLE@"
-config.host_triple = "@LLVM_HOST_TRIPLE@"
-lit.llvm.initialize(lit_config, config)
-lit.llvm.llvm_config.use_clang()
-
-config.name = 'Clangd'
-config.suffixes = ['.test']
-config.excludes = ['Inputs']
-config.test_format = lit.formats.ShTest(not lit.llvm.llvm_config.use_lit_shell)
-config.test_source_root = "@CMAKE_CURRENT_SOURCE_DIR@"
-config.test_exec_root = "@CMAKE_CURRENT_BINARY_DIR@"
-
-# Clangd-specific lit environment.
-config.substitutions.append(('%clangd-benchmark-dir',
- "@CMAKE_CURRENT_BINARY_DIR@/../benchmarks"))
-
-if @CLANGD_BUILD_XPC@:
- config.available_features.add('clangd-xpc-support')
-
Added: clang-tools-extra/trunk/clangd/test/lit.cfg.py
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/test/lit.cfg.py?rev=359763&view=auto
==============================================================================
--- clang-tools-extra/trunk/clangd/test/lit.cfg.py (added)
+++ clang-tools-extra/trunk/clangd/test/lit.cfg.py Thu May 2 01:00:39 2019
@@ -0,0 +1,19 @@
+import lit.llvm
+
+lit.llvm.initialize(lit_config, config)
+lit.llvm.llvm_config.use_clang()
+
+config.name = 'Clangd'
+config.suffixes = ['.test']
+config.excludes = ['Inputs']
+config.test_format = lit.formats.ShTest(not lit.llvm.llvm_config.use_lit_shell)
+config.test_source_root = config.clangd_source_dir + "/test"
+config.test_exec_root = config.clangd_binary_dir + "/test"
+
+# Clangd-specific lit environment.
+config.substitutions.append(('%clangd-benchmark-dir',
+ config.clangd_binary_dir + "/benchmarks"))
+
+if config.clangd_build_xpc:
+ config.available_features.add('clangd-xpc-support')
+
Added: clang-tools-extra/trunk/clangd/test/lit.site.cfg.py.in
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/test/lit.site.cfg.py.in?rev=359763&view=auto
==============================================================================
--- clang-tools-extra/trunk/clangd/test/lit.site.cfg.py.in (added)
+++ clang-tools-extra/trunk/clangd/test/lit.site.cfg.py.in Thu May 2 01:00:39 2019
@@ -0,0 +1,28 @@
+ at LIT_SITE_CFG_IN_HEADER@
+
+# Variables needed for common clang config.
+config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
+config.clang_tools_dir = "@CLANG_TOOLS_DIR@"
+config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
+config.clang_libs_dir = "@CLANG_LIBS_DIR@"
+config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
+config.target_triple = "@TARGET_TRIPLE@"
+config.host_triple = "@LLVM_HOST_TRIPLE@"
+
+# Support substitution of the tools and libs dirs with user parameters. This is
+# used when we can't determine the tool dir at configuration time.
+try:
+ config.clang_tools_dir = config.clang_tools_dir % lit_config.params
+ config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
+ config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params
+except KeyError:
+ e = sys.exc_info()[1]
+ key, = e.args
+ lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
+
+config.clangd_source_dir = "@CMAKE_CURRENT_SOURCE_DIR@/.."
+config.clangd_binary_dir = "@CMAKE_CURRENT_BINARY_DIR@/.."
+config.clangd_build_xpc = @CLANGD_BUILD_XPC@
+
+# Delegate logic to lit.cfg.py.
+lit_config.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg.py")
Modified: clang-tools-extra/trunk/clangd/unittests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/unittests/CMakeLists.txt?rev=359763&r1=359762&r2=359763&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/unittests/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clangd/unittests/CMakeLists.txt Thu May 2 01:00:39 2019
@@ -93,5 +93,5 @@ if (CLANGD_BUILD_XPC)
endif ()
configure_lit_site_cfg(
- ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.in
- ${CMAKE_CURRENT_BINARY_DIR}/lit.cfg)
+ ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
+ ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py)
Removed: clang-tools-extra/trunk/clangd/unittests/lit.cfg.in
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/unittests/lit.cfg.in?rev=359762&view=auto
==============================================================================
--- clang-tools-extra/trunk/clangd/unittests/lit.cfg.in (original)
+++ clang-tools-extra/trunk/clangd/unittests/lit.cfg.in (removed)
@@ -1,23 +0,0 @@
- at LIT_SITE_CFG_IN_HEADER@
-# This is a shim to run the gtest unittests in ../unittests using lit.
-
-import lit.formats
-config.name = "Clangd Unit Tests"
-config.test_format = lit.formats.GoogleTest('.', 'Tests')
-config.test_source_root = "@CMAKE_CURRENT_BINARY_DIR@"
-config.test_exec_root = "@CMAKE_CURRENT_BINARY_DIR@"
-
-# Point the dynamic loader at dynamic libraries in 'lib'.
-# XXX: it seems every project has a copy of this logic. Move it somewhere.
-import platform
-if platform.system() == 'Darwin':
- shlibpath_var = 'DYLD_LIBRARY_PATH'
-elif platform.system() == 'Windows':
- shlibpath_var = 'PATH'
-else:
- shlibpath_var = 'LD_LIBRARY_PATH'
-config.environment[shlibpath_var] = os.path.pathsep.join((
- "@SHLIBDIR@", "@LLVM_LIBS_DIR@",
- config.environment.get(shlibpath_var,'')))
-
-
Copied: clang-tools-extra/trunk/clangd/unittests/lit.cfg.py (from r359674, clang-tools-extra/trunk/clangd/unittests/lit.cfg.in)
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/unittests/lit.cfg.py?p2=clang-tools-extra/trunk/clangd/unittests/lit.cfg.py&p1=clang-tools-extra/trunk/clangd/unittests/lit.cfg.in&r1=359674&r2=359763&rev=359763&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/unittests/lit.cfg.in (original)
+++ clang-tools-extra/trunk/clangd/unittests/lit.cfg.py Thu May 2 01:00:39 2019
@@ -1,14 +1,11 @@
- at LIT_SITE_CFG_IN_HEADER@
-# This is a shim to run the gtest unittests in ../unittests using lit.
-
import lit.formats
config.name = "Clangd Unit Tests"
config.test_format = lit.formats.GoogleTest('.', 'Tests')
-config.test_source_root = "@CMAKE_CURRENT_BINARY_DIR@"
-config.test_exec_root = "@CMAKE_CURRENT_BINARY_DIR@"
+config.test_source_root = config.clangd_binary_dir + "/unittests"
+config.test_exec_root = config.clangd_binary_dir + "/unittests"
# Point the dynamic loader at dynamic libraries in 'lib'.
-# XXX: it seems every project has a copy of this logic. Move it somewhere.
+# FIXME: it seems every project has a copy of this logic. Move it somewhere.
import platform
if platform.system() == 'Darwin':
shlibpath_var = 'DYLD_LIBRARY_PATH'
@@ -21,3 +18,4 @@ config.environment[shlibpath_var] = os.p
config.environment.get(shlibpath_var,'')))
+
Added: clang-tools-extra/trunk/clangd/unittests/lit.site.cfg.py.in
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/unittests/lit.site.cfg.py.in?rev=359763&view=auto
==============================================================================
--- clang-tools-extra/trunk/clangd/unittests/lit.site.cfg.py.in (added)
+++ clang-tools-extra/trunk/clangd/unittests/lit.site.cfg.py.in Thu May 2 01:00:39 2019
@@ -0,0 +1,11 @@
+ at LIT_SITE_CFG_IN_HEADER@
+# This is a shim to run the gtest unittests in ../unittests using lit.
+
+config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
+config.shlibdir = "@SHLIBDIR@"
+
+config.clangd_source_dir = "@CMAKE_CURRENT_SOURCE_DIR@/.."
+config.clangd_binary_dir = "@CMAKE_CURRENT_BINARY_DIR@/.."
+
+# Delegate logic to lit.cfg.py.
+lit_config.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg.py")
More information about the cfe-commits
mailing list