On Tue, Feb 19, 2013 at 9:08 PM, Edwin Vane <[email protected]> wrote: > Author: revane > Date: Tue Feb 19 13:08:10 2013 > New Revision: 175544 > > URL: http://llvm.org/viewvc/llvm-project?rev=175544&view=rev > Log: > 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
If I could bikeshed on the name of this directory, I would prefer a different name. The motivation is that 'autogen' is a GNU program http://www.gnu.org/software/autogen/ and the directory name could be confused to be related with that. > 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. > > Modified: > clang-tools-extra/trunk/test/CMakeLists.txt > clang-tools-extra/trunk/test/Makefile > clang-tools-extra/trunk/test/lit.cfg > clang-tools-extra/trunk/test/lit.site.cfg.in > > Modified: clang-tools-extra/trunk/test/CMakeLists.txt > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/CMakeLists.txt?rev=175544&r1=175543&r2=175544&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/CMakeLists.txt (original) > +++ clang-tools-extra/trunk/test/CMakeLists.txt Tue Feb 19 13:08:10 2013 > @@ -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") > - > > Modified: clang-tools-extra/trunk/test/Makefile > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/Makefile?rev=175544&r1=175543&r2=175544&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/Makefile (original) > +++ clang-tools-extra/trunk/test/Makefile Tue Feb 19 13:08:10 2013 > @@ -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)%= > # 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 > > > Modified: clang-tools-extra/trunk/test/lit.cfg > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/lit.cfg?rev=175544&r1=175543&r2=175544&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/lit.cfg (original) > +++ clang-tools-extra/trunk/test/lit.cfg Tue Feb 19 13:08:10 2013 > @@ -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 A typo: 'weak'? > 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( > # 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!') > > Modified: clang-tools-extra/trunk/test/lit.site.cfg.in > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/lit.site.cfg.in?rev=175544&r1=175543&r2=175544&view=diff > ============================================================================== > --- clang-tools-extra/trunk/test/lit.site.cfg.in (original) > +++ clang-tools-extra/trunk/test/lit.site.cfg.in Tue Feb 19 13:08:10 2013 > @@ -8,6 +8,10 @@ config.lit_tools_dir = "@LLVM_LIT_TOOLS_ > 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: Dmitri -- main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if (j){printf("%d\n",i);}}} /*Dmitri Gribenko <[email protected]>*/ _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
