2012-06-30 18:14:27 +08:00
|
|
|
# Test runner infrastructure for Clang. This configures the Clang test trees
|
|
|
|
# for use by Lit, and delegates to LLVM's lit test handlers.
|
2009-06-06 00:00:31 +08:00
|
|
|
|
2013-12-17 12:14:17 +08:00
|
|
|
if (CMAKE_CFG_INTDIR STREQUAL ".")
|
|
|
|
set(LLVM_BUILD_MODE ".")
|
|
|
|
else ()
|
|
|
|
set(LLVM_BUILD_MODE "%(build_mode)s")
|
|
|
|
endif ()
|
|
|
|
|
2014-01-19 21:00:01 +08:00
|
|
|
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
|
2013-12-17 12:14:17 +08:00
|
|
|
|
2016-11-02 04:31:52 +08:00
|
|
|
if(CLANG_BUILT_STANDALONE)
|
|
|
|
# Set HAVE_LIBZ according to recorded LLVM_ENABLE_ZLIB value. This
|
|
|
|
# value is forced to 0 if zlib was not found, so it is fine to use it
|
|
|
|
# instead of HAVE_LIBZ (not recorded).
|
|
|
|
if(LLVM_ENABLE_ZLIB)
|
|
|
|
set(HAVE_LIBZ 1)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2017-01-25 21:11:45 +08:00
|
|
|
llvm_canonicalize_cmake_booleans(
|
|
|
|
CLANG_BUILD_EXAMPLES
|
|
|
|
CLANG_ENABLE_ARCMT
|
|
|
|
CLANG_ENABLE_STATIC_ANALYZER
|
2017-01-25 21:31:53 +08:00
|
|
|
ENABLE_BACKTRACES
|
|
|
|
HAVE_LIBZ)
|
2017-01-25 21:11:45 +08:00
|
|
|
|
2012-06-29 08:39:23 +08:00
|
|
|
configure_lit_site_cfg(
|
2017-09-22 01:38:13 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
|
|
|
|
MAIN_CONFIG
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
|
2012-06-29 08:39:23 +08:00
|
|
|
)
|
2009-11-08 07:53:32 +08:00
|
|
|
|
2012-06-29 08:39:23 +08:00
|
|
|
configure_lit_site_cfg(
|
2017-09-22 01:38:13 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
|
|
|
|
MAIN_CONFIG
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
|
2012-06-29 08:39:23 +08:00
|
|
|
)
|
2011-02-03 17:01:12 +08:00
|
|
|
|
2012-06-30 18:14:27 +08:00
|
|
|
option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF)
|
|
|
|
if(CLANG_TEST_USE_VG)
|
|
|
|
set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg")
|
|
|
|
endif ()
|
2009-06-06 00:00:31 +08:00
|
|
|
|
2013-12-20 00:05:39 +08:00
|
|
|
list(APPEND CLANG_TEST_DEPS
|
2013-02-08 15:28:25 +08:00
|
|
|
clang clang-headers
|
2016-06-01 21:47:26 +08:00
|
|
|
clang-format
|
2014-07-15 06:17:16 +08:00
|
|
|
c-index-test diagtool
|
2014-01-19 16:54:48 +08:00
|
|
|
clang-tblgen
|
clang-offload-bundler - offload files bundling/unbundling tool
Summary:
One of the goals of programming models that support offloading (e.g. OpenMP) is to enable users to offload with little effort, by annotating the code with a few pragmas. I'd also like to save users the trouble of changing their existent applications' build system. So having the compiler always return a single file instead of one for the host and each target even if the user is doing separate compilation is desirable.
This diff proposes a tool named clang-offload-bundler (happy to change the name if required) that is used to bundle files associated with the same user source file but different targets, or to unbundle a file into separate files associated with different targets.
This tool supports the driver support for OpenMP under review in http://reviews.llvm.org/D9888. The tool is used there to enable separate compilation, so that the very first action on input files that are not source files is a "unbundling action" and the very last non-linking action is a "bundling action".
The format of the bundled files is currently very simple: text formats are concatenated with comments that have a magic string and target identifying triple in between, and binary formats have a header that contains the triple and the offset and size of the code for host and each target.
The goal is to improve this tool in the future to deal with archive files so that each individual file in the archive is properly dealt with. We see that archives are very commonly used in current applications to combine separate compilation results. So I'm convinced users would enjoy this feature.
This tool can be used like this:
`clang-offload-bundler -targets=triple1,triple2 -type=ii -inputs=a.triple1.ii,a.triple2.ii -outputs=a.ii`
or
`clang-offload-bundler -targets=triple1,triple2 -type=ii -outputs=a.triple1.ii,a.triple2.ii -inputs=a.ii -unbundle`
I implemented the tool under clang/tools. Please let me know if something like this should live somewhere else.
This patch is prerequisite for http://reviews.llvm.org/D9888.
Reviewers: hfinkel, rsmith, echristo, chandlerc, tra, jlebar, ABataev, Hahnfeld
Subscribers: whchung, caomhin, andreybokhanko, arpith-jacob, carlo.bertolli, mehdi_amini, guansong, Hahnfeld, cfe-commits
Differential Revision: https://reviews.llvm.org/D13909
llvm-svn: 279632
2016-08-24 23:21:05 +08:00
|
|
|
clang-offload-bundler
|
Testbed and skeleton of a new expression parser
Recommitted after formal approval.
LLVM's JIT is now the foundation of dynamic-compilation features for many languages. Clang also has low-level support for dynamic compilation (ASTImporter and ExternalASTSource, notably). How the compiler is set up for dynamic parsing is generally left up to individual clients, for example LLDB's C/C++/Objective-C expression parser and the ROOT project.
Although this arrangement offers external clients the flexibility to implement dynamic features as they see fit, the lack of an in-tree client means that subtle bugs can be introduced that cause regressions in the external clients but aren't caught by tests (or users) until much later. LLDB for example regularly encounters complicated ODR violation scenarios where it is not immediately clear who is at fault.
Other external clients (notably, Cling) rely on similar functionality, and another goal is to break this functionality up into composable parts so that any client can be built easily on top of Clang without requiring extensive additional code.
I propose that the parts required to build a simple expression parser be added to Clang. Initially, I aim to have the following features:
A piece that looks up external declarations from a variety of sources (e.g., from previous dynamic compilations, from modules, or from DWARF) and uses clear conflict resolution rules to reconcile differences, with easily understood errors. This functionality will be supported by in-tree tests.
A piece that works hand in hand with the LLVM JIT to resolve the locations of external declarations so that e.g. variables can be redeclared and (for high-performance applications like DTrace) external variables can be accessed directly from the registers where they reside.
This commit adds a tester that parses a sequence of source files and then uses them as source data for an expression. External references are resolved using an ExternalASTSource that responds to name queries using an ASTImporter. This is the setup that LLDB uses, and the motivating reason for MinimalImport in ASTImporter. When complete, this tester will implement the first of the above goals.
Differential Revision: https://reviews.llvm.org/D27180
llvm-svn: 290367
2016-12-23 04:03:14 +08:00
|
|
|
clang-import-test
|
2017-07-01 00:36:09 +08:00
|
|
|
clang-rename
|
2017-09-14 18:06:52 +08:00
|
|
|
clang-refactor
|
2017-07-21 21:12:01 +08:00
|
|
|
clang-diff
|
2013-02-08 15:28:25 +08:00
|
|
|
)
|
2016-06-01 21:47:26 +08:00
|
|
|
|
|
|
|
if(CLANG_ENABLE_STATIC_ANALYZER)
|
|
|
|
list(APPEND CLANG_TEST_DEPS
|
|
|
|
clang-check
|
2017-09-23 06:17:10 +08:00
|
|
|
clang-func-mapping
|
2016-06-01 21:47:26 +08:00
|
|
|
)
|
|
|
|
endif()
|
2014-06-01 10:02:23 +08:00
|
|
|
|
2014-07-15 06:17:16 +08:00
|
|
|
if (CLANG_ENABLE_ARCMT)
|
|
|
|
list(APPEND CLANG_TEST_DEPS
|
|
|
|
arcmt-test
|
|
|
|
c-arcmt-test
|
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
2017-01-25 21:11:45 +08:00
|
|
|
if (CLANG_BUILD_EXAMPLES)
|
2014-06-01 10:02:23 +08:00
|
|
|
list(APPEND CLANG_TEST_DEPS
|
2016-03-21 19:03:39 +08:00
|
|
|
AnnotateFunctions
|
2014-06-01 10:02:23 +08:00
|
|
|
clang-interpreter
|
|
|
|
PrintFunctionNames
|
2014-07-15 06:17:22 +08:00
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
2017-01-25 21:11:45 +08:00
|
|
|
if (CLANG_ENABLE_STATIC_ANALYZER AND CLANG_BUILD_EXAMPLES)
|
2014-07-15 06:17:22 +08:00
|
|
|
list(APPEND CLANG_TEST_DEPS
|
2014-06-01 10:02:23 +08:00
|
|
|
SampleAnalyzerPlugin
|
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
2013-02-08 15:28:25 +08:00
|
|
|
set(CLANG_TEST_PARAMS
|
|
|
|
clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
|
|
|
)
|
2009-11-23 05:55:22 +08:00
|
|
|
|
2013-02-08 15:28:25 +08:00
|
|
|
if( NOT CLANG_BUILT_STANDALONE )
|
|
|
|
list(APPEND CLANG_TEST_DEPS
|
check-clang: Introduce get_llvm_config_props in clang/test/lit.cfg.
In trunk, we can use features as below:
aarch64-registered-target
hexagon-registered-target
msp430-registered-target
r600-registered-target
systemz-registered-target
xcore-registered-target
Each of them, as below, implies corresponding subtargets:
arm-registered-target -- arm, thumb
mips-registered-target -- mips, mips64, mips64el, mipsel
nvptx-registered-target -- nvptx, nvptx64
sparc-registered-target -- sparc, sparcv9
x86-registered-target -- x86, x86-64
They will be renamed:
cppbackend-registered-target -- was "cpp". Unused in trunk.
powerpc-registered-target -- was "ppc32", "ppc64" and "ppc64le".
The feature "asserts" is also taken from llvm-config.
llvm-svn: 196347
2013-12-04 11:40:56 +08:00
|
|
|
llvm-config
|
2015-09-14 20:41:53 +08:00
|
|
|
FileCheck count not
|
2015-10-16 17:38:42 +08:00
|
|
|
llc
|
|
|
|
llvm-bcanalyzer
|
2017-01-27 05:09:48 +08:00
|
|
|
llvm-cat
|
2017-01-19 08:04:44 +08:00
|
|
|
llvm-dis
|
2017-01-27 07:51:50 +08:00
|
|
|
llvm-modextract
|
2016-06-22 09:03:15 +08:00
|
|
|
llvm-nm
|
2015-10-16 17:38:42 +08:00
|
|
|
llvm-objdump
|
|
|
|
llvm-profdata
|
|
|
|
llvm-readobj
|
|
|
|
llvm-symbolizer
|
|
|
|
opt
|
2012-07-03 05:37:04 +08:00
|
|
|
)
|
2016-06-03 00:35:24 +08:00
|
|
|
|
|
|
|
if(TARGET llvm-lto)
|
2016-06-03 02:49:42 +08:00
|
|
|
list(APPEND CLANG_TEST_DEPS llvm-lto)
|
2016-06-03 00:35:24 +08:00
|
|
|
endif()
|
2009-11-03 15:25:53 +08:00
|
|
|
endif()
|
2012-06-30 18:14:27 +08:00
|
|
|
|
2016-03-02 08:27:15 +08:00
|
|
|
add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})
|
2016-04-12 23:09:17 +08:00
|
|
|
set_target_properties(clang-test-depends PROPERTIES FOLDER "Clang tests")
|
2016-03-02 08:27:15 +08:00
|
|
|
|
2013-12-20 00:44:32 +08:00
|
|
|
add_lit_testsuite(check-clang "Running the Clang regression tests"
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
2013-12-20 01:10:30 +08:00
|
|
|
#LIT ${LLVM_LIT}
|
2013-12-20 00:44:32 +08:00
|
|
|
PARAMS ${CLANG_TEST_PARAMS}
|
|
|
|
DEPENDS ${CLANG_TEST_DEPS}
|
|
|
|
ARGS ${CLANG_TEST_EXTRA_ARGS}
|
|
|
|
)
|
|
|
|
set_target_properties(check-clang PROPERTIES FOLDER "Clang tests")
|
|
|
|
|
2016-07-06 01:54:40 +08:00
|
|
|
add_lit_testsuites(CLANG ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
PARAMS ${CLANG_TEST_PARAMS}
|
|
|
|
DEPENDS ${CLANG_TEST_DEPS}
|
|
|
|
)
|
|
|
|
|
2012-06-30 18:14:27 +08:00
|
|
|
# Add a legacy target spelling: clang-test
|
2012-07-03 05:46:03 +08:00
|
|
|
add_custom_target(clang-test)
|
|
|
|
add_dependencies(clang-test check-clang)
|
2012-06-30 18:14:27 +08:00
|
|
|
set_target_properties(clang-test PROPERTIES FOLDER "Clang tests")
|