Test: Fix LLVMC tests on CMake.

The CMake build didn't define TEST_COMPILE_CXX_CMD. The tests assumed gcc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112480 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Michael J. Spencer 2010-08-30 14:49:00 +00:00
parent 033927408e
commit 06b7f58522
21 changed files with 45 additions and 20 deletions

View File

@ -24,6 +24,23 @@ endif()
include(FindPythonInterp)
if(PYTHONINTERP_FOUND)
get_directory_property(DEFINITIONS COMPILE_DEFINITIONS)
foreach(DEF ${DEFINITIONS})
set(DEFS "${DEFS} -D${DEF}")
endforeach()
get_directory_property(INC_DIRS INCLUDE_DIRECTORIES)
foreach(INC_DIR ${INC_DIRS})
set(IDIRS "${IDIRS} -I${INC_DIR}")
endforeach()
string(REPLACE "<CMAKE_CXX_COMPILER>" "${CMAKE_CXX_COMPILER}" TEST_COMPILE_CXX_CMD ${CMAKE_CXX_COMPILE_OBJECT})
string(REPLACE "<DEFINES>" "${DEFS}" TEST_COMPILE_CXX_CMD ${TEST_COMPILE_CXX_CMD})
string(REPLACE "<FLAGS>" "${CMAKE_CXX_FLAGS}" TEST_COMPILE_CXX_CMD ${TEST_COMPILE_CXX_CMD})
string(REPLACE "-o" "" TEST_COMPILE_CXX_CMD ${TEST_COMPILE_CXX_CMD})
string(REGEX REPLACE "<[^>]+>" "" TEST_COMPILE_CXX_CMD ${TEST_COMPILE_CXX_CMD})
set(TEST_COMPILE_CXX_CMD "${TEST_COMPILE_CXX_CMD} ${IDIRS}")
if(NOT MSVC)
set(TEST_COMPILE_CXX_CMD "${TEST_COMPILE_CXX_CMD} -x c++")
endif()
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/site.exp.in
${CMAKE_CURRENT_BINARY_DIR}/site.exp)

View File

@ -1,7 +1,7 @@
// Test alias generation.
// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
// RUN: FileCheck -input-file %t %s
// RUN: %compile_cxx -x c++ %t
// RUN: %compile_cxx %t
// XFAIL: vg_leak
include "llvm/CompilerDriver/Common.td"

View File

@ -1,7 +1,7 @@
// Check that hooks can be invoked from 'append_cmd'.
// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
// RUN: FileCheck -input-file %t %s
// RUN: %compile_cxx -x c++ %t
// RUN: %compile_cxx %t
// XFAIL: vg_leak
include "llvm/CompilerDriver/Common.td"

View File

@ -1,6 +1,6 @@
// Check that the compilation graph can be empty.
// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
// RUN: %compile_cxx -x c++ %t
// RUN: %compile_cxx %t
// XFAIL: vg_leak
include "llvm/CompilerDriver/Common.td"

View File

@ -2,7 +2,7 @@
// http://llvm.org/bugs/show_bug.cgi?id=4157
// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
// RUN: not grep {FOO")));} %t
// RUN: %compile_cxx -x c++ %t
// RUN: %compile_cxx %t
// XFAIL: vg_leak
include "llvm/CompilerDriver/Common.td"

View File

@ -2,7 +2,7 @@
// http://llvm.org/bugs/show_bug.cgi?id=4159
// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
// RUN: FileCheck -input-file %t %s
// RUN: %compile_cxx -x c++ %t
// RUN: %compile_cxx %t
// XFAIL: vg_leak
include "llvm/CompilerDriver/Common.td"

View File

@ -2,7 +2,7 @@
// The dummy tool and graph are required to silence warnings.
// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
// RUN: FileCheck -input-file %t %s
// RUN: %compile_cxx -x c++ %t
// RUN: %compile_cxx %t
// XFAIL: vg_leak
include "llvm/CompilerDriver/Common.td"

View File

@ -2,7 +2,7 @@
// The dummy tool and graph are required to silence warnings.
// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
// RUN: FileCheck -input-file %t %s
// RUN: %compile_cxx -x c++ %t
// RUN: %compile_cxx %t
// XFAIL: vg_leak
include "llvm/CompilerDriver/Common.td"

View File

@ -1,7 +1,7 @@
// Check that hooks with arguments work.
// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
// RUN: FileCheck -input-file %t %s
// RUN: %compile_cxx -x c++ %t
// RUN: %compile_cxx %t
// XFAIL: vg_leak
include "llvm/CompilerDriver/Common.td"

View File

@ -1,7 +1,7 @@
// Check that a hook can be given $INFILE as an argument.
// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
// RUN: FileCheck -input-file %t %s
// RUN: %compile_cxx -x c++ %t
// RUN: %compile_cxx %t
// XFAIL: vg_leak
include "llvm/CompilerDriver/Common.td"

