blob: 4d02d2b3eb663d5e9f8b117c90f1da26a4083da3 [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"
5 "CodeGenCXX"
6 "CodeGenObjC"
7 "Coverage"
Douglas Gregorebfc1802009-06-16 20:13:51 +00008 "CXX"
Douglas Gregor79865192009-06-05 23:57:17 +00009 "Driver"
10 "FixIt"
11 "Frontend"
Ted Kremenekf7507f22010-03-08 23:38:27 +000012 "Headers"
Douglas Gregor2e222532009-07-02 17:08:52 +000013 "Index"
Douglas Gregor79865192009-06-05 23:57:17 +000014 "Lexer"
15 "Misc"
16 "PCH"
17 "Parser"
18 "Preprocessor"
19 "Rewriter"
20 "Sema"
21 "SemaCXX"
22 "SemaObjC"
23 "SemaObjCXX"
24 "SemaTemplate")
Douglas Gregoreb357b62009-06-05 16:00:31 +000025
Daniel Dunbar1e634922009-11-07 23:53:32 +000026set(LLVM_SOURCE_DIR "${LLVM_MAIN_SRC_DIR}")
27set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}")
Daniel Dunbar30eb0552009-11-08 09:46:39 +000028set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s")
29set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib/%(build_config)s")
Daniel Dunbar1e634922009-11-07 23:53:32 +000030set(CLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..")
31set(CLANG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
32
33configure_file(
34 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
35 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
36
Douglas Gregor79865192009-06-05 23:57:17 +000037include(FindPythonInterp)
38if(PYTHONINTERP_FOUND)
Douglas Gregorebfc1802009-06-16 20:13:51 +000039 set(CLANG_TEST_EXTRA_ARGS)
Douglas Gregor79865192009-06-05 23:57:17 +000040
Daniel Dunbare33f82f2009-11-22 21:55:22 +000041 option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF)
42 if(CLANG_TEST_USE_VG)
43 set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg")
44 endif ()
45
NAKAMURA Takumic84aca42010-11-11 04:09:51 +000046 set(LIT_ARGS "${CLANG_TEST_EXTRA_ARGS} ${LLVM_LIT_ARGS}")
47 separate_arguments(LIT_ARGS)
48
Daniel Dunbar7af18d32009-09-17 19:55:53 +000049 foreach(testdir ${CLANG_TEST_DIRECTORIES})
Daniel Dunbare9a73232009-11-03 07:25:53 +000050 add_custom_target(clang-test-${testdir}
Daniel Dunbare9a73232009-11-03 07:25:53 +000051 COMMAND ${PYTHON_EXECUTABLE}
Daniel Dunbar7af18d32009-09-17 19:55:53 +000052 ${LLVM_SOURCE_DIR}/utils/lit/lit.py
Daniel Dunbarb258d8f2009-11-05 16:36:19 +000053 --param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
Daniel Dunbar1e634922009-11-07 23:53:32 +000054 --param build_config=${CMAKE_CFG_INTDIR}
NAKAMURA Takumic84aca42010-11-11 04:09:51 +000055 ${LIT_ARGS}
Daniel Dunbar7af18d32009-09-17 19:55:53 +000056 ${CMAKE_CURRENT_BINARY_DIR}/${testdir}
Daniel Dunbar2b1acd42010-07-29 22:57:17 +000057 DEPENDS clang c-index-test FileCheck not count
Daniel Dunbar7af18d32009-09-17 19:55:53 +000058 COMMENT "Running Clang regression tests in ${testdir}")
Douglas Gregorf5dba382009-06-05 16:26:18 +000059 endforeach()
Douglas Gregoreb357b62009-06-05 16:00:31 +000060
Douglas Gregor79865192009-06-05 23:57:17 +000061 add_custom_target(clang-test
Daniel Dunbare9a73232009-11-03 07:25:53 +000062 COMMAND ${PYTHON_EXECUTABLE}
Daniel Dunbar7af18d32009-09-17 19:55:53 +000063 ${LLVM_SOURCE_DIR}/utils/lit/lit.py
Daniel Dunbarb258d8f2009-11-05 16:36:19 +000064 --param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
Daniel Dunbar1e634922009-11-07 23:53:32 +000065 --param build_config=${CMAKE_CFG_INTDIR}
NAKAMURA Takumic84aca42010-11-11 04:09:51 +000066 ${LIT_ARGS}
Daniel Dunbar7af18d32009-09-17 19:55:53 +000067 ${CMAKE_CURRENT_BINARY_DIR}
Daniel Dunbar2b1acd42010-07-29 22:57:17 +000068 DEPENDS clang c-index-test FileCheck not count
Daniel Dunbar7af18d32009-09-17 19:55:53 +000069 COMMENT "Running Clang regression tests")
Daniel Dunbarcceef8b2009-09-22 10:07:55 +000070
71 add_custom_target(clang-c++tests
Daniel Dunbare9a73232009-11-03 07:25:53 +000072 COMMAND ${PYTHON_EXECUTABLE}
Daniel Dunbarcceef8b2009-09-22 10:07:55 +000073 ${LLVM_SOURCE_DIR}/utils/lit/lit.py
Daniel Dunbarb258d8f2009-11-05 16:36:19 +000074 --param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
Daniel Dunbar1e634922009-11-07 23:53:32 +000075 --param build_config=${CMAKE_CFG_INTDIR}
NAKAMURA Takumic84aca42010-11-11 04:09:51 +000076 ${LIT_ARGS}
Daniel Dunbarcceef8b2009-09-22 10:07:55 +000077 ${CMAKE_CURRENT_SOURCE_DIR}/../utils/C++Tests
Daniel Dunbar2b1acd42010-07-29 22:57:17 +000078 DEPENDS clang c-index-test FileCheck not count
Daniel Dunbarcceef8b2009-09-22 10:07:55 +000079 COMMENT "Running Clang regression tests")
Daniel Dunbare9a73232009-11-03 07:25:53 +000080endif()