diff options
author | Edwin Vane <edwin.vane@intel.com> | 2013-02-19 19:08:10 +0000 |
---|---|---|
committer | Edwin Vane <edwin.vane@intel.com> | 2013-02-19 19:08:10 +0000 |
commit | 08085afd91bd0132dbf8a64ee8b22609af9edcfe (patch) | |
tree | 8982641d27297b2ca85d6c2b204df7c75af75a75 /test | |
parent | 92617fa4bc000c900b1a98018215e3aea0092c00 (diff) |
Add support for auto-generating LIT tests by the build
autoconf and CMake flavours both updated to auto-generate files for use
in cpp11-migrate's LIT tests.
Auto-generated files are placed in the build directory under
test/cpp11-migrate/autogen. The directory structure past this point
mirrors the structure in the source directory under test/cpp11-migrate.
A lit.site.cfg is generated in test/cpp11-migrate/autogen to describe
the new test suite. When LIT runs, it runs the standard testsuite and
now also the auto-generated testsuite.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@175544 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 20 | ||||
-rw-r--r-- | test/Makefile | 10 | ||||
-rw-r--r-- | test/lit.cfg | 17 | ||||
-rw-r--r-- | test/lit.site.cfg.in | 4 |
4 files changed, 31 insertions, 20 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 195852d4..9782638f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -7,28 +7,36 @@ set(CLANG_TOOLS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..") set(CLANG_TOOLS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..") -configure_lit_site_cfg( - ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in - ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg - ) - option(CLANG_TOOLS_TEST_USE_VG "Run Clang tools' tests under Valgrind" OFF) if(CLANG_TOOLS_TEST_USE_VG) set(CLANG_TOOLS_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg") endif() +add_subdirectory(cpp11-migrate) + +set(TEST_SOURCE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) +set(TEST_EXEC_ROOT ${CMAKE_CURRENT_BINARY_DIR}) +set(TESTSUITE_NAME "Clang Tools") +configure_lit_site_cfg( + ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in + ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg + ) + set(CLANG_TOOLS_TEST_DEPS # Base line deps. clang clang-headers FileCheck count not + # cpp11-migrate auto-generated tests. See cpp11-migrate/CMakeLists.txt. + cpp11-migrate-autogen + # Individual tools we test. remove-cstr-calls cpp11-migrate clang-format ) add_lit_testsuite(check-clang-tools "Running the Clang extra tools' regression tests" ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/cpp11-migrate/autogen DEPENDS ${CLANG_TOOLS_TEST_DEPS} ARGS ${CLANG_TOOLS_TEST_EXTRA_ARGS} ) set_target_properties(check-clang-tools PROPERTIES FOLDER "Clang extra tools' tests") - diff --git a/test/Makefile b/test/Makefile index e75b68fe..da5e81f5 100644 --- a/test/Makefile +++ b/test/Makefile @@ -8,6 +8,10 @@ ##===----------------------------------------------------------------------===## CLANG_LEVEL := ../../.. +include $(CLANG_LEVEL)/../../Makefile.config + +# Recurse into any subdirectories that have their own Makefiles. +DIRS := cpp11-migrate include $(CLANG_LEVEL)/Makefile # Test in all immediate subdirectories if unset. @@ -23,6 +27,9 @@ TESTDIRS := $(TESTDIRS:$(PROJ_SRC_DIR)%=$(PROJ_OBJ_DIR)%) # Allow EXTRA_TESTDIRS to provide additional test directories. TESTDIRS += $(EXTRA_TESTDIRS) +# List of roots for auto-generated tests. +TESTDIRS += $(PROJ_OBJ_DIR)/cpp11-migrate/autogen + ifndef TESTARGS ifdef VERBOSE TESTARGS = -v @@ -54,6 +61,9 @@ lit.site.cfg: FORCE @$(ECHOPATH) s=@CLANG_TOOLS_SOURCE_DIR@=$(PROJ_SRC_DIR)/..=g >> lit.tmp @$(ECHOPATH) s=@CLANG_TOOLS_BINARY_DIR@=$(PROJ_OBJ_DIR)/..=g >> lit.tmp @$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> lit.tmp + @$(ECHOPATH) s=@TEST_SOURCE_ROOT@=$(PROJ_SRC_DIR)=g >> lit.tmp + @$(ECHOPATH) s=@TEST_EXEC_ROOT@=$(PROJ_OBJ_DIR)=g >> lit.tmp + @$(ECHOPATH) s=@TESTSUITE_NAME@=Clang Tools=g >> lit.tmp @sed -f lit.tmp $(PROJ_SRC_DIR)/lit.site.cfg.in > $@ @-rm -f lit.tmp diff --git a/test/lit.cfg b/test/lit.cfg index 0d50e1b8..acaef944 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -8,12 +8,9 @@ import subprocess # Configuration file for the 'lit' test runner. -# name: The name of this test suite. -config.name = 'Clang Tools' - -# Tweak PATH for Win32 +# weak PATH for Win32 if platform.system() == 'Windows': - # Seek sane tools in directories and set to $PATH. + # Seek sane tools in directories and set to $PATH. path = getattr(config, 'lit_tools_dir', None) path = lit.getToolsPath(path, config.environment['PATH'], @@ -34,14 +31,6 @@ config.test_format = lit.formats.ShTest(execute_external) # suffixes: A list of file extensions to treat as test files. config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl', '.s'] -# test_source_root: The root path where tests are located. -config.test_source_root = os.path.dirname(__file__) - -# test_exec_root: The root path where tests should be run. -clang_tools_binary_dir = getattr(config, 'clang_tools_binary_dir', None) -if clang_tools_binary_dir is not None: - config.test_exec_root = os.path.join(clang_tools_binary_dir, 'test') - # Clear some environment variables that might affect Clang. # # This first set of vars are read by Clang, but shouldn't affect tests @@ -72,7 +61,7 @@ for name in possibly_dangerous_env_vars: del config.environment[name] # Tweak the PATH to include the tools dir and the scripts dir. -if clang_tools_binary_dir is not None: +if hasattr(config, 'clang_tools_binary_dir'): llvm_tools_dir = getattr(config, 'llvm_tools_dir', None) if not llvm_tools_dir: lit.fatal('No LLVM tools dir set!') diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in index 88aaa6c4..6ecdf2db 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -8,6 +8,10 @@ config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" config.clang_tools_binary_dir = "@CLANG_TOOLS_BINARY_DIR@" config.target_triple = "@TARGET_TRIPLE@" +config.name = "@TESTSUITE_NAME@" +config.test_source_root = "@TEST_SOURCE_ROOT@" +config.test_exec_root = "@TEST_EXEC_ROOT@" + # Support substitution of the tools and libs dirs with user parameters. This is # used when we can't determine the tool dir at configuration time. try: |