[Heikki Kultala] This patch contains the ABI changes for the TCE target.
[clang.git] / test / CMakeLists.txt
bloba32b9943c2a685017b6a3e7ccc557926e88c611c
1 set(CLANG_TEST_DIRECTORIES
2   "Analysis"
3   "CodeCompletion"
4   "CodeGen"
5   "CodeGenCXX"
6   "CodeGenObjC"
7   "CodeGenOpenCL"
8   "Coverage"
9   "CXX"
10   "Driver"
11   "FixIt"
12   "Frontend"
13   "Headers"
14   "Index"
15   "Lexer"
16   "Misc"
17   "PCH"
18   "Parser"
19   "Preprocessor"
20   "Rewriter"
21   "Sema"
22   "SemaCUDA"
23   "SemaCXX"
24   "SemaObjC"
25   "SemaObjCXX"
26   "SemaOpenCL"
27   "SemaTemplate")
29 set(LLVM_SOURCE_DIR "${LLVM_MAIN_SRC_DIR}")
30 set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}")
31 set(LLVM_BUILD_MODE "%(build_mode)s")
32 set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s")
33 set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib/%(build_config)s")
34 set(CLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..")
35 set(CLANG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
36 if(BUILD_SHARED_LIBS)
37   set(ENABLE_SHARED 1)
38 else()
39   set(ENABLE_SHARED 0)
40 endif(BUILD_SHARED_LIBS)
42 configure_file(
43   ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
44   ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
46 configure_file(
47   ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
48   ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
49   @ONLY)
51 include(FindPythonInterp)
52 if(PYTHONINTERP_FOUND)
53   if( LLVM_MAIN_SRC_DIR )
54     set(LIT "${LLVM_SOURCE_DIR}/utils/lit/lit.py")
55   else()
56     set(LIT "${PATH_TO_LLVM_BUILD}/bin/${CMAKE_CFG_INTDIR}/llvm-lit")
57   endif()
59   if( PATH_TO_LLVM_BUILD )
60     set(CLANG_TEST_EXTRA_ARGS "--path=${CLANG_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}")
61   endif()
63   option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF)
64   if(CLANG_TEST_USE_VG)
65     set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg")
66   endif ()
68   set(LIT_ARGS "${CLANG_TEST_EXTRA_ARGS} ${LLVM_LIT_ARGS}")
69   separate_arguments(LIT_ARGS)
71   add_custom_target(clang-test.deps)
73   foreach(testdir ${CLANG_TEST_DIRECTORIES})
74     add_custom_target(clang-test-${testdir}
75       COMMAND ${PYTHON_EXECUTABLE}
76                   ${LIT}
77                   --param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
78                   --param build_config=${CMAKE_CFG_INTDIR}
79                   ${LIT_ARGS}
80                   ${CMAKE_CURRENT_BINARY_DIR}/${testdir}
81                   DEPENDS clang c-index-test FileCheck not count
82                   COMMENT "Running Clang regression tests in ${testdir}")
83   endforeach()
85   add_custom_target(clang-test
86     COMMAND ${PYTHON_EXECUTABLE}
87                 ${LIT}
88                 --param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
89                 --param clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
90                 --param build_config=${CMAKE_CFG_INTDIR}
91                 --param build_mode=${RUNTIME_BUILD_MODE}
92                 ${LIT_ARGS}
93                 ${CMAKE_CURRENT_BINARY_DIR}
94                 COMMENT "Running Clang regression tests")
96   add_custom_target(clang-c++tests
97     COMMAND ${PYTHON_EXECUTABLE}
98                 ${LIT}
99                 --param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
100                 --param build_config=${CMAKE_CFG_INTDIR}
101                 ${LIT_ARGS}
102                 ${CMAKE_CURRENT_SOURCE_DIR}/../utils/C++Tests
103                 DEPENDS clang c-index-test FileCheck not count
104                 COMMENT "Running Clang regression tests")
106   if( NOT CLANG_BUILT_STANDALONE )
107      add_custom_target(check-all
108       COMMAND ${PYTHON_EXECUTABLE}
109                 ${LIT}
110                 --param build_config=${CMAKE_CFG_INTDIR}
111                 --param build_mode=${RUNTIME_BUILD_MODE}
112                 ${LIT_ARGS}
113                 ${LLVM_BINARY_DIR}/test
114                 ${CMAKE_CURRENT_BINARY_DIR}
115                 COMMENT "Running Clang and LLVM regression tests")
116     add_dependencies(check-all check.deps clang-test.deps)
117     add_dependencies(clang-test.deps
118                      ClangUnitTests
119                      llvm-dis opt
120                      FileCheck count not
121                      )
123  endif()
125   add_dependencies(clang-test clang-test.deps)
126   add_dependencies(clang-test.deps
127                  clang clang-headers c-index-test
128                  )
130 endif()