diff options
author | Pirama Arumuga Nainar <pirama@google.com> | 2015-05-06 11:46:36 -0700 |
---|---|---|
committer | Pirama Arumuga Nainar <pirama@google.com> | 2015-05-18 10:52:30 -0700 |
commit | 2c3e0051c31c3f5b2328b447eadf1cf9c4427442 (patch) | |
tree | c0104029af14e9f47c2ef58ca60e6137691f3c9b /utils/unittest | |
parent | e1bc145815f4334641be19f1c45ecf85d25b6e5a (diff) | |
download | external_llvm-2c3e0051c31c3f5b2328b447eadf1cf9c4427442.zip external_llvm-2c3e0051c31c3f5b2328b447eadf1cf9c4427442.tar.gz external_llvm-2c3e0051c31c3f5b2328b447eadf1cf9c4427442.tar.bz2 |
Update aosp/master LLVM for rebase to r235153
Change-Id: I9bf53792f9fc30570e81a8d80d296c681d005ea7
(cherry picked from commit 0c7f116bb6950ef819323d855415b2f2b0aad987)
Diffstat (limited to 'utils/unittest')
11 files changed, 92 insertions, 87 deletions
diff --git a/utils/unittest/UnitTestMain/TestMain.cpp b/utils/unittest/UnitTestMain/TestMain.cpp index 5387512..f5b09a5 100644 --- a/utils/unittest/UnitTestMain/TestMain.cpp +++ b/utils/unittest/UnitTestMain/TestMain.cpp @@ -23,7 +23,7 @@ const char *TestMainArgv0; int main(int argc, char **argv) { - llvm::sys::PrintStackTraceOnErrorSignal(); + llvm::sys::PrintStackTraceOnErrorSignal(true /* Disable crash reporting */); testing::InitGoogleTest(&argc, argv); llvm::cl::ParseCommandLineOptions(argc, argv); diff --git a/utils/unittest/googletest/include/gtest/gtest-spi.h b/utils/unittest/googletest/include/gtest/gtest-spi.h index b226e55..736f692 100644 --- a/utils/unittest/googletest/include/gtest/gtest-spi.h +++ b/utils/unittest/googletest/include/gtest/gtest-spi.h @@ -68,14 +68,15 @@ class GTEST_API_ ScopedFakeTestPartResultReporter TestPartResultArray* result); // The d'tor restores the previous test part result reporter. - virtual ~ScopedFakeTestPartResultReporter(); + ~ScopedFakeTestPartResultReporter() override; // Appends the TestPartResult object to the TestPartResultArray // received in the constructor. // // This method is from the TestPartResultReporterInterface // interface. - virtual void ReportTestPartResult(const TestPartResult& result); + void ReportTestPartResult(const TestPartResult &result) override; + private: void Init(); diff --git a/utils/unittest/googletest/include/gtest/gtest-test-part.h b/utils/unittest/googletest/include/gtest/gtest-test-part.h index 98e8b84..d2410c0 100644 --- a/utils/unittest/googletest/include/gtest/gtest-test-part.h +++ b/utils/unittest/googletest/include/gtest/gtest-test-part.h @@ -159,8 +159,8 @@ class GTEST_API_ HasNewFatalFailureHelper : public TestPartResultReporterInterface { public: HasNewFatalFailureHelper(); - virtual ~HasNewFatalFailureHelper(); - virtual void ReportTestPartResult(const TestPartResult& result); + ~HasNewFatalFailureHelper() override; + void ReportTestPartResult(const TestPartResult &result) override; bool has_new_fatal_failure() const { return has_new_fatal_failure_; } private: bool has_new_fatal_failure_; diff --git a/utils/unittest/googletest/include/gtest/gtest.h b/utils/unittest/googletest/include/gtest/gtest.h index 257cee6..92ca5cc 100644 --- a/utils/unittest/googletest/include/gtest/gtest.h +++ b/utils/unittest/googletest/include/gtest/gtest.h @@ -982,21 +982,22 @@ class TestEventListener { class EmptyTestEventListener : public TestEventListener { virtual void anchor(); public: - virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {} - virtual void OnTestIterationStart(const UnitTest& /*unit_test*/, - int /*iteration*/) {} - virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {} - virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {} - virtual void OnTestCaseStart(const TestCase& /*test_case*/) {} - virtual void OnTestStart(const TestInfo& /*test_info*/) {} - virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {} - virtual void OnTestEnd(const TestInfo& /*test_info*/) {} - virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {} - virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {} - virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {} - virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/, - int /*iteration*/) {} - virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {} + void OnTestProgramStart(const UnitTest & /*unit_test*/) override {} + void OnTestIterationStart(const UnitTest & /*unit_test*/, + int /*iteration*/) override {} + void OnEnvironmentsSetUpStart(const UnitTest & /*unit_test*/) override {} + void OnEnvironmentsSetUpEnd(const UnitTest & /*unit_test*/) override {} + void OnTestCaseStart(const TestCase & /*test_case*/) override {} + void OnTestStart(const TestInfo & /*test_info*/) override {} + void OnTestPartResult(const TestPartResult & /*test_part_result*/) override { + } + void OnTestEnd(const TestInfo & /*test_info*/) override {} + void OnTestCaseEnd(const TestCase & /*test_case*/) override {} + void OnEnvironmentsTearDownStart(const UnitTest & /*unit_test*/) override {} + void OnEnvironmentsTearDownEnd(const UnitTest & /*unit_test*/) override {} + void OnTestIterationEnd(const UnitTest & /*unit_test*/, + int /*iteration*/) override {} + void OnTestProgramEnd(const UnitTest & /*unit_test*/) override {} }; // TestEventListeners lets users add listeners to track events in Google 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 8d53c45..04c676c 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 @@ -147,8 +147,8 @@ class DeathTestFactory { // A concrete DeathTestFactory implementation for normal use. class DefaultDeathTestFactory : public DeathTestFactory { public: - virtual bool Create(const char* statement, const RE* regex, - const char* file, int line, DeathTest** test); + bool Create(const char *statement, const RE *regex, const char *file, + int line, DeathTest **test) override; }; // Returns true if exit_status describes a process that was terminated diff --git a/utils/unittest/googletest/include/gtest/internal/gtest-internal.h b/utils/unittest/googletest/include/gtest/internal/gtest-internal.h index 63f72ac..3c7eee8 100644 --- a/utils/unittest/googletest/include/gtest/internal/gtest-internal.h +++ b/utils/unittest/googletest/include/gtest/internal/gtest-internal.h @@ -555,7 +555,7 @@ class TestFactoryBase { template <class TestClass> class TestFactoryImpl : public TestFactoryBase { public: - virtual Test* CreateTest() { return new TestClass; } + Test *CreateTest() override { return new TestClass; } }; #if GTEST_OS_WINDOWS 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 3bb2ffb..dea4d5c 100644 --- a/utils/unittest/googletest/include/gtest/internal/gtest-param-util.h +++ b/utils/unittest/googletest/include/gtest/internal/gtest-param-util.h @@ -270,12 +270,12 @@ class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> { template <typename ForwardIterator> ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end) : container_(begin, end) {} - virtual ~ValuesInIteratorRangeGenerator() {} + ~ValuesInIteratorRangeGenerator() override {} - virtual ParamIteratorInterface<T>* Begin() const { + ParamIteratorInterface<T> *Begin() const override { return new Iterator(this, container_.begin()); } - virtual ParamIteratorInterface<T>* End() const { + ParamIteratorInterface<T> *End() const override { return new Iterator(this, container_.end()); } @@ -287,16 +287,16 @@ class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> { Iterator(const ParamGeneratorInterface<T>* base, typename ContainerType::const_iterator iterator) : base_(base), iterator_(iterator) {} - virtual ~Iterator() {} + ~Iterator() override {} - virtual const ParamGeneratorInterface<T>* BaseGenerator() const { + const ParamGeneratorInterface<T> *BaseGenerator() const override { return base_; } - virtual void Advance() { + void Advance() override { ++iterator_; value_.reset(); } - virtual ParamIteratorInterface<T>* Clone() const { + ParamIteratorInterface<T> *Clone() const override { return new Iterator(*this); } // We need to use cached value referenced by iterator_ because *iterator_ @@ -306,12 +306,12 @@ class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> { // can advance iterator_ beyond the end of the range, and we cannot // detect that fact. The client code, on the other hand, is // responsible for not calling Current() on an out-of-range iterator. - virtual const T* Current() const { + const T *Current() const override { if (value_.get() == NULL) value_.reset(new T(*iterator_)); return value_.get(); } - virtual bool Equals(const ParamIteratorInterface<T>& other) const { + bool Equals(const ParamIteratorInterface<T> &other) const override { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) @@ -355,7 +355,7 @@ class ParameterizedTestFactory : public TestFactoryBase { typedef typename TestClass::ParamType ParamType; explicit ParameterizedTestFactory(ParamType parameter) : parameter_(parameter) {} - virtual Test* CreateTest() { + Test *CreateTest() override { TestClass::SetParam(¶meter_); return new TestClass(); } @@ -394,7 +394,7 @@ class TestMetaFactory TestMetaFactory() {} - virtual TestFactoryBase* CreateTestFactory(ParamType parameter) { + TestFactoryBase *CreateTestFactory(ParamType parameter) override { return new ParameterizedTestFactory<TestCase>(parameter); } @@ -454,9 +454,9 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase { : test_case_name_(name) {} // Test case base name for display purposes. - virtual const string& GetTestCaseName() const { return test_case_name_; } + const string &GetTestCaseName() const override { return test_case_name_; } // Test case id to verify identity. - virtual TypeId GetTestCaseTypeId() const { return GetTypeId<TestCase>(); } + TypeId GetTestCaseTypeId() const override { return GetTypeId<TestCase>(); } // TEST_P macro uses AddTestPattern() to record information // about a single test in a LocalTestInfo structure. // test_case_name is the base name of the test case (without invocation @@ -484,7 +484,7 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase { // This method should not be called more then once on any single // instance of a ParameterizedTestCaseInfoBase derived class. // UnitTest has a guard to prevent from calling this method more then once. - virtual void RegisterTests() { + void RegisterTests() override { for (typename TestInfoContainer::iterator test_it = tests_.begin(); test_it != tests_.end(); ++test_it) { linked_ptr<TestInfo> test_info = *test_it; diff --git a/utils/unittest/googletest/include/gtest/internal/gtest-port.h b/utils/unittest/googletest/include/gtest/internal/gtest-port.h index 9ddcea1..6b942e9 100644 --- a/utils/unittest/googletest/include/gtest/internal/gtest-port.h +++ b/utils/unittest/googletest/include/gtest/internal/gtest-port.h @@ -1165,7 +1165,7 @@ class ThreadWithParam : public ThreadWithParamBase { GTEST_CHECK_POSIX_SUCCESS_( pthread_create(&thread_, 0, &ThreadFuncWithCLinkage, base)); } - ~ThreadWithParam() { Join(); } + ~ThreadWithParam() override { Join(); } void Join() { if (!finished_) { @@ -1174,7 +1174,7 @@ class ThreadWithParam : public ThreadWithParamBase { } } - virtual void Run() { + void Run() override { if (thread_can_start_ != NULL) thread_can_start_->WaitForNotification(); func_(param_); diff --git a/utils/unittest/googletest/src/gtest-death-test.cc b/utils/unittest/googletest/src/gtest-death-test.cc index 314dba2..47c1a15 100644 --- a/utils/unittest/googletest/src/gtest-death-test.cc +++ b/utils/unittest/googletest/src/gtest-death-test.cc @@ -334,10 +334,10 @@ class DeathTestImpl : public DeathTest { write_fd_(-1) {} // read_fd_ is expected to be closed and cleared by a derived class. - ~DeathTestImpl() { GTEST_DEATH_TEST_CHECK_(read_fd_ == -1); } + ~DeathTestImpl() override { GTEST_DEATH_TEST_CHECK_(read_fd_ == -1); } - void Abort(AbortReason reason); - virtual bool Passed(bool status_ok); + void Abort(AbortReason reason) override; + bool Passed(bool status_ok) override; const char* statement() const { return statement_; } const RE* regex() const { return regex_; } @@ -744,7 +744,7 @@ class ForkingDeathTest : public DeathTestImpl { ForkingDeathTest(const char* statement, const RE* regex); // All of these virtual functions are inherited from DeathTest. - virtual int Wait(); + int Wait() override; protected: void set_child_pid(pid_t child_pid) { child_pid_ = child_pid; } @@ -780,7 +780,7 @@ class NoExecDeathTest : public ForkingDeathTest { public: NoExecDeathTest(const char* a_statement, const RE* a_regex) : ForkingDeathTest(a_statement, a_regex) { } - virtual TestRole AssumeRole(); + TestRole AssumeRole() override; }; // The AssumeRole process for a fork-and-run death test. It implements a @@ -835,7 +835,8 @@ class ExecDeathTest : public ForkingDeathTest { ExecDeathTest(const char* a_statement, const RE* a_regex, const char* file, int line) : ForkingDeathTest(a_statement, a_regex), file_(file), line_(line) { } - virtual TestRole AssumeRole(); + TestRole AssumeRole() override; + private: // The name of the file in which the death test is located. const char* const file_; diff --git a/utils/unittest/googletest/src/gtest-internal-inl.h b/utils/unittest/googletest/src/gtest-internal-inl.h index 1bae630..35e865f 100644 --- a/utils/unittest/googletest/src/gtest-internal-inl.h +++ b/utils/unittest/googletest/src/gtest-internal-inl.h @@ -431,8 +431,8 @@ class OsStackTraceGetterInterface { class OsStackTraceGetter : public OsStackTraceGetterInterface { public: OsStackTraceGetter() : caller_frame_(NULL) {} - virtual String CurrentStackTrace(int max_depth, int skip_count); - virtual void UponLeavingGTest(); + String CurrentStackTrace(int max_depth, int skip_count) override; + void UponLeavingGTest() override; // This string is inserted in place of stack frames that are part of // Google Test's implementation. @@ -465,7 +465,7 @@ class DefaultGlobalTestPartResultReporter explicit DefaultGlobalTestPartResultReporter(UnitTestImpl* unit_test); // Implements the TestPartResultReporterInterface. Reports the test part // result in the current test. - virtual void ReportTestPartResult(const TestPartResult& result); + void ReportTestPartResult(const TestPartResult &result) override; private: UnitTestImpl* const unit_test_; @@ -481,7 +481,7 @@ class DefaultPerThreadTestPartResultReporter explicit DefaultPerThreadTestPartResultReporter(UnitTestImpl* unit_test); // Implements the TestPartResultReporterInterface. The implementation just // delegates to the current global test part result reporter of *unit_test_. - virtual void ReportTestPartResult(const TestPartResult& result); + void ReportTestPartResult(const TestPartResult &result) override; private: UnitTestImpl* const unit_test_; diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc index bf850c6..5780764 100644 --- a/utils/unittest/googletest/src/gtest.cc +++ b/utils/unittest/googletest/src/gtest.cc @@ -2663,19 +2663,19 @@ class PrettyUnitTestResultPrinter : public TestEventListener { } // The following methods override what's in the TestEventListener class. - virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {} - virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration); - virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test); - virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {} - virtual void OnTestCaseStart(const TestCase& test_case); - virtual void OnTestStart(const TestInfo& test_info); - virtual void OnTestPartResult(const TestPartResult& result); - virtual void OnTestEnd(const TestInfo& test_info); - virtual void OnTestCaseEnd(const TestCase& test_case); - virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test); - virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {} - virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration); - virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {} + void OnTestProgramStart(const UnitTest & /*unit_test*/) override {} + void OnTestIterationStart(const UnitTest &unit_test, int iteration) override; + void OnEnvironmentsSetUpStart(const UnitTest &unit_test) override; + void OnEnvironmentsSetUpEnd(const UnitTest & /*unit_test*/) override {} + void OnTestCaseStart(const TestCase &test_case) override; + void OnTestStart(const TestInfo &test_info) override; + void OnTestPartResult(const TestPartResult &result) override; + void OnTestEnd(const TestInfo &test_info) override; + void OnTestCaseEnd(const TestCase &test_case) override; + void OnEnvironmentsTearDownStart(const UnitTest &unit_test) override; + void OnEnvironmentsTearDownEnd(const UnitTest & /*unit_test*/) override {} + void OnTestIterationEnd(const UnitTest &unit_test, int iteration) override; + void OnTestProgramEnd(const UnitTest & /*unit_test*/) override {} private: static void PrintFailedTests(const UnitTest& unit_test); @@ -2869,7 +2869,7 @@ void PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, class TestEventRepeater : public TestEventListener { public: TestEventRepeater() : forwarding_enabled_(true) {} - virtual ~TestEventRepeater(); + ~TestEventRepeater() override; void Append(TestEventListener *listener); TestEventListener* Release(TestEventListener* listener); @@ -2878,19 +2878,19 @@ class TestEventRepeater : public TestEventListener { bool forwarding_enabled() const { return forwarding_enabled_; } void set_forwarding_enabled(bool enable) { forwarding_enabled_ = enable; } - virtual void OnTestProgramStart(const UnitTest& unit_test); - virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration); - virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test); - virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test); - virtual void OnTestCaseStart(const TestCase& test_case); - virtual void OnTestStart(const TestInfo& test_info); - virtual void OnTestPartResult(const TestPartResult& result); - virtual void OnTestEnd(const TestInfo& test_info); - virtual void OnTestCaseEnd(const TestCase& test_case); - virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test); - virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test); - virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration); - virtual void OnTestProgramEnd(const UnitTest& unit_test); + void OnTestProgramStart(const UnitTest &unit_test) override; + void OnTestIterationStart(const UnitTest &unit_test, int iteration) override; + void OnEnvironmentsSetUpStart(const UnitTest &unit_test) override; + void OnEnvironmentsSetUpEnd(const UnitTest &unit_test) override; + void OnTestCaseStart(const TestCase &test_case) override; + void OnTestStart(const TestInfo &test_info) override; + void OnTestPartResult(const TestPartResult &result) override; + void OnTestEnd(const TestInfo &test_info) override; + void OnTestCaseEnd(const TestCase &test_case) override; + void OnEnvironmentsTearDownStart(const UnitTest &unit_test) override; + void OnEnvironmentsTearDownEnd(const UnitTest &unit_test) override; + void OnTestIterationEnd(const UnitTest &unit_test, int iteration) override; + void OnTestProgramEnd(const UnitTest &unit_test) override; private: // Controls whether events will be forwarded to listeners_. Set to false @@ -2983,7 +2983,7 @@ class XmlUnitTestResultPrinter : public EmptyTestEventListener { public: explicit XmlUnitTestResultPrinter(const char* output_file); - virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration); + void OnTestIterationEnd(const UnitTest &unit_test, int iteration) override; private: // Is c a whitespace character that is normalized to a space character @@ -3310,16 +3310,16 @@ class StreamingListener : public EmptyTestEventListener { Send("gtest_streaming_protocol_version=1.0\n"); } - virtual ~StreamingListener() { + ~StreamingListener() override { if (sockfd_ != -1) CloseConnection(); } - void OnTestProgramStart(const UnitTest& /* unit_test */) { + void OnTestProgramStart(const UnitTest & /* unit_test */) override { Send("event=TestProgramStart\n"); } - void OnTestProgramEnd(const UnitTest& unit_test) { + void OnTestProgramEnd(const UnitTest &unit_test) override { // Note that Google Test current only report elapsed time for each // test iteration, not for the entire test program. Send(String::Format("event=TestProgramEnd&passed=%d\n", @@ -3329,39 +3329,41 @@ class StreamingListener : public EmptyTestEventListener { CloseConnection(); } - void OnTestIterationStart(const UnitTest& /* unit_test */, int iteration) { + void OnTestIterationStart(const UnitTest & /* unit_test */, + int iteration) override { Send(String::Format("event=TestIterationStart&iteration=%d\n", iteration)); } - void OnTestIterationEnd(const UnitTest& unit_test, int /* iteration */) { + void OnTestIterationEnd(const UnitTest &unit_test, + int /* iteration */) override { Send(String::Format("event=TestIterationEnd&passed=%d&elapsed_time=%sms\n", unit_test.Passed(), StreamableToString(unit_test.elapsed_time()).c_str())); } - void OnTestCaseStart(const TestCase& test_case) { + void OnTestCaseStart(const TestCase &test_case) override { Send(String::Format("event=TestCaseStart&name=%s\n", test_case.name())); } - void OnTestCaseEnd(const TestCase& test_case) { + void OnTestCaseEnd(const TestCase &test_case) override { Send(String::Format("event=TestCaseEnd&passed=%d&elapsed_time=%sms\n", test_case.Passed(), StreamableToString(test_case.elapsed_time()).c_str())); } - void OnTestStart(const TestInfo& test_info) { + void OnTestStart(const TestInfo &test_info) override { Send(String::Format("event=TestStart&name=%s\n", test_info.name())); } - void OnTestEnd(const TestInfo& test_info) { + void OnTestEnd(const TestInfo &test_info) override { Send(String::Format( "event=TestEnd&passed=%d&elapsed_time=%sms\n", (test_info.result())->Passed(), StreamableToString((test_info.result())->elapsed_time()).c_str())); } - void OnTestPartResult(const TestPartResult& test_part_result) { + void OnTestPartResult(const TestPartResult &test_part_result) override { const char* file_name = test_part_result.file_name(); if (file_name == NULL) file_name = ""; |