diff options
Diffstat (limited to 'utils/unittest')
18 files changed, 63 insertions, 43 deletions
diff --git a/utils/unittest/CMakeLists.txt b/utils/unittest/CMakeLists.txt index 70ed35df2e6c1..fd1a048d832b3 100644 --- a/utils/unittest/CMakeLists.txt +++ b/utils/unittest/CMakeLists.txt @@ -14,6 +14,7 @@ # Where gtest's .h files can be found. include_directories( googletest/include + googletest ) if(WIN32) @@ -27,6 +28,10 @@ endif() set(LLVM_REQUIRES_RTTI 1) add_definitions( -DGTEST_HAS_RTTI=0 ) +if (NOT LLVM_ENABLE_THREADS) + add_definitions( -DGTEST_HAS_PTHREAD=0 ) +endif() + # Visual Studio 2012 only supports up to 8 template parameters in # std::tr1::tuple by default, but gtest requires 10 if(MSVC AND MSVC_VERSION EQUAL 1700) @@ -34,13 +39,7 @@ if(MSVC AND MSVC_VERSION EQUAL 1700) endif () add_llvm_library(gtest - googletest/gtest.cc - googletest/gtest-death-test.cc - googletest/gtest-filepath.cc - googletest/gtest-port.cc - googletest/gtest-printers.cc - googletest/gtest-test-part.cc - googletest/gtest-typed-test.cc + googletest/src/gtest-all.cc ) add_llvm_library(gtest_main diff --git a/utils/unittest/googletest/Makefile b/utils/unittest/googletest/Makefile index bf736704f5498..3d85e7da0ba60 100644 --- a/utils/unittest/googletest/Makefile +++ b/utils/unittest/googletest/Makefile @@ -19,6 +19,7 @@ REQUIRES_RTTI = 1 # unittests/Makefile.unittest and ../UnitTestMain/Makefile; ensure that any # changes are made to both. CPP.Flags += -I$(LLVM_SRC_ROOT)/utils/unittest/googletest/include +CPP.Flags += -I$(LLVM_SRC_ROOT)/utils/unittest/googletest CPP.Flags += $(NO_MISSING_FIELD_INITIALIZERS) $(NO_VARIADIC_MACROS) CPP.Flags += -DGTEST_HAS_RTTI=0 # libstdc++'s TR1 <tuple> header depends on RTTI and uses C++'0x features not @@ -36,6 +37,6 @@ endif NO_INSTALL = 1 -SOURCES = $(filter-out gtest-all.cc, $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cc))) +SOURCES = src/gtest-all.cc include $(LEVEL)/Makefile.common diff --git a/utils/unittest/googletest/README.LLVM b/utils/unittest/googletest/README.LLVM index 3565a3280e4fa..1a6f0f59f1d71 100644 --- a/utils/unittest/googletest/README.LLVM +++ b/utils/unittest/googletest/README.LLVM @@ -10,23 +10,11 @@ Cleaned up as follows: $ rm -f aclocal* CMakeLists.txt configure* Makefile* CHANGES CONTRIBUTORS README $ rm -rf build-aux cmake codegear fused-src m4 make msvc samples scripts test xcode $ rm -f `find . -name \*\.pump` +$ rm -f src/gtest_main.cc -# Move all the source files to the current directory -$ mv src/* . -$ rmdir src - -# Move extra headers into the already-existing internal headers dir -$ mv *.h include/gtest/internal/ - -# Update paths to the included files -$ perl -pi -e 's|^#include "src/|#include "|' gtest-all.cc -$ perl -pi -e 's|^#include "src/|#include "gtest/internal/|' *.cc - -$ rm -f gtest_main.cc - +# Put the license in the consistent place for LLVM. $ mv COPYING LICENSE.TXT - Modified as follows: * To GTestStreamToHelper in include/gtest/internal/gtest-internal.h, added the ability to stream with raw_os_ostream. diff --git a/utils/unittest/googletest/include/gtest/gtest-test-part.h b/utils/unittest/googletest/include/gtest/gtest-test-part.h index 8aeea14984e06..98e8b844915d1 100644 --- a/utils/unittest/googletest/include/gtest/gtest-test-part.h +++ b/utils/unittest/googletest/include/gtest/gtest-test-part.h @@ -142,7 +142,7 @@ class GTEST_API_ TestPartResultArray { // This interface knows how to report a test part result. class TestPartResultReporterInterface { public: - virtual ~TestPartResultReporterInterface() {} + virtual ~TestPartResultReporterInterface(); virtual void ReportTestPartResult(const TestPartResult& result) = 0; }; diff --git a/utils/unittest/googletest/include/gtest/gtest.h b/utils/unittest/googletest/include/gtest/gtest.h index 1734c4432e1c4..07ed92b57c0dc 100644 --- a/utils/unittest/googletest/include/gtest/gtest.h +++ b/utils/unittest/googletest/include/gtest/gtest.h @@ -910,7 +910,7 @@ class GTEST_API_ TestCase { class Environment { public: // The d'tor is virtual as we need to subclass Environment. - virtual ~Environment() {} + virtual ~Environment(); // Override this to define how to set up the environment. virtual void SetUp() {} @@ -928,7 +928,7 @@ class Environment { // the order the corresponding events are fired. class TestEventListener { public: - virtual ~TestEventListener() {} + virtual ~TestEventListener(); // Fired before any test activity starts. virtual void OnTestProgramStart(const UnitTest& unit_test) = 0; @@ -980,6 +980,7 @@ class TestEventListener { // comments about each method please see the definition of TestEventListener // above. class EmptyTestEventListener : public TestEventListener { + virtual void anchor(); public: virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {} virtual void OnTestIterationStart(const UnitTest& /*unit_test*/, diff --git a/utils/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h b/utils/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h index 7bac2bd872bb2..8d53c4528078b 100644 --- a/utils/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h +++ b/utils/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h @@ -79,7 +79,7 @@ class GTEST_API_ DeathTest { static bool Create(const char* statement, const RE* regex, const char* file, int line, DeathTest** test); DeathTest(); - virtual ~DeathTest() { } + virtual ~DeathTest(); // A helper class that aborts a death test when it's deleted. class ReturnSentinel { @@ -139,7 +139,7 @@ class GTEST_API_ DeathTest { // Factory interface for death tests. May be mocked out for testing. class DeathTestFactory { public: - virtual ~DeathTestFactory() { } + virtual ~DeathTestFactory(); virtual bool Create(const char* statement, const RE* regex, const char* file, int line, DeathTest** test) = 0; }; diff --git a/utils/unittest/googletest/include/gtest/internal/gtest-internal.h b/utils/unittest/googletest/include/gtest/internal/gtest-internal.h index a94bf28421fb4..63f72acdfb572 100644 --- a/utils/unittest/googletest/include/gtest/internal/gtest-internal.h +++ b/utils/unittest/googletest/include/gtest/internal/gtest-internal.h @@ -105,6 +105,7 @@ #if !GTEST_NO_LLVM_RAW_OSTREAM namespace llvm { class convertible_fwd_ostream : public std::ostream { + virtual void anchor(); raw_os_ostream ros_; public: @@ -536,7 +537,7 @@ GTEST_API_ TypeId GetTestTypeId(); // of a Test object. class TestFactoryBase { public: - virtual ~TestFactoryBase() {} + virtual ~TestFactoryBase(); // Creates a test instance to run. The instance is both created and destroyed // within TestInfoImpl::Run() diff --git a/utils/unittest/googletest/include/gtest/internal/gtest-param-util.h b/utils/unittest/googletest/include/gtest/internal/gtest-param-util.h index 0ef9718cf43a9..3bb2ffb355666 100644 --- a/utils/unittest/googletest/include/gtest/internal/gtest-param-util.h +++ b/utils/unittest/googletest/include/gtest/internal/gtest-param-util.h @@ -414,7 +414,7 @@ class TestMetaFactory // and calls RegisterTests() on each of them when asked. class ParameterizedTestCaseInfoBase { public: - virtual ~ParameterizedTestCaseInfoBase() {} + virtual ~ParameterizedTestCaseInfoBase(); // Base part of test case name for display purposes. virtual const string& GetTestCaseName() const = 0; diff --git a/utils/unittest/googletest/include/gtest/internal/gtest-port.h b/utils/unittest/googletest/include/gtest/internal/gtest-port.h index 58f6cafa75fb1..32fd9c65bfeab 100644 --- a/utils/unittest/googletest/include/gtest/internal/gtest-port.h +++ b/utils/unittest/googletest/include/gtest/internal/gtest-port.h @@ -1116,7 +1116,7 @@ class Notification { // problem. class ThreadWithParamBase { public: - virtual ~ThreadWithParamBase() {} + virtual ~ThreadWithParamBase(); virtual void Run() = 0; }; @@ -1290,7 +1290,7 @@ typedef GTestMutexLock MutexLock; // ThreadLocalValueHolderBase. class ThreadLocalValueHolderBase { public: - virtual ~ThreadLocalValueHolderBase() {} + virtual ~ThreadLocalValueHolderBase(); }; // Called by pthread to delete thread-local data stored by diff --git a/utils/unittest/googletest/gtest-all.cc b/utils/unittest/googletest/src/gtest-all.cc index 97753e5b9d5af..0a9cee5223332 100644 --- a/utils/unittest/googletest/gtest-all.cc +++ b/utils/unittest/googletest/src/gtest-all.cc @@ -39,10 +39,10 @@ #include "gtest/gtest.h" // The following lines pull in the real gtest *.cc files. -#include "gtest.cc" -#include "gtest-death-test.cc" -#include "gtest-filepath.cc" -#include "gtest-port.cc" -#include "gtest-printers.cc" -#include "gtest-test-part.cc" -#include "gtest-typed-test.cc" +#include "src/gtest.cc" +#include "src/gtest-death-test.cc" +#include "src/gtest-filepath.cc" +#include "src/gtest-port.cc" +#include "src/gtest-printers.cc" +#include "src/gtest-test-part.cc" +#include "src/gtest-typed-test.cc" diff --git a/utils/unittest/googletest/gtest-death-test.cc b/utils/unittest/googletest/src/gtest-death-test.cc index bf7e32c238359..314dba2116e97 100644 --- a/utils/unittest/googletest/gtest-death-test.cc +++ b/utils/unittest/googletest/src/gtest-death-test.cc @@ -63,7 +63,7 @@ // prevent a user from accidentally including gtest-internal-inl.h in // his code. #define GTEST_IMPLEMENTATION_ 1 -#include "gtest/internal/gtest-internal-inl.h" +#include "src/gtest-internal-inl.h" #undef GTEST_IMPLEMENTATION_ namespace testing { @@ -300,6 +300,9 @@ DeathTest::DeathTest() { } } +// Pin the vtable to this file. +DeathTest::~DeathTest() {} + // Creates and returns a death test by dispatching to the current // death test factory. bool DeathTest::Create(const char* statement, const RE* regex, @@ -1091,6 +1094,9 @@ bool DefaultDeathTestFactory::Create(const char* statement, const RE* regex, return true; } +// Pin the vtable to this file. +DeathTestFactory::~DeathTestFactory() {} + // Splits a given string on a given delimiter, populating a given // vector with the fields. GTEST_HAS_DEATH_TEST implies that we have // ::std::string, so we can use it here. diff --git a/utils/unittest/googletest/gtest-filepath.cc b/utils/unittest/googletest/src/gtest-filepath.cc index ad1bab8e9f578..ad1bab8e9f578 100644 --- a/utils/unittest/googletest/gtest-filepath.cc +++ b/utils/unittest/googletest/src/gtest-filepath.cc diff --git a/utils/unittest/googletest/include/gtest/internal/gtest-internal-inl.h b/utils/unittest/googletest/src/gtest-internal-inl.h index 6554cfc07e619..1bae630127b52 100644 --- a/utils/unittest/googletest/include/gtest/internal/gtest-internal-inl.h +++ b/utils/unittest/googletest/src/gtest-internal-inl.h @@ -408,7 +408,7 @@ GTEST_API_ FilePath GetCurrentExecutableName(); class OsStackTraceGetterInterface { public: OsStackTraceGetterInterface() {} - virtual ~OsStackTraceGetterInterface() {} + virtual ~OsStackTraceGetterInterface(); // Returns the current OS stack trace as a String. Parameters: // diff --git a/utils/unittest/googletest/gtest-port.cc b/utils/unittest/googletest/src/gtest-port.cc index 3c32ff1ac1ece..94fc57f89b362 100644 --- a/utils/unittest/googletest/gtest-port.cc +++ b/utils/unittest/googletest/src/gtest-port.cc @@ -62,7 +62,7 @@ // prevent a user from accidentally including gtest-internal-inl.h in // his code. #define GTEST_IMPLEMENTATION_ 1 -#include "gtest/internal/gtest-internal-inl.h" +#include "src/gtest-internal-inl.h" #undef GTEST_IMPLEMENTATION_ namespace testing { @@ -746,5 +746,19 @@ const char* StringFromGTestEnv(const char* flag, const char* default_value) { return value == NULL ? default_value : value; } +// Pin the vtables to this file. +#if GTEST_HAS_PTHREAD +ThreadWithParamBase::~ThreadWithParamBase() {} +ThreadLocalValueHolderBase::~ThreadLocalValueHolderBase() {} +#endif +TestFactoryBase::~TestFactoryBase() {} + } // namespace internal } // namespace testing + +// Pin the vtable to this file. +#if !GTEST_NO_LLVM_RAW_OSTREAM +namespace llvm { +void convertible_fwd_ostream::anchor() {} +} +#endif diff --git a/utils/unittest/googletest/gtest-printers.cc b/utils/unittest/googletest/src/gtest-printers.cc index 205a39425f0e7..205a39425f0e7 100644 --- a/utils/unittest/googletest/gtest-printers.cc +++ b/utils/unittest/googletest/src/gtest-printers.cc diff --git a/utils/unittest/googletest/gtest-test-part.cc b/utils/unittest/googletest/src/gtest-test-part.cc index 161278027d085..5ddc67c1c9e22 100644 --- a/utils/unittest/googletest/gtest-test-part.cc +++ b/utils/unittest/googletest/src/gtest-test-part.cc @@ -39,7 +39,7 @@ // prevent a user from accidentally including gtest-internal-inl.h in // his code. #define GTEST_IMPLEMENTATION_ 1 -#include "gtest/internal/gtest-internal-inl.h" +#include "src/gtest-internal-inl.h" #undef GTEST_IMPLEMENTATION_ namespace testing { diff --git a/utils/unittest/googletest/gtest-typed-test.cc b/utils/unittest/googletest/src/gtest-typed-test.cc index a5cc88f9205df..a5cc88f9205df 100644 --- a/utils/unittest/googletest/gtest-typed-test.cc +++ b/utils/unittest/googletest/src/gtest-typed-test.cc diff --git a/utils/unittest/googletest/gtest.cc b/utils/unittest/googletest/src/gtest.cc index eb5c68c272c0c..bf850c6cd9774 100644 --- a/utils/unittest/googletest/gtest.cc +++ b/utils/unittest/googletest/src/gtest.cc @@ -129,7 +129,7 @@ // prevent a user from accidentally including gtest-internal-inl.h in // his code. #define GTEST_IMPLEMENTATION_ 1 -#include "gtest/internal/gtest-internal-inl.h" +#include "src/gtest-internal-inl.h" #undef GTEST_IMPLEMENTATION_ #if GTEST_OS_WINDOWS @@ -4863,4 +4863,14 @@ void InitGoogleTest(int* argc, wchar_t** argv) { internal::InitGoogleTestImpl(argc, argv); } +// Pin the vtables to this file. +Environment::~Environment() {} +TestPartResultReporterInterface::~TestPartResultReporterInterface() {} +TestEventListener::~TestEventListener() {} +void EmptyTestEventListener::anchor() {} +namespace internal { +OsStackTraceGetterInterface::~OsStackTraceGetterInterface() {} +ParameterizedTestCaseInfoBase::~ParameterizedTestCaseInfoBase() {} +} + } // namespace testing |