[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / CMakeLists.txt
blob31b494f39cce577f58d04c2388a1164da517b1d6
1 # Test runner infrastructure for Clang. This configures the Clang test trees
2 # for use by Lit, and delegates to LLVM's lit test handlers.
4 llvm_canonicalize_cmake_booleans(
5   CLANG_BUILD_EXAMPLES
6   CLANG_BUILT_STANDALONE
7   CLANG_DEFAULT_PIE_ON_LINUX
8   CLANG_ENABLE_ARCMT
9   CLANG_ENABLE_STATIC_ANALYZER
10   CLANG_PLUGIN_SUPPORT
11   CLANG_SPAWN_CC1
12   ENABLE_BACKTRACES
13   LLVM_ENABLE_ZLIB
14   LLVM_ENABLE_ZSTD
15   LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
16   LLVM_ENABLE_THREADS
17   LLVM_ENABLE_REVERSE_ITERATION
18   LLVM_WITH_Z3
19   PPC_LINUX_DEFAULT_IEEELONGDOUBLE
20   LLVM_TOOL_LLVM_DRIVER_BUILD
21   )
23 configure_lit_site_cfg(
24   ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
25   ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
26   MAIN_CONFIG
27   ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
28   PATHS
29   "LLVM_SOURCE_DIR"
30   "LLVM_BINARY_DIR"
31   "LLVM_TOOLS_DIR"
32   "LLVM_LIBS_DIR"
33   "SHLIBDIR"
34   "LLVM_LIT_TOOLS_DIR"
35   "LLVM_EXTERNAL_LIT"
36   "CLANG_BINARY_DIR"
37   "CLANG_SOURCE_DIR"
38   "CURRENT_TOOLS_DIR"
39   "CMAKE_LIBRARY_OUTPUT_DIRECTORY"
40   )
42 configure_lit_site_cfg(
43   ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
44   ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
45   MAIN_CONFIG
46   ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
47   PATHS
48   "LLVM_SOURCE_DIR"
49   "LLVM_BINARY_DIR"
50   "LLVM_TOOLS_DIR"
51   "LLVM_LIBS_DIR"
52   "CLANG_BINARY_DIR"
53   "SHLIBDIR"
54   )
56 option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF)
57 if(CLANG_TEST_USE_VG)
58   set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg")
59 endif ()
61 list(APPEND CLANG_TEST_DEPS
62   apinotes-test
63   c-index-test
64   clang
65   clang-fuzzer-dictionary
66   clang-resource-headers
67   clang-format
68   clang-tblgen
69   clang-offload-bundler
70   clang-import-test
71   clang-rename
72   clang-refactor
73   clang-diff
74   clang-scan-deps
75   clang-linker-wrapper
76   clang-offload-bundler
77   clang-offload-packager
78   diagtool
79   hmaptool
80   )
81   
82 if(CLANG_ENABLE_STATIC_ANALYZER)
83   list(APPEND CLANG_TEST_DEPS
84     clang-check
85     clang-extdef-mapping
86     )
87 endif()
89 if (CLANG_ENABLE_ARCMT)
90   list(APPEND CLANG_TEST_DEPS
91     arcmt-test
92     c-arcmt-test
93   )
94 endif ()
96 if(CLANG_BUILD_EXAMPLES AND CLANG_PLUGIN_SUPPORT)
97   list(APPEND CLANG_TEST_DEPS
98     Attribute
99     AnnotateFunctions
100     CallSuperAttr
101     PluginsOrder
102     PrintFunctionNames
103     )
104 endif ()
106 set(CLANG_TEST_PARAMS
107   USE_Z3_SOLVER=0
108   )
110 if( NOT CLANG_BUILT_STANDALONE )
111   list(APPEND CLANG_TEST_DEPS
112     llvm-config
113     FileCheck count not
114     llc
115     llvm-ar
116     llvm-as
117     llvm-bcanalyzer
118     llvm-cat
119     llvm-cxxfilt
120     llvm-dis
121     llvm-dwarfdump
122     llvm-ifs
123     llvm-lto2
124     llvm-modextract
125     llvm-nm
126     llvm-objcopy
127     llvm-objdump
128     llvm-pdbutil
129     llvm-profdata
130     llvm-rc
131     llvm-readelf
132     llvm-readobj
133     llvm-strip
134     llvm-symbolizer
135     llvm-windres
136     opt
137     split-file
138     yaml2obj
139     )
141   if(TARGET llvm-lto)
142     list(APPEND CLANG_TEST_DEPS llvm-lto)
143   endif()
144 endif()
146 if(CLANG_ENABLE_STATIC_ANALYZER)
147   if(CLANG_PLUGIN_SUPPORT AND LLVM_ENABLE_PLUGINS) # Determine if we built them
148     list(APPEND CLANG_TEST_DEPS
149       SampleAnalyzerPlugin
150       CheckerDependencyHandlingAnalyzerPlugin
151       CheckerOptionHandlingAnalyzerPlugin
152       )
153   endif()
154 endif()
156 if (HAVE_CLANG_REPL_SUPPORT)
157   list(APPEND CLANG_TEST_DEPS
158     clang-repl
159     )
160 endif()
162 # Copy gen_ast_dump_json_test.py to the clang build dir. This allows invoking
163 # it without having to pass the --clang= argument
164 configure_file(AST/gen_ast_dump_json_test.py
165   ${CLANG_BINARY_DIR}/bin/gen_ast_dump_json_test.py COPYONLY)
167 add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})
168 set_target_properties(clang-test-depends PROPERTIES FOLDER "Clang tests")
170 add_lit_testsuite(check-clang "Running the Clang regression tests"
171   ${CMAKE_CURRENT_BINARY_DIR}
172   #LIT ${LLVM_LIT}
173   PARAMS ${CLANG_TEST_PARAMS}
174   DEPENDS ${CLANG_TEST_DEPS}
175   ARGS ${CLANG_TEST_EXTRA_ARGS}
176   )
177 set_target_properties(check-clang PROPERTIES FOLDER "Clang tests")
179 add_lit_testsuites(CLANG ${CMAKE_CURRENT_SOURCE_DIR}
180   PARAMS ${CLANG_TEST_PARAMS}
181   DEPENDS ${CLANG_TEST_DEPS}
182   FOLDER "Clang tests/Suites"
185 # Add a legacy target spelling: clang-test
186 add_custom_target(clang-test)
187 add_dependencies(clang-test check-clang)
188 set_target_properties(clang-test PROPERTIES FOLDER "Clang tests")
190 # FIXME: This logic can be removed once all buildbots have moved
191 # debuginfo-test from clang/test to llvm/projects or monorepo.
192 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests)
193   message(WARNING "Including debuginfo-tests in clang/test is deprecated.  Move to llvm/projects or use monorepo.")
194   if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests/CMakeLists.txt)
195     add_subdirectory(debuginfo-tests)
196   endif()
197 endif()