blob: b7356c2de01aa9aac39e118ad3a572b75e07f8b2 [file] [log] [blame]
Douglas Gregor79865192009-06-05 23:57:17 +00001set(CLANG_TEST_DIRECTORIES
2 "Analysis"
Douglas Gregor81b747b2009-09-17 21:32:03 +00003 "CodeCompletion"
Douglas Gregor79865192009-06-05 23:57:17 +00004 "CodeGen"
Peter Collingbourne744d90b2011-10-06 16:49:54 +00005 "CodeGenCUDA"
Douglas Gregor79865192009-06-05 23:57:17 +00006 "CodeGenCXX"
7 "CodeGenObjC"
Peter Collingbournef315fa82011-02-14 01:42:53 +00008 "CodeGenOpenCL"
Douglas Gregor79865192009-06-05 23:57:17 +00009 "Coverage"
Douglas Gregorebfc1802009-06-16 20:13:51 +000010 "CXX"
Douglas Gregor79865192009-06-05 23:57:17 +000011 "Driver"
12 "FixIt"
13 "Frontend"
Ted Kremenekf7507f22010-03-08 23:38:27 +000014 "Headers"
Douglas Gregor2e222532009-07-02 17:08:52 +000015 "Index"
Douglas Gregor79865192009-06-05 23:57:17 +000016 "Lexer"
17 "Misc"
18 "PCH"
19 "Parser"
20 "Preprocessor"
21 "Rewriter"
22 "Sema"
Peter Collingbourneced76712010-12-01 03:15:31 +000023 "SemaCUDA"
Douglas Gregor79865192009-06-05 23:57:17 +000024 "SemaCXX"
25 "SemaObjC"
26 "SemaObjCXX"
Peter Collingbourne39d3e7a2011-02-15 19:46:23 +000027 "SemaOpenCL"
Douglas Gregor79865192009-06-05 23:57:17 +000028 "SemaTemplate")
Douglas Gregoreb357b62009-06-05 16:00:31 +000029
Daniel Dunbar1e634922009-11-07 23:53:32 +000030set(LLVM_SOURCE_DIR "${LLVM_MAIN_SRC_DIR}")
31set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}")
Andrew Trick7140b3c2011-06-23 18:00:48 +000032set(LLVM_BUILD_MODE "%(build_mode)s")
Daniel Dunbar30eb0552009-11-08 09:46:39 +000033set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s")
34set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib/%(build_config)s")
Daniel Dunbar1e634922009-11-07 23:53:32 +000035set(CLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..")
36set(CLANG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
NAKAMURA Takumic3189e92011-02-03 09:01:12 +000037if(BUILD_SHARED_LIBS)
38 set(ENABLE_SHARED 1)
39else()
40 set(ENABLE_SHARED 0)
41endif(BUILD_SHARED_LIBS)
Daniel Dunbar1e634922009-11-07 23:53:32 +000042
43configure_file(
44 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
45 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
46
NAKAMURA Takumic3189e92011-02-03 09:01:12 +000047configure_file(
48 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
49 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
50 @ONLY)
51
Douglas Gregor79865192009-06-05 23:57:17 +000052include(FindPythonInterp)
53if(PYTHONINTERP_FOUND)
Oscar Fuentes57ca32b2011-02-05 19:08:56 +000054 if( LLVM_MAIN_SRC_DIR )
55 set(LIT "${LLVM_SOURCE_DIR}/utils/lit/lit.py")
56 else()
Oscar Fuentesba43a4d2011-02-05 21:37:51 +000057 set(LIT "${PATH_TO_LLVM_BUILD}/bin/${CMAKE_CFG_INTDIR}/llvm-lit")
NAKAMURA Takumi378d2a12011-02-23 12:07:49 +000058 # Installed LLVM does not contain ${CMAKE_CFG_INTDIR} in paths.
59 if( NOT EXISTS ${LIT} )
60 set(LIT "${PATH_TO_LLVM_BUILD}/bin/llvm-lit")
61 endif()
Oscar Fuentes57ca32b2011-02-05 19:08:56 +000062 endif()
63
Oscar Fuentesba43a4d2011-02-05 21:37:51 +000064 if( PATH_TO_LLVM_BUILD )
65 set(CLANG_TEST_EXTRA_ARGS "--path=${CLANG_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}")
66 endif()
Douglas Gregor79865192009-06-05 23:57:17 +000067
Daniel Dunbare33f82f2009-11-22 21:55:22 +000068 option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF)
69 if(CLANG_TEST_USE_VG)
70 set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg")
71 endif ()
72
NAKAMURA Takumic84aca42010-11-11 04:09:51 +000073 set(LIT_ARGS "${CLANG_TEST_EXTRA_ARGS} ${LLVM_LIT_ARGS}")
74 separate_arguments(LIT_ARGS)
75
Jeffrey Yasskin718b01d2011-02-15 07:54:28 +000076 add_custom_target(clang-test.deps)
Oscar Fuentesa3f787c2011-02-20 22:06:44 +000077 set_target_properties(clang-test.deps PROPERTIES FOLDER "Clang tests")
Jeffrey Yasskin718b01d2011-02-15 07:54:28 +000078
Douglas Gregor79865192009-06-05 23:57:17 +000079 add_custom_target(clang-test
Daniel Dunbare9a73232009-11-03 07:25:53 +000080 COMMAND ${PYTHON_EXECUTABLE}
Oscar Fuentes57ca32b2011-02-05 19:08:56 +000081 ${LIT}
Daniel Dunbarb258d8f2009-11-05 16:36:19 +000082 --param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
Jeffrey Yasskin718b01d2011-02-15 07:54:28 +000083 --param clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
Daniel Dunbar1e634922009-11-07 23:53:32 +000084 --param build_config=${CMAKE_CFG_INTDIR}
Jeffrey Yasskin718b01d2011-02-15 07:54:28 +000085 --param build_mode=${RUNTIME_BUILD_MODE}
NAKAMURA Takumic84aca42010-11-11 04:09:51 +000086 ${LIT_ARGS}
Daniel Dunbar7af18d32009-09-17 19:55:53 +000087 ${CMAKE_CURRENT_BINARY_DIR}
Daniel Dunbar7af18d32009-09-17 19:55:53 +000088 COMMENT "Running Clang regression tests")
Oscar Fuentesa3f787c2011-02-20 22:06:44 +000089 set_target_properties(clang-test PROPERTIES FOLDER "Clang tests")
Daniel Dunbarcceef8b2009-09-22 10:07:55 +000090
Jeffrey Yasskin718b01d2011-02-15 07:54:28 +000091 if( NOT CLANG_BUILT_STANDALONE )
NAKAMURA Takumi582c1fb2011-07-20 16:35:49 +000092 add_custom_target(check-all
Jeffrey Yasskin718b01d2011-02-15 07:54:28 +000093 COMMAND ${PYTHON_EXECUTABLE}
Oscar Fuentes57ca32b2011-02-05 19:08:56 +000094 ${LIT}
NAKAMURA Takumi3aa8c642010-11-29 01:18:56 +000095 --param build_config=${CMAKE_CFG_INTDIR}
96 --param build_mode=${RUNTIME_BUILD_MODE}
97 ${LIT_ARGS}
98 ${LLVM_BINARY_DIR}/test
99 ${CMAKE_CURRENT_BINARY_DIR}
100 COMMENT "Running Clang and LLVM regression tests")
Douglas Gregorfc71ac82011-07-15 21:03:20 +0000101 add_dependencies(check-all clang-test.deps)
Douglas Gregor02bba192011-02-25 00:43:05 +0000102 if ( LLVM_INCLUDE_TESTS )
NAKAMURA Takumia47027b2011-08-16 03:45:31 +0000103 add_dependencies(clang-test.deps ClangUnitTests)
104 add_dependencies(check-all check.deps)
Douglas Gregor02bba192011-02-25 00:43:05 +0000105 endif ( LLVM_INCLUDE_TESTS )
NAKAMURA Takumi652f1ef2011-02-16 03:07:10 +0000106 add_dependencies(clang-test.deps
NAKAMURA Takumi582c1fb2011-07-20 16:35:49 +0000107 llvm-dis llc opt
NAKAMURA Takumi652f1ef2011-02-16 03:07:10 +0000108 FileCheck count not
109 )
NAKAMURA Takumi582c1fb2011-07-20 16:35:49 +0000110 set_target_properties(check-all PROPERTIES FOLDER "Clang tests")
111 endif()
NAKAMURA Takumif0d9d8b2010-12-10 02:58:03 +0000112
113 add_dependencies(clang-test clang-test.deps)
114 add_dependencies(clang-test.deps
Ted Kremenek84251262011-08-11 22:06:55 +0000115 clang clang-headers c-index-test diagtool arcmt-test c-arcmt-test
NAKAMURA Takumi652f1ef2011-02-16 03:07:10 +0000116 )
NAKAMURA Takumif0d9d8b2010-12-10 02:58:03 +0000117
Daniel Dunbare9a73232009-11-03 07:25:53 +0000118endif()