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

Daniel Dunbar daniel at zuster.org
Sat Nov 7 15:53:32 PST 2009


Author: ddunbar
Date: Sat Nov  7 17:53:32 2009
New Revision: 86421

URL: http://llvm.org/viewvc/llvm-project?rev=86421&view=rev
Log:
Rework site config for cmake to be generated at configure time, and only pass
the 'build_config' value in at runtime using the new lit runtime user parameter
feature.

This simplifies things and drops a dependency on 'sed', FWIW.

Modified:
    cfe/trunk/test/CMakeLists.txt
    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=86421&r1=86420&r2=86421&view=diff

==============================================================================
--- cfe/trunk/test/CMakeLists.txt (original)
+++ cfe/trunk/test/CMakeLists.txt Sat Nov  7 17:53:32 2009
@@ -22,11 +22,22 @@
   "SemaObjCXX"
   "SemaTemplate")
 
+get_target_property(LLVM_TOOLS_PATH clang RUNTIME_OUTPUT_DIRECTORY)
+get_target_property(LLVM_LIBS_PATH clang LIBRARY_OUTPUT_DIRECTORY)
+
+set(LLVM_SOURCE_DIR "${LLVM_MAIN_SRC_DIR}")
+set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}")
+set(LLVM_TOOLS_DIR "${LLVM_TOOLS_PATH}/%(build_config)s")
+set(LLVM_LIBS_DIR "${LLVM_LIBS_PATH}/%(build_config)s")
+set(CLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..")
+set(CLANG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
+
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
+
 include(FindPythonInterp)
 if(PYTHONINTERP_FOUND)
-  get_target_triple(TARGET_TRIPLE)
-  get_target_property(LLVM_TOOLS_PATH clang RUNTIME_OUTPUT_DIRECTORY)
-  get_target_property(LLVM_LIBS_PATH clang LIBRARY_OUTPUT_DIRECTORY)
   set(CLANG_TEST_EXTRA_ARGS)
   if (MSVC OR XCODE)
     set(CLANG_TEST_EXTRA_ARGS "--no-progress-bar")
@@ -34,18 +45,10 @@
 
   foreach(testdir ${CLANG_TEST_DIRECTORIES})
     add_custom_target(clang-test-${testdir}
-      COMMAND sed -e "s#\@LLVM_SOURCE_DIR\@#${LLVM_MAIN_SRC_DIR}#"
-                  -e "s#\@LLVM_BINARY_DIR\@#${LLVM_BINARY_DIR}#"
-                  -e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}#"
-                  -e "s#\@LLVM_LIBS_DIR\@#${LLVM_LIBS_PATH}/${CMAKE_CFG_INTDIR}#"
-                  -e "s#\@CLANG_SOURCE_DIR\@#${CMAKE_CURRENT_SOURCE_DIR}/..#"
-                  -e "s#\@CLANG_BINARY_DIR\@#${CMAKE_CURRENT_BINARY_DIR}/..#"
-                  -e "s#\@TARGET_TRIPLE\@#${TARGET_TRIPLE}#"
-                  ${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
                   --param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+                  --param build_config=${CMAKE_CFG_INTDIR}
                   -sv ${CLANG_TEST_EXTRA_ARGS}
                   ${CMAKE_CURRENT_BINARY_DIR}/${testdir}
                   DEPENDS clang clang-cc index-test c-index-test
@@ -53,36 +56,20 @@
   endforeach()
 
   add_custom_target(clang-test
-    COMMAND sed -e "s#\@LLVM_SOURCE_DIR\@#${LLVM_MAIN_SRC_DIR}#"
-                -e "s#\@LLVM_BINARY_DIR\@#${LLVM_BINARY_DIR}#"
-                -e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}#"
-                -e "s#\@LLVM_LIBS_DIR\@#${LLVM_LIBS_PATH}/${CMAKE_CFG_INTDIR}#"
-                -e "s#\@CLANG_SOURCE_DIR\@#${CMAKE_CURRENT_SOURCE_DIR}/..#"
-                -e "s#\@CLANG_BINARY_DIR\@#${CMAKE_CURRENT_BINARY_DIR}/..#"
-                -e "s#\@TARGET_TRIPLE\@#${TARGET_TRIPLE}#"
-                ${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
                 --param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+                --param build_config=${CMAKE_CFG_INTDIR}
                 -sv ${CLANG_TEST_EXTRA_ARGS}
                 ${CMAKE_CURRENT_BINARY_DIR}
                 DEPENDS clang clang-cc index-test c-index-test
                 COMMENT "Running Clang regression tests")
 
   add_custom_target(clang-c++tests
-    COMMAND sed -e "s#\@LLVM_SOURCE_DIR\@#${LLVM_MAIN_SRC_DIR}#"
-                -e "s#\@LLVM_BINARY_DIR\@#${LLVM_BINARY_DIR}#"
-                -e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}#"
-                -e "s#\@LLVM_LIBS_DIR\@#${LLVM_LIBS_PATH}/${CMAKE_CFG_INTDIR}#"
-                -e "s#\@CLANG_SOURCE_DIR\@#${CMAKE_CURRENT_SOURCE_DIR}/..#"
-                -e "s#\@CLANG_BINARY_DIR\@#${CMAKE_CURRENT_BINARY_DIR}/..#"
-                -e "s#\@TARGET_TRIPLE\@#${TARGET_TRIPLE}#"
-                ${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
                 --param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+                --param build_config=${CMAKE_CFG_INTDIR}
                 -sv ${CLANG_TEST_EXTRA_ARGS}
                 ${CMAKE_CURRENT_SOURCE_DIR}/../utils/C++Tests
                 DEPENDS clang clang-cc index-test c-index-test

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

==============================================================================
--- cfe/trunk/test/lit.site.cfg.in (original)
+++ cfe/trunk/test/lit.site.cfg.in Sat Nov  7 17:53:32 2009
@@ -7,5 +7,14 @@
 config.clang_obj_root = "@CLANG_BINARY_DIR@"
 config.target_triple = "@TARGET_TRIPLE@"
 
+# 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:
+    config.llvm_tools_dir = config.llvm_tools_dir % lit.params
+    config.llvm_libs_dir = config.llvm_libs_dir % lit.params
+except KeyError,e:
+    key, = e.args
+    lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
+
 # 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