Switch to using 'lit.site.cfg.in' for the site config template for Unit tests,
authorDaniel Dunbar <daniel@zuster.org>
Sun, 8 Nov 2009 09:07:51 +0000 (09:07 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sun, 8 Nov 2009 09:07:51 +0000 (09:07 +0000)
and generate it for CMake builds as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86451 91177308-0d34-0410-b5e6-96231b3b80d8

test/CMakeLists.txt
test/Makefile
test/Unit/lit.cfg
test/Unit/lit.site.cfg.in [new file with mode: 0644]

index 9f37037e02f5a9b1d82c2cc08248d6de9313ff0d..681e50d0a87f58db8a5c755f5728b7bd18fe1bad 100644 (file)
@@ -18,6 +18,13 @@ if(PYTHONINTERP_FOUND)
                 -e "s#\@LLVMGCC_DIR\@##"
                 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in >
                 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+    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#\@LLVMGCC_DIR\@##"
+                -e "s#\@LLVM_BUILD_MODE\@#${CMAKE_CFG_INTDIR}#"
+                ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in >
+                ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
     COMMAND ${PYTHON_EXECUTABLE} 
                 ${LLVM_SOURCE_DIR}/utils/lit/lit.py
                 -sv
index ede1b443174f69d6f671e5d324247a953cc130d1..e3e66d53ef494753a6f3cb79eea81f70d649be0f 100644 (file)
@@ -202,15 +202,9 @@ lit.site.cfg: site.exp
 
 Unit/lit.site.cfg: $(PROJ_OBJ_DIR)/Unit/.dir FORCE
        @echo "Making LLVM unittest '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.llvm_obj_root = \"\"\"$(LLVM_OBJ_ROOT)\"\"\"" >> $@
-       @echo >> $@
-       @echo "# Remember the build mode." >> $@
-       @echo "config.llvm_build_mode = \"\"\"$(BuildMode)\"\"\"" >> $@
-       @echo >> $@
-       @echo "# Let the main config do the real work." >> $@
-       @echo "lit.load_config(config, \"\"\"$(LLVM_SRC_ROOT)/test/Unit/lit.cfg\"\"\")" >> $@
-
+       @sed -e "s#@LLVM_SOURCE_DIR@#$(LLVM_SRC_ROOT)#g" \
+            -e "s#@LLVM_BINARY_DIR@#$(LLVM_OBJ_ROOT)#g" \
+            -e "s#@LLVM_TOOLS_DIR@#$(ToolDir)#g" \
+            -e "s#@LLVMGCCDIR@#$(LLVMGCCDIR)#g" \
+            -e "s#@LLVM_BUILD_MODE@#$(BuildMode)#g" \
+            $(PROJ_SRC_DIR)/Unit/lit.site.cfg.in > $@
index 6fd39988aea4d8e991eb1b0238e4d8553812e9ba..8321593cf715c76faa6761545bcb0db9b1b05c65 100644 (file)
@@ -7,8 +7,7 @@ import os
 # name: The name of this test suite.
 config.name = 'LLVM-Unit'
 
-# suffixes: A list of file extensions to treat as test files, this is actually
-# set by on_clone().
+# suffixes: A list of file extensions to treat as test files.
 config.suffixes = []
 
 # test_source_root: The root path where tests are located.
diff --git a/test/Unit/lit.site.cfg.in b/test/Unit/lit.site.cfg.in
new file mode 100644 (file)
index 0000000..c190ffa
--- /dev/null
@@ -0,0 +1,10 @@
+## Autogenerated by LLVM/Clang configuration.
+# Do not edit!
+config.llvm_src_root = "@LLVM_SOURCE_DIR@"
+config.llvm_obj_root = "@LLVM_BINARY_DIR@"
+config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
+config.llvmgcc_dir = "@LLVMGCCDIR@"
+config.llvm_build_mode = "@LLVM_BUILD_MODE@"
+
+# Let the main config do the real work.
+lit.load_config(config, "@LLVM_SOURCE_DIR@/test/Unit/lit.cfg")