blob: 8b3c738ed78b9571f07d6fe0c68ce0302451d1a7 [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"
Douglas Gregor2e222532009-07-02 17:08:52 +000012 "Index"
Douglas Gregor79865192009-06-05 23:57:17 +000013 "Lexer"
14 "Misc"
15 "PCH"
16 "Parser"
17 "Preprocessor"
18 "Rewriter"
19 "Sema"
20 "SemaCXX"
21 "SemaObjC"
22 "SemaObjCXX"
23 "SemaTemplate")
Douglas Gregoreb357b62009-06-05 16:00:31 +000024
Douglas Gregor79865192009-06-05 23:57:17 +000025include(FindPythonInterp)
26if(PYTHONINTERP_FOUND)
Daniel Dunbare9a73232009-11-03 07:25:53 +000027 get_target_triple(TARGET_TRIPLE)
Douglas Gregor79865192009-06-05 23:57:17 +000028 get_target_property(LLVM_TOOLS_PATH clang RUNTIME_OUTPUT_DIRECTORY)
Daniel Dunbar9e10cc72009-09-26 07:36:09 +000029 get_target_property(LLVM_LIBS_PATH clang LIBRARY_OUTPUT_DIRECTORY)
Douglas Gregorebfc1802009-06-16 20:13:51 +000030 set(CLANG_TEST_EXTRA_ARGS)
31 if (MSVC OR XCODE)
32 set(CLANG_TEST_EXTRA_ARGS "--no-progress-bar")
33 endif()
Douglas Gregor79865192009-06-05 23:57:17 +000034
Daniel Dunbar7af18d32009-09-17 19:55:53 +000035 foreach(testdir ${CLANG_TEST_DIRECTORIES})
Daniel Dunbare9a73232009-11-03 07:25:53 +000036 add_custom_target(clang-test-${testdir}
Daniel Dunbar1b720a92009-09-20 19:04:35 +000037 COMMAND sed -e "s#\@LLVM_SOURCE_DIR\@#${LLVM_MAIN_SRC_DIR}#"
38 -e "s#\@LLVM_BINARY_DIR\@#${LLVM_BINARY_DIR}#"
Daniel Dunbar7af18d32009-09-17 19:55:53 +000039 -e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}#"
Daniel Dunbar9e10cc72009-09-26 07:36:09 +000040 -e "s#\@LLVM_LIBS_DIR\@#${LLVM_LIBS_PATH}/${CMAKE_CFG_INTDIR}#"
Daniel Dunbar1b720a92009-09-20 19:04:35 +000041 -e "s#\@CLANG_SOURCE_DIR\@#${CMAKE_CURRENT_SOURCE_DIR}/..#"
42 -e "s#\@CLANG_BINARY_DIR\@#${CMAKE_CURRENT_BINARY_DIR}/..#"
Daniel Dunbare9a73232009-11-03 07:25:53 +000043 -e "s#\@TARGET_TRIPLE\@#${TARGET_TRIPLE}#"
Daniel Dunbar7af18d32009-09-17 19:55:53 +000044 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in >
45 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
Daniel Dunbare9a73232009-11-03 07:25:53 +000046 COMMAND ${PYTHON_EXECUTABLE}
Daniel Dunbar7af18d32009-09-17 19:55:53 +000047 ${LLVM_SOURCE_DIR}/utils/lit/lit.py
Daniel Dunbarb258d8f2009-11-05 16:36:19 +000048 --param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
Daniel Dunbar584425c2009-09-24 07:18:36 +000049 -sv ${CLANG_TEST_EXTRA_ARGS}
Daniel Dunbar7af18d32009-09-17 19:55:53 +000050 ${CMAKE_CURRENT_BINARY_DIR}/${testdir}
Douglas Gregor52e71082009-10-16 18:18:30 +000051 DEPENDS clang clang-cc index-test c-index-test
Daniel Dunbar7af18d32009-09-17 19:55:53 +000052 COMMENT "Running Clang regression tests in ${testdir}")
Douglas Gregorf5dba382009-06-05 16:26:18 +000053 endforeach()
Douglas Gregoreb357b62009-06-05 16:00:31 +000054
Douglas Gregor79865192009-06-05 23:57:17 +000055 add_custom_target(clang-test
Daniel Dunbar1b720a92009-09-20 19:04:35 +000056 COMMAND sed -e "s#\@LLVM_SOURCE_DIR\@#${LLVM_MAIN_SRC_DIR}#"
57 -e "s#\@LLVM_BINARY_DIR\@#${LLVM_BINARY_DIR}#"
Daniel Dunbar7af18d32009-09-17 19:55:53 +000058 -e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}#"
Daniel Dunbar9e10cc72009-09-26 07:36:09 +000059 -e "s#\@LLVM_LIBS_DIR\@#${LLVM_LIBS_PATH}/${CMAKE_CFG_INTDIR}#"
Daniel Dunbar1b720a92009-09-20 19:04:35 +000060 -e "s#\@CLANG_SOURCE_DIR\@#${CMAKE_CURRENT_SOURCE_DIR}/..#"
61 -e "s#\@CLANG_BINARY_DIR\@#${CMAKE_CURRENT_BINARY_DIR}/..#"
Daniel Dunbare9a73232009-11-03 07:25:53 +000062 -e "s#\@TARGET_TRIPLE\@#${TARGET_TRIPLE}#"
Daniel Dunbar7af18d32009-09-17 19:55:53 +000063 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in >
64 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
Daniel Dunbare9a73232009-11-03 07:25:53 +000065 COMMAND ${PYTHON_EXECUTABLE}
Daniel Dunbar7af18d32009-09-17 19:55:53 +000066 ${LLVM_SOURCE_DIR}/utils/lit/lit.py
Daniel Dunbarb258d8f2009-11-05 16:36:19 +000067 --param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
Daniel Dunbar584425c2009-09-24 07:18:36 +000068 -sv ${CLANG_TEST_EXTRA_ARGS}
Daniel Dunbar7af18d32009-09-17 19:55:53 +000069 ${CMAKE_CURRENT_BINARY_DIR}
Douglas Gregor52e71082009-10-16 18:18:30 +000070 DEPENDS clang clang-cc index-test c-index-test
Daniel Dunbar7af18d32009-09-17 19:55:53 +000071 COMMENT "Running Clang regression tests")
Daniel Dunbarcceef8b2009-09-22 10:07:55 +000072
73 add_custom_target(clang-c++tests
74 COMMAND sed -e "s#\@LLVM_SOURCE_DIR\@#${LLVM_MAIN_SRC_DIR}#"
75 -e "s#\@LLVM_BINARY_DIR\@#${LLVM_BINARY_DIR}#"
76 -e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}#"
Daniel Dunbar9e10cc72009-09-26 07:36:09 +000077 -e "s#\@LLVM_LIBS_DIR\@#${LLVM_LIBS_PATH}/${CMAKE_CFG_INTDIR}#"
Daniel Dunbarcceef8b2009-09-22 10:07:55 +000078 -e "s#\@CLANG_SOURCE_DIR\@#${CMAKE_CURRENT_SOURCE_DIR}/..#"
79 -e "s#\@CLANG_BINARY_DIR\@#${CMAKE_CURRENT_BINARY_DIR}/..#"
Daniel Dunbare9a73232009-11-03 07:25:53 +000080 -e "s#\@TARGET_TRIPLE\@#${TARGET_TRIPLE}#"
Daniel Dunbarcceef8b2009-09-22 10:07:55 +000081 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in >
82 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
Daniel Dunbare9a73232009-11-03 07:25:53 +000083 COMMAND ${PYTHON_EXECUTABLE}
Daniel Dunbarcceef8b2009-09-22 10:07:55 +000084 ${LLVM_SOURCE_DIR}/utils/lit/lit.py
Daniel Dunbarb258d8f2009-11-05 16:36:19 +000085 --param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
Daniel Dunbar584425c2009-09-24 07:18:36 +000086 -sv ${CLANG_TEST_EXTRA_ARGS}
Daniel Dunbarcceef8b2009-09-22 10:07:55 +000087 ${CMAKE_CURRENT_SOURCE_DIR}/../utils/C++Tests
Douglas Gregor52e71082009-10-16 18:18:30 +000088 DEPENDS clang clang-cc index-test c-index-test
Daniel Dunbarcceef8b2009-09-22 10:07:55 +000089 COMMENT "Running Clang regression tests")
Daniel Dunbare9a73232009-11-03 07:25:53 +000090endif()