Test: Fix LLVMC tests on CMake.
authorMichael J. Spencer <bigcheesegs@gmail.com>
Mon, 30 Aug 2010 14:49:00 +0000 (14:49 +0000)
committerMichael J. Spencer <bigcheesegs@gmail.com>
Mon, 30 Aug 2010 14:49:00 +0000 (14:49 +0000)
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

21 files changed:
test/CMakeLists.txt
test/LLVMC/Alias.td
test/LLVMC/AppendCmdHook.td
test/LLVMC/EmptyCompilationGraph.td
test/LLVMC/EnvParentheses.td
test/LLVMC/ForwardAs.td
test/LLVMC/ForwardTransformedValue.td
test/LLVMC/ForwardValue.td
test/LLVMC/HookWithArguments.td
test/LLVMC/HookWithInFile.td
test/LLVMC/Init.td
test/LLVMC/LanguageMap.td
test/LLVMC/MultiValuedOption.td
test/LLVMC/MultipleCompilationGraphs.td
test/LLVMC/NoActions.td
test/LLVMC/NoCompilationGraph.td
test/LLVMC/OneOrMore.td
test/LLVMC/OptionPreprocessor.td
test/LLVMC/OutputSuffixHook.td
test/Makefile
test/lit.cfg

index 433af900dd2b4bc4ab5b64fc9dbfed7153b53fcc..ad9a2432dbfa89fbd8bc6e27f971a6c5f52bffcc 100644 (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)
index 88e142dae27fbcb441e13c1bae4328768481bc96..5d37889304bdcd8c1622c0f24dda82ea083ce784 100644 (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"
index 690ece779df68aea7274cdb9e6c7da5dcd295ea8..c85f002e6e8b4c7de1d08bebc6efd2da72870f59 100644 (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"
index 3d2210a0fff5ecb3359a16ff1459acc66dcb464f..a52b8a8c19905526875a57d587f2fbb6abc63228 100644 (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"
index 403beb9521f1bad47ef29f9b40b0ae017ffca0af..ce0cb824604ce746181f823f80dc5521af9b8f61 100644 (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"
index 326e94b0e864affa8511aacef094c03d385922b7..99b240e30fb3e25764f47d4c0ad98d2a76929256 100644 (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"
index 10038f68d3e80274a604325ad5cabcad9c13845f..9184ede3610186cf8c9558c49a67932e398dacc7 100644 (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"
index 402fa50f7a2cc7f1ea3957c3a54d59c3823bf35f..a42a3f06ec3d7d235e9ed9dca487659ef19a9f23 100644 (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"
index b3260a973b830556c4424299c827324808bb3c7f..bbba2e98459995431163a1034f41153ffb466147 100644 (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"
index cc5da43b66330a1b1102d45c4e3779607fde7f63..ed08b5321ccfb354deee13a9eaa7e0470d6ea5fb 100644 (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"
index 8ab07d880b406de4848645807cddc40089834ba2..c3846797026e4c2bc961416e9e9df747927b62a5 100644 (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"
index aa1149ca7f0f41b97908009fc8ded61b4a577416..a0502142e6d72f80a5be0bdc5ab9147cdcbe2e5a 100644 (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"
index b6da6ce4c1d8f790eee34dbefcacc5bd6fde698e..08c753380d47578bce2c806e3616ff57036205c2 100644 (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"
index 0eaad872a71c8af369289ea10451d6d24eacd114..b3746c03b6cb5c965aa078ef0c9a1ecb6dfd4601 100644 (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"
index 2573fbe2f2c2ffc18c977a3a3d5ac1659fe721a4..34b444066350c12feaca6e75f3e1848092d20132 100644 (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"
index 1208f2c5f076a53313ec129654abe24ec16248f4..4182882c451f8b260d8df2ea87cda495e64bae74 100644 (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"
index bb0ad8b11b195fd183c779b604a68e9259e24b2b..54fa62d1ff041c88bf117dd28ad67ba27dca2edb 100644 (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"
index 556530b8f76e0fc447bcc33f434efcc1b9285123..8019c42634f30a865d8677e0438b5416b7432765 100644 (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"
index 6bb2866c38b5539dbe73418e635211c542f5182a..1f5ecd1237f3d45f605fc54910635cc516f11912 100644 (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"
index 1e179da008acfa6052514a19ef0c0b07f96423db..5bec0eb7ad55728158f91c18d03c7ab2db0b3973 100644 (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
index 28f336ba20c556cd7d3eb6e63235a6733a322e40..f15777c99912e1e19cea4ca909e79e0f2c3f3bef 100644 (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', '')