[cfe-commits] r82160 - in /cfe/trunk/test: CMakeLists.txt Makefile lit.cfg lit.site.cfg.in

Daniel Dunbar daniel at zuster.org
Thu Sep 17 12:55:53 PDT 2009


Author: ddunbar
Date: Thu Sep 17 14:55:53 2009
New Revision: 82160

URL: http://llvm.org/viewvc/llvm-project?rev=82160&view=rev
Log:
Tweak clang testing.
 - Move CMake to using the new test runner.

 - Switch Makefiles to use the lit.site.cfg.in template.

 - Remove explicit --path arguments, instead this gets written into the site
   configuration. This means running lit from the command line should use the
   exact same configuration as is used in 'make test', assuming it can find the
   site configuration file. You still need to run 'make test' (or the cmake
   build target equivalent) at least once.

Modified:
    cfe/trunk/test/CMakeLists.txt
    cfe/trunk/test/Makefile
    cfe/trunk/test/lit.cfg
    cfe/trunk/test/lit.site.cfg.in

Modified: cfe/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CMakeLists.txt?rev=82160&r1=82159&r2=82160&view=diff

==============================================================================
--- cfe/trunk/test/CMakeLists.txt (original)
+++ cfe/trunk/test/CMakeLists.txt Thu Sep 17 14:55:53 2009
@@ -28,39 +28,32 @@
   if (MSVC OR XCODE)
     set(CLANG_TEST_EXTRA_ARGS "--no-progress-bar")
   endif()
-  set(all_testdirs)
- foreach(testdir ${CLANG_TEST_DIRECTORIES})
-   add_custom_target(clang-test-${testdir} 
-      ${PYTHON_EXECUTABLE} 
-      ${LLVM_SOURCE_DIR}/tools/clang/utils/test/MultiTestRunner.py
-      "--root=${LLVM_SOURCE_DIR}/tools/clang/test"
-      "--path=${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}"
-      "--path=${LLVM_SOURCE_DIR}/test/Scripts"
-      -s ${CLANG_TEST_EXTRA_ARGS}
-      --clang=${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}/clang
-      --clang-cc=${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}/clang-cc
-     ${CMAKE_CURRENT_SOURCE_DIR}/${testdir}/
-      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-      COMMENT "Running Clang regression tests in ${testdir}")
 
-    list(APPEND all_testdirs ${CMAKE_CURRENT_SOURCE_DIR}/${testdir}/)
+  foreach(testdir ${CLANG_TEST_DIRECTORIES})
+    add_custom_target(clang-test-${testdir} 
+      COMMAND sed -e "s#\@CLANG_SOURCE_DIR\@#${CMAKE_CURRENT_SOURCE_DIR}/..#"
+                  -e "s#\@CLANG_BINARY_DIR\@#${CMAKE_CURRENT_BINARY_DIR}/..#"
+                  -e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}#"
+                  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in >
+                  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+      COMMAND ${PYTHON_EXECUTABLE} 
+                  ${LLVM_SOURCE_DIR}/utils/lit/lit.py
+                  -s ${CLANG_TEST_EXTRA_ARGS}
+                  ${CMAKE_CURRENT_BINARY_DIR}/${testdir}
+                  DEPENDS clang clang-cc index-test
+                  COMMENT "Running Clang regression tests in ${testdir}")
   endforeach()
 
   add_custom_target(clang-test
-    ${PYTHON_EXECUTABLE} 
-    ${LLVM_SOURCE_DIR}/tools/clang/utils/test/MultiTestRunner.py
-    "--root=${LLVM_SOURCE_DIR}/tools/clang/test"
-    "--path=${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}"
-    "--path=${LLVM_SOURCE_DIR}/test/Scripts"
-    -s ${CLANG_TEST_EXTRA_ARGS}
-    --clang=${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}/clang
-    --clang-cc=${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}/clang-cc
-    ${all_testdirs}
-    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-    DEPENDS clang clang-cc index-test
-    COMMENT "Running Clang regression tests")
+    COMMAND sed -e "s#\@CLANG_SOURCE_DIR\@#${CMAKE_CURRENT_SOURCE_DIR}/..#"
+                -e "s#\@CLANG_BINARY_DIR\@#${CMAKE_CURRENT_BINARY_DIR}/..#"
+                -e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}#"
+                ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in >
+                ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+    COMMAND ${PYTHON_EXECUTABLE} 
+                ${LLVM_SOURCE_DIR}/utils/lit/lit.py
+                -s ${CLANG_TEST_EXTRA_ARGS}
+                ${CMAKE_CURRENT_BINARY_DIR}
+                DEPENDS clang clang-cc index-test
+                COMMENT "Running Clang regression tests")
 endif()  
