2010-12-07 07:41:23 +00:00
|
|
|
function(add_llvm_unittest test_dirname)
|
|
|
|
string(REGEX MATCH "([^/]+)$" test_name ${test_dirname})
|
2010-09-24 09:01:13 +00:00
|
|
|
if (CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
|
2010-12-07 07:41:23 +00:00
|
|
|
${LLVM_BINARY_DIR}/unittests/${test_dirname}/${CMAKE_BUILD_TYPE})
|
2010-09-24 09:01:13 +00:00
|
|
|
else()
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
|
2010-12-07 07:41:23 +00:00
|
|
|
${LLVM_BINARY_DIR}/unittests/${test_dirname})
|
2010-09-24 09:01:13 +00:00
|
|
|
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)
|
2011-02-20 22:06:10 +00:00
|
|
|
set_target_properties(${test_name}Tests PROPERTIES FOLDER "Tests")
|
2010-09-24 09:01:13 +00:00
|
|
|
endfunction()
|
|
|
|
|
2010-10-28 14:38:35 +00:00
|
|
|
add_custom_target(UnitTests)
|
2011-02-20 22:06:10 +00:00
|
|
|
set_target_properties(UnitTests PROPERTIES FOLDER "Tests")
|
2010-10-28 14:38:35 +00:00
|
|
|
|
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)
|
2011-05-11 13:53:08 +00:00
|
|
|
if( LLVM_COMPILER_IS_GCC_COMPATIBLE )
|
2011-01-13 15:31:45 +00: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 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
|
|
|
|
2010-12-07 10:22:07 +00:00
|
|
|
if(SUPPORTS_NO_VARIADIC_MACROS_FLAG)
|
|
|
|
add_definitions("-Wno-variadic-macros")
|
|
|
|
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
|
2012-02-18 21:00:49 +00:00
|
|
|
ADT/HashingTest.cpp
|
2010-09-24 09:01:13 +00:00
|
|
|
ADT/ilistTest.cpp
|
|
|
|
ADT/ImmutableSetTest.cpp
|
2010-12-21 00:04:46 +00:00
|
|
|
ADT/IntEqClassesTest.cpp
|
2010-11-19 04:47:19 +00:00
|
|
|
ADT/IntervalMapTest.cpp
|
2012-01-31 19:58:34 +00:00
|
|
|
ADT/IntrusiveRefCntPtrTest.cpp
|
2011-06-15 19:19:09 +00:00
|
|
|
ADT/PackedVectorTest.cpp
|
2010-09-24 09:01:13 +00:00
|
|
|
ADT/SmallBitVectorTest.cpp
|
|
|
|
ADT/SmallStringTest.cpp
|
|
|
|
ADT/SmallVectorTest.cpp
|
|
|
|
ADT/SparseBitVectorTest.cpp
|
2012-02-22 00:56:08 +00:00
|
|
|
ADT/SparseSetTest.cpp
|
2010-09-24 09:01:13 +00:00
|
|
|
ADT/StringMapTest.cpp
|
|
|
|
ADT/StringRefTest.cpp
|
|
|
|
ADT/TripleTest.cpp
|
|
|
|
ADT/TwineTest.cpp
|
2011-12-16 08:58:59 +00:00
|
|
|
ADT/VariadicFunctionTest.cpp
|
2010-09-27 16:40:43 +00:00
|
|
|
)
|
2010-09-24 09:01:13 +00:00
|
|
|
|
|
|
|
add_llvm_unittest(Analysis
|
|
|
|
Analysis/ScalarEvolutionTest.cpp
|
|
|
|
)
|
|
|
|
|
2012-03-15 06:49:31 +00:00
|
|
|
add_llvm_unittest(ExecutionEngine
|
|
|
|
ExecutionEngine/ExecutionEngineTest.cpp
|
|
|
|
)
|
|
|
|
|
2012-03-13 08:33:15 +00:00
|
|
|
if( LLVM_USE_INTEL_JITEVENTS )
|
|
|
|
include_directories( ${LLVM_INTEL_JITEVENTS_INCDIR} )
|
|
|
|
link_directories( ${LLVM_INTEL_JITEVENTS_LIBDIR} )
|
|
|
|
set(ProfileTestSources
|
2012-03-15 06:49:31 +00:00
|
|
|
ExecutionEngine/JIT/IntelJITEventListenerTest.cpp
|
2012-03-13 08:33:15 +00:00
|
|
|
)
|
|
|
|
set(LLVM_LINK_COMPONENTS
|
|
|
|
${LLVM_LINK_COMPONENTS}
|
|
|
|
IntelJITEvents
|
|
|
|
)
|
|
|
|
endif( LLVM_USE_INTEL_JITEVENTS )
|
|
|
|
|
|
|
|
if( LLVM_USE_OPROFILE )
|
|
|
|
set(ProfileTestSources
|
|
|
|
${ProfileTestSources}
|
2012-03-15 06:49:31 +00:00
|
|
|
ExecutionEngine/JIT/OProfileJITEventListenerTest.cpp
|
2012-03-13 08:33:15 +00:00
|
|
|
)
|
|
|
|
set(LLVM_LINK_COMPONENTS
|
|
|
|
${LLVM_LINK_COMPONENTS}
|
|
|
|
OProfileJIT
|
|
|
|
)
|
|
|
|
endif( LLVM_USE_OPROFILE )
|
|
|
|
|
2010-11-19 03:19:42 +00:00
|
|
|
set(JITTestsSources
|
2012-03-15 06:49:31 +00:00
|
|
|
ExecutionEngine/JIT/JITEventListenerTest.cpp
|
2010-09-24 09:01:13 +00:00
|
|
|
ExecutionEngine/JIT/JITMemoryManagerTest.cpp
|
|
|
|
ExecutionEngine/JIT/JITTest.cpp
|
|
|
|
ExecutionEngine/JIT/MultiJITTest.cpp
|
2012-03-15 06:49:31 +00:00
|
|
|
${ProfileTestSources}
|
2010-09-24 09:01:13 +00:00
|
|
|
)
|
|
|
|
|
2010-11-19 03:19:42 +00:00
|
|
|
if(MSVC)
|
|
|
|
list(APPEND JITTestsSources ExecutionEngine/JIT/JITTests.def)
|
|
|
|
endif()
|
|
|
|
|
2010-12-07 07:41:23 +00:00
|
|
|
add_llvm_unittest(ExecutionEngine/JIT ${JITTestsSources})
|
2010-11-19 03:19:42 +00:00
|
|
|
|
2011-12-16 06:21:08 +00:00
|
|
|
if(MINGW OR CYGWIN)
|
2010-11-26 09:32:02 +00:00
|
|
|
set_property(TARGET JITTests PROPERTY LINK_FLAGS -Wl,--export-all-symbols)
|
|
|
|
endif()
|
|
|
|
|
2010-12-07 07:41:23 +00:00
|
|
|
add_llvm_unittest(Transforms/Utils
|
2010-10-11 21:22:34 +00:00
|
|
|
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/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
|
2012-03-30 16:46:21 +00:00
|
|
|
VMCore/DominatorTreeTest.cpp
|
2010-10-11 21:22:34 +00:00
|
|
|
)
|
|
|
|
|
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})
|
|
|
|
|
2012-01-02 09:19:48 +00:00
|
|
|
add_llvm_unittest(Bitcode
|
|
|
|
Bitcode/BitReaderTest.cpp
|
|
|
|
)
|
|
|
|
|
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
|
2012-04-03 23:09:22 +00:00
|
|
|
Support/YAMLParserTest.cpp
|
2010-09-24 09:01:13 +00:00
|
|
|
)
|