2010-09-24 09:01:13 +00:00
|
|
|
function(add_llvm_unittest test_name)
|
|
|
|
if (CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
|
|
|
|
${LLVM_BINARY_DIR}/unittests/${test_name}/${CMAKE_BUILD_TYPE})
|
|
|
|
else()
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
|
|
|
|
${LLVM_BINARY_DIR}/unittests/${test_name})
|
|
|
|
endif()
|
|
|
|
if( NOT LLVM_BUILD_TESTS )
|
|
|
|
set(EXCLUDE_FROM_ALL ON)
|
|
|
|
endif()
|
2010-09-25 20:25:25 +00:00
|
|
|
add_llvm_executable(${test_name}Tests ${ARGN})
|
2010-10-28 14:38:35 +00:00
|
|
|
add_dependencies(UnitTests ${test_name}Tests)
|
2010-09-24 09:01:13 +00:00
|
|
|
endfunction()
|
|
|
|
|
2010-10-28 14:38:35 +00:00
|
|
|
add_custom_target(UnitTests)
|
|
|
|
|
2010-09-24 09:01:13 +00:00
|
|
|
include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
|
2010-10-19 18:04:19 +00:00
|
|
|
add_definitions(-DGTEST_HAS_RTTI=0)
|
2010-11-24 19:20:05 +00:00
|
|
|
if (NOT LLVM_ENABLE_THREADS)
|
|
|
|
add_definitions(-DGTEST_HAS_PTHREAD=0)
|
|
|
|
endif()
|
2010-09-24 09:01:13 +00:00
|
|
|
|
|
|
|
set(LLVM_LINK_COMPONENTS
|
|
|
|
jit
|
|
|
|
interpreter
|
|
|
|
nativecodegen
|
|
|
|
BitWriter
|
|
|
|
BitReader
|
|
|
|
AsmParser
|
|
|
|
Core
|
|
|
|
Support
|
|
|
|
)
|
|
|
|
|
|
|
|
set(LLVM_USED_LIBS
|
|
|
|
gtest
|
|
|
|
gtest_main
|
2010-11-24 19:20:05 +00:00
|
|
|
LLVMSupport # gtest needs it for raw_ostream.
|
2010-09-24 09:01:13 +00: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-19 23:23:22 +00:00
|
|
|
ADT/FoldingSet.cpp
|
2010-09-24 09:01:13 +00:00
|
|
|
ADT/ilistTest.cpp
|
|
|
|
ADT/ImmutableSetTest.cpp
|
2010-11-19 04:47:19 +00:00
|
|
|
ADT/IntervalMapTest.cpp
|
2010-09-24 09:01:13 +00:00
|
|
|
ADT/SmallBitVectorTest.cpp
|
|
|
|
ADT/SmallStringTest.cpp
|
|
|
|
ADT/SmallVectorTest.cpp
|
|
|
|
ADT/SparseBitVectorTest.cpp
|
|
|
|
ADT/StringMapTest.cpp
|
|
|
|
ADT/StringRefTest.cpp
|
|
|
|
ADT/TripleTest.cpp
|
|
|
|
ADT/TwineTest.cpp
|
2010-09-27 16:40:43 +00:00
|
|
|
)
|
2010-09-24 09:01:13 +00:00
|
|
|
|
|
|
|
add_llvm_unittest(Analysis
|
|
|
|
Analysis/ScalarEvolutionTest.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
add_llvm_unittest(ExecutionEngine
|
|
|
|
ExecutionEngine/ExecutionEngineTest.cpp
|
|
|
|
)
|
|
|
|
|
2010-11-19 03:19:42 +00:00
|
|
|
set(JITTestsSources
|
2010-09-24 09:01:13 +00:00
|
|
|
ExecutionEngine/JIT/JITEventListenerTest.cpp
|
|
|
|
ExecutionEngine/JIT/JITMemoryManagerTest.cpp
|
|
|
|
ExecutionEngine/JIT/JITTest.cpp
|
|
|
|
ExecutionEngine/JIT/MultiJITTest.cpp
|
|
|
|
)
|
|
|
|
|
2010-11-19 03:19:42 +00:00
|
|
|
if(MSVC)
|
|
|
|
list(APPEND JITTestsSources ExecutionEngine/JIT/JITTests.def)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_llvm_unittest(JIT ${JITTestsSources})
|
|
|
|
|
2010-11-26 09:32:02 +00:00
|
|
|
if(MINGW)
|
|
|
|
set_property(TARGET JITTests PROPERTY LINK_FLAGS -Wl,--export-all-symbols)
|
|
|
|
endif()
|
|
|
|
|
2010-10-11 21:22:34 +00:00
|
|
|
add_llvm_unittest(Transforms
|
|
|
|
Transforms/Utils/Cloning.cpp
|
|
|
|
)
|
|
|
|
|
2010-11-19 03:19:32 +00:00
|
|
|
set(VMCoreSources
|
2010-10-11 21:22:34 +00:00
|
|
|
VMCore/ConstantsTest.cpp
|
|
|
|
VMCore/DerivedTypesTest.cpp
|
|
|
|
VMCore/InstructionsTest.cpp
|
|
|
|
VMCore/MetadataTest.cpp
|
|
|
|
VMCore/PassManagerTest.cpp
|
2010-11-14 12:37:51 +00:00
|
|
|
VMCore/ValueMapTest.cpp
|
2010-10-11 21:22:34 +00:00
|
|
|
VMCore/VerifierTest.cpp
|
|
|
|
)
|
|
|
|
|
2010-11-19 03:19:32 +00: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})
|
|
|
|
|
2010-10-11 21:22:34 +00:00
|
|
|
set(LLVM_LINK_COMPONENTS
|
|
|
|
Support
|
|
|
|
Core
|
|
|
|
)
|
|
|
|
|
2010-09-24 09:01:13 +00:00
|
|
|
add_llvm_unittest(Support
|
|
|
|
Support/AllocatorTest.cpp
|
|
|
|
Support/Casting.cpp
|
|
|
|
Support/CommandLineTest.cpp
|
|
|
|
Support/ConstantRangeTest.cpp
|
2010-10-21 20:28:21 +00:00
|
|
|
Support/EndianTest.cpp
|
2010-09-24 09:01:13 +00:00
|
|
|
Support/LeakDetectorTest.cpp
|
|
|
|
Support/MathExtrasTest.cpp
|
2010-11-29 22:29:04 +00:00
|
|
|
Support/Path.cpp
|
2010-09-24 09:01:13 +00:00
|
|
|
Support/raw_ostream_test.cpp
|
|
|
|
Support/RegexTest.cpp
|
2010-10-11 21:56:16 +00:00
|
|
|
Support/SwapByteOrderTest.cpp
|
2010-11-29 22:29:04 +00:00
|
|
|
Support/TimeValue.cpp
|
2010-09-24 09:01:13 +00:00
|
|
|
Support/TypeBuilderTest.cpp
|
|
|
|
Support/ValueHandleTest.cpp
|
|
|
|
)
|