2010-12-07 08:41:23 +01:00
|
|
|
function(add_llvm_unittest test_dirname)
|
|
|
|
string(REGEX MATCH "([^/]+)$" test_name ${test_dirname})
|
2010-09-24 11:01:13 +02:00
|
|
|
if (CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
|
2010-12-07 08:41:23 +01:00
|
|
|
${LLVM_BINARY_DIR}/unittests/${test_dirname}/${CMAKE_BUILD_TYPE})
|
2010-09-24 11:01:13 +02:00
|
|
|
else()
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
|
2010-12-07 08:41:23 +01:00
|
|
|
${LLVM_BINARY_DIR}/unittests/${test_dirname})
|
2010-09-24 11:01:13 +02:00
|
|
|
endif()
|
|
|
|
if( NOT LLVM_BUILD_TESTS )
|
|
|
|
set(EXCLUDE_FROM_ALL ON)
|
|
|
|
endif()
|
2010-09-25 22:25:25 +02:00
|
|
|
add_llvm_executable(${test_name}Tests ${ARGN})
|
2010-10-28 16:38:35 +02:00
|
|
|
add_dependencies(UnitTests ${test_name}Tests)
|
2011-02-20 23:06:10 +01:00
|
|
|
set_target_properties(${test_name}Tests PROPERTIES FOLDER "Tests")
|
2010-09-24 11:01:13 +02:00
|
|
|
endfunction()
|
|
|
|
|
2010-10-28 16:38:35 +02:00
|
|
|
add_custom_target(UnitTests)
|
2011-02-20 23:06:10 +01:00
|
|
|
set_target_properties(UnitTests PROPERTIES FOLDER "Tests")
|
2010-10-28 16:38:35 +02:00
|
|
|
|
2010-09-24 11:01:13 +02:00
|
|
|
include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
|
2010-10-19 20:04:19 +02:00
|
|
|
add_definitions(-DGTEST_HAS_RTTI=0)
|
2011-05-11 15:53:08 +02:00
|
|
|
if( LLVM_COMPILER_IS_GCC_COMPATIBLE )
|
2011-01-13 16:31:45 +01:00
|
|
|
llvm_replace_compiler_option(CMAKE_CXX_FLAGS "-frtti" "-fno-rtti")
|
|
|
|
elseif( MSVC )
|
|
|
|
llvm_replace_compiler_option(CMAKE_CXX_FLAGS "/GR" "/GR-")
|
|
|
|
endif()
|
|
|
|
|
2010-11-24 20:20:05 +01:00
|
|
|
if (NOT LLVM_ENABLE_THREADS)
|
|
|
|
add_definitions(-DGTEST_HAS_PTHREAD=0)
|
|
|
|
endif()
|
2010-09-24 11:01:13 +02:00
|
|
|
|
2010-12-07 11:22:07 +01:00
|
|
|
if(SUPPORTS_NO_VARIADIC_MACROS_FLAG)
|
|
|
|
add_definitions("-Wno-variadic-macros")
|
|
|
|
endif()
|
|
|
|
|
2010-09-24 11:01:13 +02:00
|
|
|
set(LLVM_LINK_COMPONENTS
|
|
|
|
jit
|
|
|
|
interpreter
|
|
|
|
nativecodegen
|
|
|
|
BitWriter
|
|
|
|
BitReader
|
|
|
|
AsmParser
|
|
|
|
Core
|
|
|
|
Support
|
|
|
|
)
|
|
|
|
|
|
|
|
set(LLVM_USED_LIBS
|
|
|
|
gtest
|
|
|
|
gtest_main
|
2010-11-24 20:20:05 +01:00
|
|
|
LLVMSupport # gtest needs it for raw_ostream.
|
2010-09-24 11:01:13 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
add_llvm_unittest(ADT
|
|
|
|
ADT/APFloatTest.cpp
|
|
|
|
ADT/APIntTest.cpp
|
|
|
|
ADT/BitVectorTest.cpp
|
|
|
|
ADT/DAGDeltaAlgorithmTest.cpp
|
|
|
|
ADT/DeltaAlgorithmTest.cpp
|
|
|
|
ADT/DenseMapTest.cpp
|
|
|
|
ADT/DenseSetTest.cpp
|
2010-11-20 00:23:22 +01:00
|
|
|
ADT/FoldingSet.cpp
|
2012-02-18 22:00:49 +01:00
|
|
|
ADT/HashingTest.cpp
|
2010-09-24 11:01:13 +02:00
|
|
|
ADT/ilistTest.cpp
|
|
|
|
ADT/ImmutableSetTest.cpp
|
2010-12-21 01:04:46 +01:00
|
|
|
ADT/IntEqClassesTest.cpp
|
2010-11-19 05:47:19 +01:00
|
|
|
ADT/IntervalMapTest.cpp
|
2012-01-31 20:58:34 +01:00
|
|
|
ADT/IntrusiveRefCntPtrTest.cpp
|
2011-06-15 21:19:09 +02:00
|
|
|
ADT/PackedVectorTest.cpp
|
2010-09-24 11:01:13 +02:00
|
|
|
ADT/SmallBitVectorTest.cpp
|
|
|
|
ADT/SmallStringTest.cpp
|
|
|
|
ADT/SmallVectorTest.cpp
|
|
|
|
ADT/SparseBitVectorTest.cpp
|
2012-02-22 01:56:08 +01:00
|
|
|
ADT/SparseSetTest.cpp
|
2010-09-24 11:01:13 +02:00
|
|
|
ADT/StringMapTest.cpp
|
|
|
|
ADT/StringRefTest.cpp
|
|
|
|
ADT/TripleTest.cpp
|
|
|
|
ADT/TwineTest.cpp
|
2011-12-16 09:58:59 +01:00
|
|
|
ADT/VariadicFunctionTest.cpp
|
2010-09-27 18:40:43 +02:00
|
|
|
)
|
2010-09-24 11:01:13 +02:00
|
|
|
|
|
|
|
add_llvm_unittest(Analysis
|
|
|
|
Analysis/ScalarEvolutionTest.cpp
|
|
|
|
)
|
|
|
|
|
2012-03-15 07:49:31 +01:00
|
|
|
add_llvm_unittest(ExecutionEngine
|
|
|
|
ExecutionEngine/ExecutionEngineTest.cpp
|
|
|
|
)
|
|
|
|
|
2012-03-13 09:33:15 +01:00
|
|
|
if( LLVM_USE_INTEL_JITEVENTS )
|
|
|
|
include_directories( ${LLVM_INTEL_JITEVENTS_INCDIR} )
|
|
|
|
link_directories( ${LLVM_INTEL_JITEVENTS_LIBDIR} )
|
|
|
|
set(ProfileTestSources
|
2012-03-15 07:49:31 +01:00
|
|
|
ExecutionEngine/JIT/IntelJITEventListenerTest.cpp
|
2012-03-13 09:33:15 +01:00
|
|
|
)
|
|
|
|
set(LLVM_LINK_COMPONENTS
|
|
|
|
${LLVM_LINK_COMPONENTS}
|
|
|
|
IntelJITEvents
|
|
|
|
)
|
|
|
|
endif( LLVM_USE_INTEL_JITEVENTS )
|
|
|
|
|
|
|
|
if( LLVM_USE_OPROFILE )
|
|
|
|
set(ProfileTestSources
|
|
|
|
${ProfileTestSources}
|
2012-03-15 07:49:31 +01:00
|
|
|
ExecutionEngine/JIT/OProfileJITEventListenerTest.cpp
|
2012-03-13 09:33:15 +01:00
|
|
|
)
|
|
|
|
set(LLVM_LINK_COMPONENTS
|
|
|
|
${LLVM_LINK_COMPONENTS}
|
|
|
|
OProfileJIT
|
|
|
|
)
|
|
|
|
endif( LLVM_USE_OPROFILE )
|
|
|
|
|
2010-11-19 04:19:42 +01:00
|
|
|
set(JITTestsSources
|
2012-03-15 07:49:31 +01:00
|
|
|
ExecutionEngine/JIT/JITEventListenerTest.cpp
|
2010-09-24 11:01:13 +02:00
|
|
|
ExecutionEngine/JIT/JITMemoryManagerTest.cpp
|
|
|
|
ExecutionEngine/JIT/JITTest.cpp
|
|
|
|
ExecutionEngine/JIT/MultiJITTest.cpp
|
2012-03-15 07:49:31 +01:00
|
|
|
${ProfileTestSources}
|
2010-09-24 11:01:13 +02:00
|
|
|
)
|
|
|
|
|
2010-11-19 04:19:42 +01:00
|
|
|
if(MSVC)
|
|
|
|
list(APPEND JITTestsSources ExecutionEngine/JIT/JITTests.def)
|
|
|
|
endif()
|
|
|
|
|
2010-12-07 08:41:23 +01:00
|
|
|
add_llvm_unittest(ExecutionEngine/JIT ${JITTestsSources})
|
2010-11-19 04:19:42 +01:00
|
|
|
|
2011-12-16 07:21:08 +01:00
|
|
|
if(MINGW OR CYGWIN)
|
2010-11-26 10:32:02 +01:00
|
|
|
set_property(TARGET JITTests PROPERTY LINK_FLAGS -Wl,--export-all-symbols)
|
|
|
|
endif()
|
|
|
|
|
2010-12-07 08:41:23 +01:00
|
|
|
add_llvm_unittest(Transforms/Utils
|
2010-10-11 23:22:34 +02:00
|
|
|
Transforms/Utils/Cloning.cpp
|
|
|
|
)
|
|
|
|
|
2010-11-19 04:19:32 +01:00
|
|
|
set(VMCoreSources
|
2010-10-11 23:22:34 +02:00
|
|
|
VMCore/ConstantsTest.cpp
|
|
|
|
VMCore/InstructionsTest.cpp
|
|
|
|
VMCore/MetadataTest.cpp
|
|
|
|
VMCore/PassManagerTest.cpp
|
2010-11-14 13:37:51 +01:00
|
|
|
VMCore/ValueMapTest.cpp
|
2010-10-11 23:22:34 +02:00
|
|
|
VMCore/VerifierTest.cpp
|
2012-03-30 18:46:21 +02:00
|
|
|
VMCore/DominatorTreeTest.cpp
|
2010-10-11 23:22:34 +02:00
|
|
|
)
|
|
|
|
|
2010-11-19 04:19:32 +01:00
|
|
|
# MSVC9 and 8 cannot compile ValueMapTest.cpp due to their bug.
|
|
|
|
# See issue#331418 in Visual Studio.
|
|
|
|
if(MSVC AND MSVC_VERSION LESS 1600)
|
|
|
|
list(REMOVE_ITEM VMCoreSources VMCore/ValueMapTest.cpp)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_llvm_unittest(VMCore ${VMCoreSources})
|
|
|
|
|
2012-01-02 10:19:48 +01:00
|
|
|
add_llvm_unittest(Bitcode
|
|
|
|
Bitcode/BitReaderTest.cpp
|
|
|
|
)
|
|
|
|
|
2010-10-11 23:22:34 +02:00
|
|
|
set(LLVM_LINK_COMPONENTS
|
|
|
|
Support
|
|
|
|
Core
|
|
|
|
)
|
|
|
|
|
2010-09-24 11:01:13 +02:00
|
|
|
add_llvm_unittest(Support
|
|
|
|
Support/AllocatorTest.cpp
|
|
|
|
Support/Casting.cpp
|
|
|
|
Support/CommandLineTest.cpp
|
|
|
|
Support/ConstantRangeTest.cpp
|
2010-10-21 22:28:21 +02:00
|
|
|
Support/EndianTest.cpp
|
2010-09-24 11:01:13 +02:00
|
|
|
Support/LeakDetectorTest.cpp
|
|
|
|
Support/MathExtrasTest.cpp
|
2010-11-29 23:29:04 +01:00
|
|
|
Support/Path.cpp
|
2010-09-24 11:01:13 +02:00
|
|
|
Support/raw_ostream_test.cpp
|
|
|
|
Support/RegexTest.cpp
|
2010-10-11 23:56:16 +02:00
|
|
|
Support/SwapByteOrderTest.cpp
|
2010-11-29 23:29:04 +01:00
|
|
|
Support/TimeValue.cpp
|
2010-09-24 11:01:13 +02:00
|
|
|
Support/TypeBuilderTest.cpp
|
|
|
|
Support/ValueHandleTest.cpp
|
2012-04-04 01:09:22 +02:00
|
|
|
Support/YAMLParserTest.cpp
|
2010-09-24 11:01:13 +02:00
|
|
|
)
|