From a177492108c404f297536da8c27a75a3c87635d7 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 22 Sep 2009 07:38:44 +0000 Subject: [PATCH] Initial support for running LLVM tests from cmake. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82534 91177308-0d34-0410-b5e6-96231b3b80d8 --- CMakeLists.txt | 1 + test/CMakeLists.txt | 31 +++++++++++++++++++++++++++++++ test/site.exp.in | 27 +++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 test/CMakeLists.txt create mode 100644 test/site.exp.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 684d3d0da2d..362a395e2ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -259,6 +259,7 @@ add_subdirectory(lib/Linker) add_subdirectory(lib/Analysis) add_subdirectory(lib/Analysis/IPA) add_subdirectory(lib/MC) +add_subdirectory(test) add_subdirectory(utils/FileCheck) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 00000000000..627b57d8563 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,31 @@ +include(GetTargetTriple) +get_target_triple(target) + +foreach(c ${LLVM_TARGETS_TO_BUILD}) + set(TARGETS_BUILT "${TARGETS_BUILT} ${c}") +endforeach(c) +set(TARGETS_TO_BUILD ${TARGETS_BUILT}) + +include(FindPythonInterp) +if(PYTHONINTERP_FOUND) + get_target_property(LLVM_TOOLS_PATH llvm-config RUNTIME_OUTPUT_DIRECTORY) + + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/site.exp.in + ${CMAKE_CURRENT_BINARY_DIR}/site.exp) + + add_custom_target(llvm-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#\@LLVMGCC_DIR\@##" + ${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 + -sv + ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS + COMMENT "Running LLVM regression tests") + +endif() diff --git a/test/site.exp.in b/test/site.exp.in new file mode 100644 index 00000000000..6a74ba81e7f --- /dev/null +++ b/test/site.exp.in @@ -0,0 +1,27 @@ +## Autogenerated by LLVM/Clang configuration. +# Do not edit! +set target_triplet "@target@" +set TARGETS_TO_BUILD "@TARGETS_TO_BUILD@" +set llvmgcc_langs "@LLVMGCC_LANGS@" +set llvmgcc_version "@LLVMGCC_VERSION@" +set llvmlibsdir "@LLVM_LIBS_DIR@" +set llvm_bindings "@LLVM_BINDINGS@" +set srcroot "@LLVM_SOURCE_DIR@" +set objroot "@LLVM_BINARY_DIR@" +set srcdir "@LLVM_SOURCE_DIR@" +set objdir "@LLVM_BINARY_DIR@" +set gccpath "@GCCPATH@" +set gxxpath "@GXXPATH@" +set compile_c "@TEST_COMPILE_C_CMD@" +set compile_cxx "@TEST_COMPILE_CXX_CMD@" +set link "@TEST_LINK_CMD@" +set llvmgcc "@LLVMGCC@" +set llvmgxx "@LLVMGXX@" +set llvmgccmajvers "@LLVMGCCMAJVERS@" +set bugpoint_topts "@BUGPOINT_TOPTS@" +set shlibext "@SHLIBEXT@" +set ocamlopt "@OCAMLOPT@" +set valgrind "@VALGRIND@" +set grep "@GREP@" +set gas "@AS@" +set llvmdsymutil "@DSYMUTIL@"