-
-# Produce LIT site configuration file.
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
-  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)

Modified: cfe/trunk/test/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Makefile?rev=82160&r1=82159&r2=82160&view=diff

==============================================================================
--- cfe/trunk/test/Makefile (original)
+++ cfe/trunk/test/Makefile Thu Sep 17 14:55:53 2009
@@ -29,8 +29,6 @@
 all:: lit.site.cfg
 	@ echo '--- Running clang tests for $(TARGET_TRIPLE) ---'
 	@ $(LLVM_SRC_ROOT)/utils/lit/lit.py \
-	  --path $(ToolDir) \
-	  --path $(LLVM_SRC_ROOT)/test/Scripts \
 	  $(TESTARGS) $(LIT2_TESTDIRS) $(VGARG)
 else
 all::
@@ -46,14 +44,10 @@
 
 lit.site.cfg: FORCE
 	@echo "Making 'lit.site.cfg' file..."
-	@echo "## Autogenerated by Makefile ##" > $@
-	@echo "# Do not edit!" >> $@
-	@echo >> $@
-	@echo "# Preserve some key paths for use by main LLVM test suite config." >> $@
-	@echo "config.clang_obj_root = \"\"\"$(PROJ_OBJ_DIR)/..\"\"\"" >> $@
-	@echo >> $@
-	@echo "# Let the main config do the real work." >> $@
-	@echo "lit.load_config(config, \"\"\"$(PROJ_SRC_DIR)/lit.cfg\"\"\")" >> $@
+	@sed -e "s#@CLANG_SOURCE_DIR@#$(PROJ_SRC_DIR)/..#g" \
+	     -e "s#@CLANG_BINARY_DIR@#$(PROJ_OBJ_DIR)/..#g" \
+	     -e "s#@LLVM_TOOLS_DIR@#$(ToolDir)#g" \
+	     $(PROJ_SRC_DIR)/lit.site.cfg.in > $@
 
 clean::
 	@ rm -rf Output/

Modified: cfe/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg?rev=82160&r1=82159&r2=82160&view=diff

==============================================================================
--- cfe/trunk/test/lit.cfg (original)
+++ cfe/trunk/test/lit.cfg Thu Sep 17 14:55:53 2009
@@ -33,6 +33,17 @@
         config.llvm_obj_root = os.path.join(clang_obj_root,
                                             '..', '..')
 
+    # Tweak the PATH to include the tools dir and the scripts dir.
+    if clang_obj_root is not None:
+        llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)
+        if not llvm_tools_dir:
+            lit.fatal('No LLVM tools dir set!')
+        path = os.path.pathsep.join((llvm_tools_dir,
+                                     os.path.join(config.llvm_src_root,
+                                                  'test', 'Scripts'),
+                                     config.environment['PATH']))
+        config.environment['PATH'] = path
+
     ###
 
     # Check that the object root is known.

Modified: cfe/trunk/test/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.site.cfg.in?rev=82160&r1=82159&r2=82160&view=diff

==============================================================================
--- cfe/trunk/test/lit.site.cfg.in (original)
+++ cfe/trunk/test/lit.site.cfg.in Thu Sep 17 14:55:53 2009
@@ -1,6 +1,7 @@
-## Autogenerated by LLVM/Clang configuration. 
+## Autogenerated by LLVM/Clang configuration.
 # Do not edit!
 config.clang_obj_root = "@CLANG_BINARY_DIR@"
+config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
 
 # Let the main config do the real work.
 lit.load_config(config, "@CLANG_SOURCE_DIR@/test/lit.cfg")





More information about the cfe-commits mailing list