diff options
author | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-15 00:48:39 +0000 |
---|---|---|
committer | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-15 00:48:39 +0000 |
commit | a42e17147a581df63c1da69ab6bd645119915b4c (patch) | |
tree | ebe7998e337cf9fa9f029c819a4e5ac540c5b9d0 /base | |
parent | 8b5e6dd24aae42b0d8a2abb2b30c3b2989cc6726 (diff) | |
download | chromium_src-a42e17147a581df63c1da69ab6bd645119915b4c.zip chromium_src-a42e17147a581df63c1da69ab6bd645119915b4c.tar.gz chromium_src-a42e17147a581df63c1da69ab6bd645119915b4c.tar.bz2 |
Work around a stupid Purify bug that was causing lots of bogus messages to appear when running base_unittests.exe.
Also change perf_test_suite to call TestSuite::Initialize() prior to its other work to ensure that superclass initialization happens first.
BUG=6436
This bug wound up being introduced with change:
http://codereview.chromium.org/18003
Review URL: http://codereview.chromium.org/18074
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8055 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/perf_test_suite.h | 4 | ||||
-rw-r--r-- | base/test_suite.h | 30 |
2 files changed, 19 insertions, 15 deletions
diff --git a/base/perf_test_suite.h b/base/perf_test_suite.h index bab7904..444a099 100644 --- a/base/perf_test_suite.h +++ b/base/perf_test_suite.h @@ -19,6 +19,8 @@ class PerfTestSuite : public TestSuite { } virtual void Initialize() { + TestSuite::Initialize(); + // Initialize the perf timer log FilePath log_path; std::wstring log_file = CommandLine().GetSwitchValue(L"log-file"); @@ -36,8 +38,6 @@ class PerfTestSuite : public TestSuite { // aim at 1% precision, it is not necessary to run at realtime level. if (!DebugUtil::BeingDebugged()) base::RaiseProcessToHighPriority(); - - TestSuite::Initialize(); } virtual void Shutdown() { diff --git a/base/test_suite.h b/base/test_suite.h index a9f05b2..01b39fa 100644 --- a/base/test_suite.h +++ b/base/test_suite.h @@ -30,28 +30,20 @@ class TestSuite { public: TestSuite(int argc, char** argv) { - base::ScopedNSAutoreleasePool scoped_pool; - base::EnableTerminationOnHeapCorruption(); CommandLine::SetArgcArgv(argc, argv); testing::InitGoogleTest(&argc, argv); #if defined(OS_LINUX) gtk_init_check(&argc, &argv); #endif - - FilePath exe; - PathService::Get(base::FILE_EXE, &exe); - FilePath log_filename = exe.ReplaceExtension(FILE_PATH_LITERAL("log")); - logging::InitLogging(log_filename.value().c_str(), - logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE); - // we want process and thread IDs because we may have multiple processes - logging::SetLogItems(true, true, false, true); + // Don't add additional code to this constructor. Instead add it to + // Initialize(). See bug 6436. } virtual ~TestSuite() {} + // Don't add additional code to this method. Instead add it to + // Initialize(). See bug 6436. int Run() { base::ScopedNSAutoreleasePool scoped_pool; @@ -71,7 +63,7 @@ class TestSuite { } protected: - // All fatal log messages (e.g. DCHECK failures) imply unit test failures + // All fatal log messages (e.g. DCHECK failures) imply unit test failures. static void UnitTestAssertHandler(const std::string& str) { FAIL() << str; } @@ -94,6 +86,18 @@ class TestSuite { // instead of putting complex code in your constructor/destructor. virtual void Initialize() { + // Initialize logging. + FilePath exe; + PathService::Get(base::FILE_EXE, &exe); + FilePath log_filename = exe.ReplaceExtension(FILE_PATH_LITERAL("log")); + logging::InitLogging(log_filename.value().c_str(), + logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, + logging::LOCK_LOG_FILE, + logging::DELETE_OLD_LOG_FILE); + // We want process and thread IDs because we may have multiple processes. + // Note: temporarily enabled timestamps in an effort to catch bug 6361. + logging::SetLogItems(true, true, true, true); + #if defined(OS_WIN) // In some cases, we do not want to see standard error dialogs. if (!IsDebuggerPresent() && |