[clangd] Move clangd tests to clangd directory. check-clangd is no longer part of check-clang-tools.

Summary:
Motivation:
 - this layout is a pain to work with
 - without a common root, it's painful to express things like "disable clangd" (D61122)
 - CMake/lit configs are a maintenance hazard, and the more the one-off hacks
   for various tools are entangled, the more we see apathy and non-ownership.

This attempts to use the bare-minimum configuration needed (while still
supporting the difficult cases: windows, standalone clang build, dynamic libs).
In particular the lit.cfg.py and lit.site.cfg.py.in are merged into lit.cfg.in.
The logic in these files is now minimal.

(Much of clang-tools-extra's lit configs can probably be cleaned up by reusing
lit.llvm.llvm_config.use_clang(), and every llvm project does its own version of
LDPATH mangling. I haven't attempted to fix any of those).

Docs are still in clang-tools-extra/docs, I don't have any plans to touch those.

Reviewers: gribozavr

Subscribers: mgorny, javed.absar, MaskRay, jkorous, arphaman, kadircet, jfb, cfe-commits, ilya-biryukov, thakis

Tags: #clang

Differential Revision: https://reviews.llvm.org/D61187

llvm-svn: 359424
This commit is contained in:
Sam McCall 2019-04-29 08:44:01 +00:00
parent e62915bcc1
commit b804eef090
112 changed files with 119 additions and 58 deletions

View File

@ -1,15 +1,3 @@
if (NOT DEFINED CLANGD_BUILD_XPC)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CLANGD_BUILD_XPC_DEFAULT ON)
else ()
set(CLANGD_BUILD_XPC_DEFAULT OFF)
endif ()
set(CLANGD_BUILD_XPC ${CLANGD_BUILD_XPC_DEFAULT} CACHE BOOL "Build XPC Support For Clangd." FORCE)
unset(CLANGD_BUILD_XPC_DEFAULT)
endif ()
add_subdirectory(clang-apply-replacements)
add_subdirectory(clang-reorder-fields)
add_subdirectory(modularize)

View File

@ -1,6 +1,17 @@
# Configure the Features.inc file.
llvm_canonicalize_cmake_booleans(
CLANGD_BUILD_XPC)
if (NOT DEFINED CLANGD_BUILD_XPC)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CLANGD_BUILD_XPC_DEFAULT ON)
else ()
set(CLANGD_BUILD_XPC_DEFAULT OFF)
endif ()
set(CLANGD_BUILD_XPC ${CLANGD_BUILD_XPC_DEFAULT} CACHE BOOL "Build XPC Support For Clangd." FORCE)
unset(CLANGD_BUILD_XPC_DEFAULT)
endif ()
llvm_canonicalize_cmake_booleans(CLANGD_BUILD_XPC)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/Features.inc.in
${CMAKE_CURRENT_BINARY_DIR}/Features.inc
@ -130,3 +141,8 @@ endif()
if ( CLANGD_BUILD_XPC )
add_subdirectory(xpc)
endif ()
if(CLANG_INCLUDE_TESTS)
add_subdirectory(test)
add_subdirectory(unittests)
endif()

View File

@ -0,0 +1,28 @@
set(CLANGD_TEST_DEPS
clangd
ClangdTests
# No tests for these, but we should still make sure they build.
clangd-indexer
dexp
)
if(CLANGD_BUILD_XPC)
list(APPEND CLANGD_TEST_DEPS clangd-xpc-test-client)
endif()
foreach(dep FileCheck count not)
if(TARGET ${dep})
list(APPEND CLANGD_TEST_DEPS ${dep})
endif()
endforeach()
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/lit.cfg)
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/../unittests/lit.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/../unittests/lit.cfg)
add_lit_testsuite(check-clangd "Running the Clangd regression tests"
${CMAKE_CURRENT_BINARY_DIR}/Unit;${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${CLANGD_TEST_DEPS})

View File

@ -0,0 +1,29 @@
@LIT_SITE_CFG_IN_HEADER@
import lit.llvm
import lit.formats
# Reuse clang configuration (PATH setup, etc).
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')

View File

@ -11,7 +11,17 @@ include_directories(
${CLANGD_BINARY_DIR}
)
add_extra_unittest(ClangdTests
if(CLANG_BUILT_STANDALONE)
# LLVMTestingSupport library is needed for clangd tests.
if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
AND NOT TARGET LLVMTestingSupport)
add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
lib/Testing/Support)
endif()
endif()
add_custom_target(ClangdUnitTests)
add_unittest(ClangdUnitTests ClangdTests
Annotations.cpp
BackgroundIndexTests.cpp
CancellationTests.cpp

Some files were not shown because too many files have changed in this diff Show More