From a173d9b874413def2ec2c06332032591617c315d Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sun, 20 Sep 2009 19:04:35 +0000 Subject: [PATCH] Include LLVM {src,obj} root in lit.site.cfg, to support non-standard layouts. llvm-svn: 82401 --- clang/test/CMakeLists.txt | 12 ++++++++---- clang/test/Makefile | 8 +++++--- clang/test/lit.cfg | 7 ++----- clang/test/lit.site.cfg.in | 4 +++- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt index 1c9567f8bd61..cb2b80a16099 100644 --- a/clang/test/CMakeLists.txt +++ b/clang/test/CMakeLists.txt @@ -32,9 +32,11 @@ if(PYTHONINTERP_FOUND) 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}/..#" + 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#\@CLANG_SOURCE_DIR\@#${CMAKE_CURRENT_SOURCE_DIR}/..#" + -e "s#\@CLANG_BINARY_DIR\@#${CMAKE_CURRENT_BINARY_DIR}/..#" ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in > ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg COMMAND ${PYTHON_EXECUTABLE} @@ -46,9 +48,11 @@ if(PYTHONINTERP_FOUND) endforeach() add_custom_target(clang-test - COMMAND sed -e "s#\@CLANG_SOURCE_DIR\@#${CMAKE_CURRENT_SOURCE_DIR}/..#" - -e "s#\@CLANG_BINARY_DIR\@#${CMAKE_CURRENT_BINARY_DIR}/..#" + 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#\@CLANG_SOURCE_DIR\@#${CMAKE_CURRENT_SOURCE_DIR}/..#" + -e "s#\@CLANG_BINARY_DIR\@#${CMAKE_CURRENT_BINARY_DIR}/..#" ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in > ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg COMMAND ${PYTHON_EXECUTABLE} diff --git a/clang/test/Makefile b/clang/test/Makefile index 223fd8380b9f..88cc955f38a3 100644 --- a/clang/test/Makefile +++ b/clang/test/Makefile @@ -43,10 +43,12 @@ endif FORCE: lit.site.cfg: FORCE - @echo "Making 'lit.site.cfg' file..." - @sed -e "s#@CLANG_SOURCE_DIR@#$(PROJ_SRC_DIR)/..#g" \ - -e "s#@CLANG_BINARY_DIR@#$(PROJ_OBJ_DIR)/..#g" \ + @echo "Making Clang 'lit.site.cfg' file..." + @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#@CLANG_SOURCE_DIR@#$(PROJ_SRC_DIR)/..#g" \ + -e "s#@CLANG_BINARY_DIR@#$(PROJ_OBJ_DIR)/..#g" \ $(PROJ_SRC_DIR)/lit.site.cfg.in > $@ clean:: diff --git a/clang/test/lit.cfg b/clang/test/lit.cfg index bca4d5190a8b..0a99aa4ee9dd 100644 --- a/clang/test/lit.cfg +++ b/clang/test/lit.cfg @@ -27,11 +27,8 @@ def config_new(): config.test_exec_root = os.path.join(clang_obj_root, 'test') # Set llvm_{src,obj}_root for use by others. - config.llvm_src_root = os.path.join(config.test_source_root, - '..', '..', '..') - if clang_obj_root is not None: - config.llvm_obj_root = os.path.join(clang_obj_root, - '..', '..') + config.llvm_src_root = getattr(config, 'llvm_src_root', None) + config.llvm_obj_root = getattr(config, 'llvm_obj_root', None) # Tweak the PATH to include the tools dir and the scripts dir. if clang_obj_root is not None: diff --git a/clang/test/lit.site.cfg.in b/clang/test/lit.site.cfg.in index e91fbed59053..eab8793517c2 100644 --- a/clang/test/lit.site.cfg.in +++ b/clang/test/lit.site.cfg.in @@ -1,7 +1,9 @@ ## Autogenerated by LLVM/Clang configuration. # Do not edit! -config.clang_obj_root = "@CLANG_BINARY_DIR@" +config.llvm_src_root = "@LLVM_SOURCE_DIR@" +config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" +config.clang_obj_root = "@CLANG_BINARY_DIR@" # Let the main config do the real work. lit.load_config(config, "@CLANG_SOURCE_DIR@/test/lit.cfg")