View File

@ -1,7 +1,7 @@
// Check that (init true/false) and (init "str") work.
// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
// RUN: FileCheck -input-file %t %s
// RUN: %compile_cxx -x c++ %t
// RUN: %compile_cxx %t
// XFAIL: vg_leak
include "llvm/CompilerDriver/Common.td"

View File

@ -1,7 +1,7 @@
// Check that LanguageMap is processed properly.
// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
// RUN: FileCheck -input-file %t %s
// RUN: %compile_cxx -x c++ %t
// RUN: %compile_cxx %t
// XFAIL: vg_leak
include "llvm/CompilerDriver/Common.td"

View File

@ -2,7 +2,7 @@
// The dummy tool and graph are required to silence warnings.
// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
// RUN: FileCheck -input-file %t %s
// RUN: %compile_cxx -x c++ %t
// RUN: %compile_cxx %t
// XFAIL: vg_leak
include "llvm/CompilerDriver/Common.td"

View File

@ -1,6 +1,6 @@
// Check that multiple compilation graphs are allowed.
// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
// RUN: %compile_cxx -x c++ %t
// RUN: %compile_cxx %t
// XFAIL: vg_leak
include "llvm/CompilerDriver/Common.td"

View File

@ -1,7 +1,7 @@
// Check that tools without associated actions are accepted.
// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
// RUN: FileCheck -input-file %t %s
// RUN: %compile_cxx -x c++ %t
// RUN: %compile_cxx %t
// XFAIL: vg_leak
include "llvm/CompilerDriver/Common.td"

View File

@ -1,6 +1,6 @@
// Check that the compilation graph is not required.
// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
// RUN: %compile_cxx -x c++ %t
// RUN: %compile_cxx %t
// XFAIL: vg_leak
include "llvm/CompilerDriver/Common.td"

View File

@ -2,7 +2,7 @@
// The dummy tool and graph are required to silence warnings.
// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
// RUN: FileCheck -input-file %t %s
// RUN: %compile_cxx -x c++ %t
// RUN: %compile_cxx %t
// XFAIL: vg_leak
include "llvm/CompilerDriver/Common.td"

View File

@ -1,7 +1,7 @@
// Test for the OptionPreprocessor and related functionality.
// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
// RUN: FileCheck -input-file %t %s
// RUN: %compile_cxx -x c++ %t
// RUN: %compile_cxx %t
// XFAIL: vg_leak
include "llvm/CompilerDriver/Common.td"

View File

@ -1,7 +1,7 @@
// Check that hooks can be invoked from 'output_suffix'.
// RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
// RUN: FileCheck -input-file %t %s
// RUN: %compile_cxx -x c++ %t
// RUN: %compile_cxx %t
// XFAIL: vg_leak
include "llvm/CompilerDriver/Common.td"

View File

@ -145,8 +145,8 @@ site.exp: FORCE
@echo 'set objdir "$(LLVM_OBJ_ROOT)/test"' >>site.tmp
@echo 'set gccpath "$(CC)"' >>site.tmp
@echo 'set gxxpath "$(CXX)"' >>site.tmp
@echo 'set compile_c "' $(CC) $(CPP.Flags) $(TargetCommonOpts) $(CompileCommonOpts) -c '"' >>site.tmp
@echo 'set compile_cxx "' $(CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) $(CompileCommonOpts) -c '"' >> site.tmp
@echo 'set compile_c "' $(CC) $(CPP.Flags) $(TargetCommonOpts) $(CompileCommonOpts) -c -x c '"' >>site.tmp
@echo 'set compile_cxx "' $(CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) $(CompileCommonOpts) -c -x c++ '"' >> site.tmp
@echo 'set link "' $(CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) '"' >>site.tmp
@echo 'set llvmgcc "$(LLVMGCC) $(TargetCommonOpts) $(EXTRA_OPTIONS)"' >> site.tmp
@echo 'set llvmgxx "$(LLVMGCC) $(TargetCommonOpts) $(EXTRA_OPTIONS)"' >> site.tmp

View File

@ -49,6 +49,14 @@ if llvm_obj_root is not None:
if 'HOME' in os.environ:
config.environment['HOME'] = os.environ['HOME']
# Propogate 'INCLUDE' through the environment.
if 'INCLUDE' in os.environ:
config.environment['INCLUDE'] = os.environ['INCLUDE']
# Propogate 'LIB' through the environment.
if 'LIB' in os.environ:
config.environment['LIB'] = os.environ['LIB']
# Propogate LLVM_SRC_ROOT into the environment.
config.environment['LLVM_SRC_ROOT'] = getattr(config, 'llvm_src_root', '')