gecko-dev/xpcom/tests/gtest/TestDeadlockDetector.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

327 строки
8.9 KiB
C++
Исходник Обычный вид История

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: sw=2 ts=4 et :
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/ArrayUtils.h"
#include "prthread.h"
#include "nsCOMPtr.h"
#include "nsICrashReporter.h"
#include "nsMemory.h"
#include "nsServiceManagerUtils.h"
#include "nsTArray.h"
#include "mozilla/CondVar.h"
#include "mozilla/RecursiveMutex.h"
#include "mozilla/ReentrantMonitor.h"
#include "mozilla/Mutex.h"
#include "gtest/gtest.h"
using namespace mozilla;
Bug 1315138 - gtestify storage/test/*.cpp. r=mak,erahm. This change is mostly straightforward, except for the following. - It removes all the printing from the do_check_* macros because gtest macros do appropriate printing. - test_StatementCache.cpp needs some special gtest magic for the type parameterization. - It merges the four tests in test_unlock_notify.cpp because they rely on being executed in order, and so aren't independent. - storage_test_harness_tail.h is no longer necessary because gtest provides the test looping functionality. - It uses #include and the preprocessor to remove the duplication between test_deadlock_detector.cpp and xpcom/tests/DeadlockDetector.cpp. - It makes the test in test_service_init_background_thread.cpp a death test to force it to be the first storage gtest, because it fails otherwise. - It adds code to undo the SQLite mutex hooking as necessary, so that tests don't interfere with each other. - It de-virtualizes Spinner's destructor (as identified in bug 1318282). --HG-- rename : storage/test/storage_test_harness.h => storage/test/gtest/storage_test_harness.h rename : storage/test/test_AsXXX_helpers.cpp => storage/test/gtest/test_AsXXX_helpers.cpp rename : storage/test/test_StatementCache.cpp => storage/test/gtest/test_StatementCache.cpp rename : storage/test/test_asyncStatementExecution_transaction.cpp => storage/test/gtest/test_asyncStatementExecution_transaction.cpp rename : storage/test/test_async_callbacks_with_spun_event_loops.cpp => storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp rename : storage/test/test_binding_params.cpp => storage/test/gtest/test_binding_params.cpp rename : storage/test/test_deadlock_detector.cpp => storage/test/gtest/test_deadlock_detector.cpp rename : storage/test/test_file_perms.cpp => storage/test/gtest/test_file_perms.cpp rename : storage/test/test_mutex.cpp => storage/test/gtest/test_mutex.cpp rename : storage/test/test_service_init_background_thread.cpp => storage/test/gtest/test_service_init_background_thread.cpp rename : storage/test/test_statement_scoper.cpp => storage/test/gtest/test_statement_scoper.cpp rename : storage/test/test_transaction_helper.cpp => storage/test/gtest/test_transaction_helper.cpp rename : storage/test/test_true_async.cpp => storage/test/gtest/test_true_async.cpp rename : storage/test/test_unlock_notify.cpp => storage/test/gtest/test_unlock_notify.cpp extra : rebase_source : dbb695c112564efa1945116be1a8435988982e74
2016-11-11 01:59:23 +03:00
// The code in this file is also used by
// storage/test/gtest/test_deadlock_detector.cpp. The following two macros are
// used to provide the necessary differentiation between this file and that
// file.
#ifndef MUTEX
# define MUTEX mozilla::Mutex
#endif
#ifndef TESTNAME
# define TESTNAME(name) XPCOM##name
#endif
static PRThread* spawn(void (*run)(void*), void* arg) {
return PR_CreateThread(PR_SYSTEM_THREAD, run, arg, PR_PRIORITY_NORMAL,
PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0);
}
// This global variable is defined in toolkit/xre/nsSigHandlers.cpp.
extern unsigned int _gdb_sleep_duration;
/**
* Simple test fixture that makes sure the gdb sleep setup in the
* ah crap handler is bypassed during the death tests.
*/
Bug 1315138 - gtestify storage/test/*.cpp. r=mak,erahm. This change is mostly straightforward, except for the following. - It removes all the printing from the do_check_* macros because gtest macros do appropriate printing. - test_StatementCache.cpp needs some special gtest magic for the type parameterization. - It merges the four tests in test_unlock_notify.cpp because they rely on being executed in order, and so aren't independent. - storage_test_harness_tail.h is no longer necessary because gtest provides the test looping functionality. - It uses #include and the preprocessor to remove the duplication between test_deadlock_detector.cpp and xpcom/tests/DeadlockDetector.cpp. - It makes the test in test_service_init_background_thread.cpp a death test to force it to be the first storage gtest, because it fails otherwise. - It adds code to undo the SQLite mutex hooking as necessary, so that tests don't interfere with each other. - It de-virtualizes Spinner's destructor (as identified in bug 1318282). --HG-- rename : storage/test/storage_test_harness.h => storage/test/gtest/storage_test_harness.h rename : storage/test/test_AsXXX_helpers.cpp => storage/test/gtest/test_AsXXX_helpers.cpp rename : storage/test/test_StatementCache.cpp => storage/test/gtest/test_StatementCache.cpp rename : storage/test/test_asyncStatementExecution_transaction.cpp => storage/test/gtest/test_asyncStatementExecution_transaction.cpp rename : storage/test/test_async_callbacks_with_spun_event_loops.cpp => storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp rename : storage/test/test_binding_params.cpp => storage/test/gtest/test_binding_params.cpp rename : storage/test/test_deadlock_detector.cpp => storage/test/gtest/test_deadlock_detector.cpp rename : storage/test/test_file_perms.cpp => storage/test/gtest/test_file_perms.cpp rename : storage/test/test_mutex.cpp => storage/test/gtest/test_mutex.cpp rename : storage/test/test_service_init_background_thread.cpp => storage/test/gtest/test_service_init_background_thread.cpp rename : storage/test/test_statement_scoper.cpp => storage/test/gtest/test_statement_scoper.cpp rename : storage/test/test_transaction_helper.cpp => storage/test/gtest/test_transaction_helper.cpp rename : storage/test/test_true_async.cpp => storage/test/gtest/test_true_async.cpp rename : storage/test/test_unlock_notify.cpp => storage/test/gtest/test_unlock_notify.cpp extra : rebase_source : dbb695c112564efa1945116be1a8435988982e74
2016-11-11 01:59:23 +03:00
class TESTNAME(DeadlockDetectorTest) : public ::testing::Test {
protected:
void SetUp() final {
Bug 1315138 - gtestify storage/test/*.cpp. r=mak,erahm. This change is mostly straightforward, except for the following. - It removes all the printing from the do_check_* macros because gtest macros do appropriate printing. - test_StatementCache.cpp needs some special gtest magic for the type parameterization. - It merges the four tests in test_unlock_notify.cpp because they rely on being executed in order, and so aren't independent. - storage_test_harness_tail.h is no longer necessary because gtest provides the test looping functionality. - It uses #include and the preprocessor to remove the duplication between test_deadlock_detector.cpp and xpcom/tests/DeadlockDetector.cpp. - It makes the test in test_service_init_background_thread.cpp a death test to force it to be the first storage gtest, because it fails otherwise. - It adds code to undo the SQLite mutex hooking as necessary, so that tests don't interfere with each other. - It de-virtualizes Spinner's destructor (as identified in bug 1318282). --HG-- rename : storage/test/storage_test_harness.h => storage/test/gtest/storage_test_harness.h rename : storage/test/test_AsXXX_helpers.cpp => storage/test/gtest/test_AsXXX_helpers.cpp rename : storage/test/test_StatementCache.cpp => storage/test/gtest/test_StatementCache.cpp rename : storage/test/test_asyncStatementExecution_transaction.cpp => storage/test/gtest/test_asyncStatementExecution_transaction.cpp rename : storage/test/test_async_callbacks_with_spun_event_loops.cpp => storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp rename : storage/test/test_binding_params.cpp => storage/test/gtest/test_binding_params.cpp rename : storage/test/test_deadlock_detector.cpp => storage/test/gtest/test_deadlock_detector.cpp rename : storage/test/test_file_perms.cpp => storage/test/gtest/test_file_perms.cpp rename : storage/test/test_mutex.cpp => storage/test/gtest/test_mutex.cpp rename : storage/test/test_service_init_background_thread.cpp => storage/test/gtest/test_service_init_background_thread.cpp rename : storage/test/test_statement_scoper.cpp => storage/test/gtest/test_statement_scoper.cpp rename : storage/test/test_transaction_helper.cpp => storage/test/gtest/test_transaction_helper.cpp rename : storage/test/test_true_async.cpp => storage/test/gtest/test_true_async.cpp rename : storage/test/test_unlock_notify.cpp => storage/test/gtest/test_unlock_notify.cpp extra : rebase_source : dbb695c112564efa1945116be1a8435988982e74
2016-11-11 01:59:23 +03:00
mOldSleepDuration = ::_gdb_sleep_duration;
::_gdb_sleep_duration = 0;
}
Bug 1315138 - gtestify storage/test/*.cpp. r=mak,erahm. This change is mostly straightforward, except for the following. - It removes all the printing from the do_check_* macros because gtest macros do appropriate printing. - test_StatementCache.cpp needs some special gtest magic for the type parameterization. - It merges the four tests in test_unlock_notify.cpp because they rely on being executed in order, and so aren't independent. - storage_test_harness_tail.h is no longer necessary because gtest provides the test looping functionality. - It uses #include and the preprocessor to remove the duplication between test_deadlock_detector.cpp and xpcom/tests/DeadlockDetector.cpp. - It makes the test in test_service_init_background_thread.cpp a death test to force it to be the first storage gtest, because it fails otherwise. - It adds code to undo the SQLite mutex hooking as necessary, so that tests don't interfere with each other. - It de-virtualizes Spinner's destructor (as identified in bug 1318282). --HG-- rename : storage/test/storage_test_harness.h => storage/test/gtest/storage_test_harness.h rename : storage/test/test_AsXXX_helpers.cpp => storage/test/gtest/test_AsXXX_helpers.cpp rename : storage/test/test_StatementCache.cpp => storage/test/gtest/test_StatementCache.cpp rename : storage/test/test_asyncStatementExecution_transaction.cpp => storage/test/gtest/test_asyncStatementExecution_transaction.cpp rename : storage/test/test_async_callbacks_with_spun_event_loops.cpp => storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp rename : storage/test/test_binding_params.cpp => storage/test/gtest/test_binding_params.cpp rename : storage/test/test_deadlock_detector.cpp => storage/test/gtest/test_deadlock_detector.cpp rename : storage/test/test_file_perms.cpp => storage/test/gtest/test_file_perms.cpp rename : storage/test/test_mutex.cpp => storage/test/gtest/test_mutex.cpp rename : storage/test/test_service_init_background_thread.cpp => storage/test/gtest/test_service_init_background_thread.cpp rename : storage/test/test_statement_scoper.cpp => storage/test/gtest/test_statement_scoper.cpp rename : storage/test/test_transaction_helper.cpp => storage/test/gtest/test_transaction_helper.cpp rename : storage/test/test_true_async.cpp => storage/test/gtest/test_true_async.cpp rename : storage/test/test_unlock_notify.cpp => storage/test/gtest/test_unlock_notify.cpp extra : rebase_source : dbb695c112564efa1945116be1a8435988982e74
2016-11-11 01:59:23 +03:00
void TearDown() final { ::_gdb_sleep_duration = mOldSleepDuration; }
private:
unsigned int mOldSleepDuration;
};
Bug 1534878 - xpcom: Make some global functions static. r=erahm clang's -Wmissing-prototypes option identifies global functions that can be made static (because they're only called from one compilation unit) or removed (if they're never called). xpcom/base/Logging.cpp:85:13 [-Wmissing-prototypes] no previous prototype for function 'ToLogStr' xpcom/base/Logging.cpp:132:13 [-Wmissing-prototypes] no previous prototype for function 'ExpandPIDMarker' xpcom/base/LogModulePrefWatcher.cpp:37:6 [-Wmissing-prototypes] no previous prototype for function 'ResetExistingPrefs' xpcom/base/LogModulePrefWatcher.cpp:109:6 [-Wmissing-prototypes] no previous prototype for function 'LoadExistingPrefs' xpcom/base/nsCycleCollector.cpp:212:6 [-Wmissing-prototypes] no previous prototype for function 'SuspectUsingNurseryPurpleBuffer' xpcom/components/nsComponentManager.cpp:421:31 [-Wmissing-prototypes] no previous prototype for function 'begin' xpcom/components/nsComponentManager.cpp:427:31 [-Wmissing-prototypes] no previous prototype for function 'end' xpcom/ds/Dafsa.cpp:23:6 [-Wmissing-prototypes] no previous prototype for function 'GetNextOffset' xpcom/ds/Dafsa.cpp:55:6 [-Wmissing-prototypes] no previous prototype for function 'IsEOL' xpcom/ds/Dafsa.cpp:62:6 [-Wmissing-prototypes] no previous prototype for function 'IsMatch' xpcom/ds/Dafsa.cpp:70:6 [-Wmissing-prototypes] no previous prototype for function 'IsEndCharMatch' xpcom/ds/Dafsa.cpp:78:6 [-Wmissing-prototypes] no previous prototype for function 'GetReturnValue' xpcom/ds/Dafsa.cpp:91:5 [-Wmissing-prototypes] no previous prototype for function 'LookupString' xpcom/io/CocoaFileUtils.mm:195:13 [-Wmissing-prototypes] no previous prototype for function 'GetQuarantinePropKey' xpcom/io/CocoaFileUtils.mm:203:24 [-Wmissing-prototypes] no previous prototype for function 'CreateQuarantineDictionary' xpcom/rust/gtest/bench-collections/Bench.cpp:65:11 [-Wmissing-prototypes] no previous prototype for function 'MyRand' xpcom/rust/gtest/bench-collections/Bench.cpp:85:6 [-Wmissing-prototypes] no previous prototype for function 'Bench_Cpp_unordered_set' xpcom/rust/gtest/bench-collections/Bench.cpp:125:6 [-Wmissing-prototypes] no previous prototype for function 'Bench_Cpp_PLDHashTable' xpcom/rust/gtest/bench-collections/Bench.cpp:166:6 [-Wmissing-prototypes] no previous prototype for function 'Bench_Cpp_MozHashSet' xpcom/tests/gtest/TestAtoms.cpp:114:6 [-Wmissing-prototypes] no previous prototype for function 'isStaticAtom' xpcom/tests/gtest/TestCallTemplates.cpp:72:6 [-Wmissing-prototypes] no previous prototype for function 'JustTestingCompilation' xpcom/tests/gtest/TestCOMPtr.cpp:87:10 [-Wmissing-prototypes] no previous prototype for function 'CreateIFoo' xpcom/tests/gtest/TestCOMPtr.cpp:98:6 [-Wmissing-prototypes] no previous prototype for function 'set_a_IFoo' xpcom/tests/gtest/TestCOMPtr.cpp:105:16 [-Wmissing-prototypes] no previous prototype for function 'return_a_IFoo' xpcom/tests/gtest/TestCOMPtr.cpp:164:10 [-Wmissing-prototypes] no previous prototype for function 'CreateIBar' xpcom/tests/gtest/TestCOMPtr.cpp:175:6 [-Wmissing-prototypes] no previous prototype for function 'AnIFooPtrPtrContext' xpcom/tests/gtest/TestCOMPtr.cpp:177:6 [-Wmissing-prototypes] no previous prototype for function 'AVoidPtrPtrContext' xpcom/tests/gtest/TestCOMPtr.cpp:179:6 [-Wmissing-prototypes] no previous prototype for function 'AnISupportsPtrPtrContext' xpcom/tests/gtest/TestCOMPtr.cpp:263:6 [-Wmissing-prototypes] no previous prototype for function 'Comparison' xpcom/tests/gtest/TestCOMPtr.cpp:298:6 [-Wmissing-prototypes] no previous prototype for function 'DontAddRef' xpcom/tests/gtest/TestCRT.cpp:17:5 [-Wmissing-prototypes] no previous prototype for function 'sign' xpcom/tests/gtest/TestDeadlockDetector.cpp:62:6 [-Wmissing-prototypes] no previous prototype for function 'DisableCrashReporter' xpcom/tests/gtest/TestDeadlockDetector.cpp:74:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:95:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity2_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:159:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity4_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:182:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity5_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:303:5 [-Wmissing-prototypes] no previous prototype for function 'ContentionNoDeadlock_Child' xpcom/tests/gtest/TestHashtables.cpp:88:6 [-Wmissing-prototypes] no previous prototype for function 'testTHashtable' xpcom/tests/gtest/TestHashtables.cpp:205:10 [-Wmissing-prototypes] no previous prototype for function 'CreateIFoo' xpcom/tests/gtest/TestMoveString.cpp:25:6 [-Wmissing-prototypes] no previous prototype for function 'SetAsOwned' xpcom/tests/gtest/TestMoveString.cpp:34:6 [-Wmissing-prototypes] no previous prototype for function 'ExpectTruncated' xpcom/tests/gtest/TestMoveString.cpp:40:6 [-Wmissing-prototypes] no previous prototype for function 'ExpectNew' xpcom/tests/gtest/TestMruCache.cpp:52:11 [-Wmissing-prototypes] no previous prototype for function 'MakeStringKey' xpcom/tests/gtest/TestMultiplexInputStream.cpp:106:34 [-Wmissing-prototypes] no previous prototype for function 'CreateStreamHelper' xpcom/tests/gtest/TestNonBlockingAsyncInputStream.cpp:62:10 [-Wmissing-prototypes] no previous prototype for function 'ReadSegmentsFunction' xpcom/tests/gtest/TestNsDeque.cpp:240:6 [-Wmissing-prototypes] no previous prototype for function 'CheckIfQueueEmpty' xpcom/tests/gtest/TestNsRefPtr.cpp:105:10 [-Wmissing-prototypes] no previous prototype for function 'CreateFoo' xpcom/tests/gtest/TestNsRefPtr.cpp:116:6 [-Wmissing-prototypes] no previous prototype for function 'set_a_Foo' xpcom/tests/gtest/TestNsRefPtr.cpp:123:13 [-Wmissing-prototypes] no previous prototype for function 'return_a_Foo' xpcom/tests/gtest/TestNsRefPtr.cpp:391:6 [-Wmissing-prototypes] no previous prototype for function 'AnFooPtrPtrContext' xpcom/tests/gtest/TestNsRefPtr.cpp:392:6 [-Wmissing-prototypes] no previous prototype for function 'AVoidPtrPtrContext' xpcom/tests/gtest/TestPLDHash.cpp:33:6 [-Wmissing-prototypes] no previous prototype for function 'TestCrashyOperation' xpcom/tests/gtest/TestPipes.cpp:98:10 [-Wmissing-prototypes] no previous prototype for function 'TestPipe' xpcom/tests/gtest/TestPipes.cpp:212:10 [-Wmissing-prototypes] no previous prototype for function 'TestShortWrites' xpcom/tests/gtest/TestPipes.cpp:354:6 [-Wmissing-prototypes] no previous prototype for function 'RunTests' xpcom/tests/gtest/TestPLDHash.cpp:90:6 [-Wmissing-prototypes] no previous prototype for function 'InitCapacityOk_InitialLengthTooBig' xpcom/tests/gtest/TestPLDHash.cpp:95:6 [-Wmissing-prototypes] no previous prototype for function 'InitCapacityOk_InitialEntryStoreTooBig' xpcom/tests/gtest/TestPLDHash.cpp:102:6 [-Wmissing-prototypes] no previous prototype for function 'InitCapacityOk_EntrySizeTooBig' xpcom/tests/gtest/TestSlicedInputStream.cpp:111:20 [-Wmissing-prototypes] no previous prototype for function 'CreateSeekableStreams' xpcom/tests/gtest/TestSlicedInputStream.cpp:125:20 [-Wmissing-prototypes] no previous prototype for function 'CreateNonSeekableStreams' xpcom/tests/gtest/TestStrings.cpp:471:6 [-Wmissing-prototypes] no previous prototype for function 'test_assign_helper' xpcom/tests/gtest/TestTArray.cpp:60:22 [-Wmissing-prototypes] no previous prototype for function 'DummyArray' xpcom/tests/gtest/TestTArray.cpp:72:22 [-Wmissing-prototypes] no previous prototype for function 'FakeHugeArray' xpcom/tests/gtest/TestThrottledEventQueue.cpp:96:6 [-Wmissing-prototypes] no previous prototype for function 'Enqueue' xpcom/threads/BlockingResourceBase.cpp:86:6 [-Wmissing-prototypes] no previous prototype for function 'PrintCycle' xpcom/threads/CPUUsageWatcher.cpp:41:10 [-Wmissing-prototypes] no previous prototype for function 'GetMicroseconds' xpcom/threads/CPUUsageWatcher.cpp:46:10 [-Wmissing-prototypes] no previous prototype for function 'GetMicroseconds' xpcom/threads/CPUUsageWatcher.cpp:51:40 [-Wmissing-prototypes] no previous prototype for function 'GetProcessCPUStats' xpcom/threads/CPUUsageWatcher.cpp:80:40 [-Wmissing-prototypes] no previous prototype for function 'GetGlobalCPUStats' xpcom/threads/nsTimerImpl.cpp:196:21 [-Wmissing-prototypes] no previous prototype for function 'GetTimerFiringsLog' Differential Revision: https://phabricator.services.mozilla.com/D23264 --HG-- extra : rebase_source : e03df033209e0a08fc263603e78bc16a09467f15 extra : source : 3beec9fbfdedf346fff85309029e7805717958ac
2019-02-25 04:35:59 +03:00
static void DisableCrashReporter() {
nsCOMPtr<nsICrashReporter> crashreporter =
do_GetService("@mozilla.org/toolkit/crash-reporter;1");
if (crashreporter) {
crashreporter->SetEnabled(false);
}
}
//-----------------------------------------------------------------------------
// Single-threaded sanity tests
// Stupidest possible deadlock.
Bug 1534878 - xpcom: Make some global functions static. r=erahm clang's -Wmissing-prototypes option identifies global functions that can be made static (because they're only called from one compilation unit) or removed (if they're never called). xpcom/base/Logging.cpp:85:13 [-Wmissing-prototypes] no previous prototype for function 'ToLogStr' xpcom/base/Logging.cpp:132:13 [-Wmissing-prototypes] no previous prototype for function 'ExpandPIDMarker' xpcom/base/LogModulePrefWatcher.cpp:37:6 [-Wmissing-prototypes] no previous prototype for function 'ResetExistingPrefs' xpcom/base/LogModulePrefWatcher.cpp:109:6 [-Wmissing-prototypes] no previous prototype for function 'LoadExistingPrefs' xpcom/base/nsCycleCollector.cpp:212:6 [-Wmissing-prototypes] no previous prototype for function 'SuspectUsingNurseryPurpleBuffer' xpcom/components/nsComponentManager.cpp:421:31 [-Wmissing-prototypes] no previous prototype for function 'begin' xpcom/components/nsComponentManager.cpp:427:31 [-Wmissing-prototypes] no previous prototype for function 'end' xpcom/ds/Dafsa.cpp:23:6 [-Wmissing-prototypes] no previous prototype for function 'GetNextOffset' xpcom/ds/Dafsa.cpp:55:6 [-Wmissing-prototypes] no previous prototype for function 'IsEOL' xpcom/ds/Dafsa.cpp:62:6 [-Wmissing-prototypes] no previous prototype for function 'IsMatch' xpcom/ds/Dafsa.cpp:70:6 [-Wmissing-prototypes] no previous prototype for function 'IsEndCharMatch' xpcom/ds/Dafsa.cpp:78:6 [-Wmissing-prototypes] no previous prototype for function 'GetReturnValue' xpcom/ds/Dafsa.cpp:91:5 [-Wmissing-prototypes] no previous prototype for function 'LookupString' xpcom/io/CocoaFileUtils.mm:195:13 [-Wmissing-prototypes] no previous prototype for function 'GetQuarantinePropKey' xpcom/io/CocoaFileUtils.mm:203:24 [-Wmissing-prototypes] no previous prototype for function 'CreateQuarantineDictionary' xpcom/rust/gtest/bench-collections/Bench.cpp:65:11 [-Wmissing-prototypes] no previous prototype for function 'MyRand' xpcom/rust/gtest/bench-collections/Bench.cpp:85:6 [-Wmissing-prototypes] no previous prototype for function 'Bench_Cpp_unordered_set' xpcom/rust/gtest/bench-collections/Bench.cpp:125:6 [-Wmissing-prototypes] no previous prototype for function 'Bench_Cpp_PLDHashTable' xpcom/rust/gtest/bench-collections/Bench.cpp:166:6 [-Wmissing-prototypes] no previous prototype for function 'Bench_Cpp_MozHashSet' xpcom/tests/gtest/TestAtoms.cpp:114:6 [-Wmissing-prototypes] no previous prototype for function 'isStaticAtom' xpcom/tests/gtest/TestCallTemplates.cpp:72:6 [-Wmissing-prototypes] no previous prototype for function 'JustTestingCompilation' xpcom/tests/gtest/TestCOMPtr.cpp:87:10 [-Wmissing-prototypes] no previous prototype for function 'CreateIFoo' xpcom/tests/gtest/TestCOMPtr.cpp:98:6 [-Wmissing-prototypes] no previous prototype for function 'set_a_IFoo' xpcom/tests/gtest/TestCOMPtr.cpp:105:16 [-Wmissing-prototypes] no previous prototype for function 'return_a_IFoo' xpcom/tests/gtest/TestCOMPtr.cpp:164:10 [-Wmissing-prototypes] no previous prototype for function 'CreateIBar' xpcom/tests/gtest/TestCOMPtr.cpp:175:6 [-Wmissing-prototypes] no previous prototype for function 'AnIFooPtrPtrContext' xpcom/tests/gtest/TestCOMPtr.cpp:177:6 [-Wmissing-prototypes] no previous prototype for function 'AVoidPtrPtrContext' xpcom/tests/gtest/TestCOMPtr.cpp:179:6 [-Wmissing-prototypes] no previous prototype for function 'AnISupportsPtrPtrContext' xpcom/tests/gtest/TestCOMPtr.cpp:263:6 [-Wmissing-prototypes] no previous prototype for function 'Comparison' xpcom/tests/gtest/TestCOMPtr.cpp:298:6 [-Wmissing-prototypes] no previous prototype for function 'DontAddRef' xpcom/tests/gtest/TestCRT.cpp:17:5 [-Wmissing-prototypes] no previous prototype for function 'sign' xpcom/tests/gtest/TestDeadlockDetector.cpp:62:6 [-Wmissing-prototypes] no previous prototype for function 'DisableCrashReporter' xpcom/tests/gtest/TestDeadlockDetector.cpp:74:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:95:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity2_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:159:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity4_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:182:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity5_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:303:5 [-Wmissing-prototypes] no previous prototype for function 'ContentionNoDeadlock_Child' xpcom/tests/gtest/TestHashtables.cpp:88:6 [-Wmissing-prototypes] no previous prototype for function 'testTHashtable' xpcom/tests/gtest/TestHashtables.cpp:205:10 [-Wmissing-prototypes] no previous prototype for function 'CreateIFoo' xpcom/tests/gtest/TestMoveString.cpp:25:6 [-Wmissing-prototypes] no previous prototype for function 'SetAsOwned' xpcom/tests/gtest/TestMoveString.cpp:34:6 [-Wmissing-prototypes] no previous prototype for function 'ExpectTruncated' xpcom/tests/gtest/TestMoveString.cpp:40:6 [-Wmissing-prototypes] no previous prototype for function 'ExpectNew' xpcom/tests/gtest/TestMruCache.cpp:52:11 [-Wmissing-prototypes] no previous prototype for function 'MakeStringKey' xpcom/tests/gtest/TestMultiplexInputStream.cpp:106:34 [-Wmissing-prototypes] no previous prototype for function 'CreateStreamHelper' xpcom/tests/gtest/TestNonBlockingAsyncInputStream.cpp:62:10 [-Wmissing-prototypes] no previous prototype for function 'ReadSegmentsFunction' xpcom/tests/gtest/TestNsDeque.cpp:240:6 [-Wmissing-prototypes] no previous prototype for function 'CheckIfQueueEmpty' xpcom/tests/gtest/TestNsRefPtr.cpp:105:10 [-Wmissing-prototypes] no previous prototype for function 'CreateFoo' xpcom/tests/gtest/TestNsRefPtr.cpp:116:6 [-Wmissing-prototypes] no previous prototype for function 'set_a_Foo' xpcom/tests/gtest/TestNsRefPtr.cpp:123:13 [-Wmissing-prototypes] no previous prototype for function 'return_a_Foo' xpcom/tests/gtest/TestNsRefPtr.cpp:391:6 [-Wmissing-prototypes] no previous prototype for function 'AnFooPtrPtrContext' xpcom/tests/gtest/TestNsRefPtr.cpp:392:6 [-Wmissing-prototypes] no previous prototype for function 'AVoidPtrPtrContext' xpcom/tests/gtest/TestPLDHash.cpp:33:6 [-Wmissing-prototypes] no previous prototype for function 'TestCrashyOperation' xpcom/tests/gtest/TestPipes.cpp:98:10 [-Wmissing-prototypes] no previous prototype for function 'TestPipe' xpcom/tests/gtest/TestPipes.cpp:212:10 [-Wmissing-prototypes] no previous prototype for function 'TestShortWrites' xpcom/tests/gtest/TestPipes.cpp:354:6 [-Wmissing-prototypes] no previous prototype for function 'RunTests' xpcom/tests/gtest/TestPLDHash.cpp:90:6 [-Wmissing-prototypes] no previous prototype for function 'InitCapacityOk_InitialLengthTooBig' xpcom/tests/gtest/TestPLDHash.cpp:95:6 [-Wmissing-prototypes] no previous prototype for function 'InitCapacityOk_InitialEntryStoreTooBig' xpcom/tests/gtest/TestPLDHash.cpp:102:6 [-Wmissing-prototypes] no previous prototype for function 'InitCapacityOk_EntrySizeTooBig' xpcom/tests/gtest/TestSlicedInputStream.cpp:111:20 [-Wmissing-prototypes] no previous prototype for function 'CreateSeekableStreams' xpcom/tests/gtest/TestSlicedInputStream.cpp:125:20 [-Wmissing-prototypes] no previous prototype for function 'CreateNonSeekableStreams' xpcom/tests/gtest/TestStrings.cpp:471:6 [-Wmissing-prototypes] no previous prototype for function 'test_assign_helper' xpcom/tests/gtest/TestTArray.cpp:60:22 [-Wmissing-prototypes] no previous prototype for function 'DummyArray' xpcom/tests/gtest/TestTArray.cpp:72:22 [-Wmissing-prototypes] no previous prototype for function 'FakeHugeArray' xpcom/tests/gtest/TestThrottledEventQueue.cpp:96:6 [-Wmissing-prototypes] no previous prototype for function 'Enqueue' xpcom/threads/BlockingResourceBase.cpp:86:6 [-Wmissing-prototypes] no previous prototype for function 'PrintCycle' xpcom/threads/CPUUsageWatcher.cpp:41:10 [-Wmissing-prototypes] no previous prototype for function 'GetMicroseconds' xpcom/threads/CPUUsageWatcher.cpp:46:10 [-Wmissing-prototypes] no previous prototype for function 'GetMicroseconds' xpcom/threads/CPUUsageWatcher.cpp:51:40 [-Wmissing-prototypes] no previous prototype for function 'GetProcessCPUStats' xpcom/threads/CPUUsageWatcher.cpp:80:40 [-Wmissing-prototypes] no previous prototype for function 'GetGlobalCPUStats' xpcom/threads/nsTimerImpl.cpp:196:21 [-Wmissing-prototypes] no previous prototype for function 'GetTimerFiringsLog' Differential Revision: https://phabricator.services.mozilla.com/D23264 --HG-- extra : rebase_source : e03df033209e0a08fc263603e78bc16a09467f15 extra : source : 3beec9fbfdedf346fff85309029e7805717958ac
2019-02-25 04:35:59 +03:00
static int Sanity_Child() {
DisableCrashReporter();
Bug 1315138 - gtestify storage/test/*.cpp. r=mak,erahm. This change is mostly straightforward, except for the following. - It removes all the printing from the do_check_* macros because gtest macros do appropriate printing. - test_StatementCache.cpp needs some special gtest magic for the type parameterization. - It merges the four tests in test_unlock_notify.cpp because they rely on being executed in order, and so aren't independent. - storage_test_harness_tail.h is no longer necessary because gtest provides the test looping functionality. - It uses #include and the preprocessor to remove the duplication between test_deadlock_detector.cpp and xpcom/tests/DeadlockDetector.cpp. - It makes the test in test_service_init_background_thread.cpp a death test to force it to be the first storage gtest, because it fails otherwise. - It adds code to undo the SQLite mutex hooking as necessary, so that tests don't interfere with each other. - It de-virtualizes Spinner's destructor (as identified in bug 1318282). --HG-- rename : storage/test/storage_test_harness.h => storage/test/gtest/storage_test_harness.h rename : storage/test/test_AsXXX_helpers.cpp => storage/test/gtest/test_AsXXX_helpers.cpp rename : storage/test/test_StatementCache.cpp => storage/test/gtest/test_StatementCache.cpp rename : storage/test/test_asyncStatementExecution_transaction.cpp => storage/test/gtest/test_asyncStatementExecution_transaction.cpp rename : storage/test/test_async_callbacks_with_spun_event_loops.cpp => storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp rename : storage/test/test_binding_params.cpp => storage/test/gtest/test_binding_params.cpp rename : storage/test/test_deadlock_detector.cpp => storage/test/gtest/test_deadlock_detector.cpp rename : storage/test/test_file_perms.cpp => storage/test/gtest/test_file_perms.cpp rename : storage/test/test_mutex.cpp => storage/test/gtest/test_mutex.cpp rename : storage/test/test_service_init_background_thread.cpp => storage/test/gtest/test_service_init_background_thread.cpp rename : storage/test/test_statement_scoper.cpp => storage/test/gtest/test_statement_scoper.cpp rename : storage/test/test_transaction_helper.cpp => storage/test/gtest/test_transaction_helper.cpp rename : storage/test/test_true_async.cpp => storage/test/gtest/test_true_async.cpp rename : storage/test/test_unlock_notify.cpp => storage/test/gtest/test_unlock_notify.cpp extra : rebase_source : dbb695c112564efa1945116be1a8435988982e74
2016-11-11 01:59:23 +03:00
MUTEX m1("dd.sanity.m1");
m1.Lock();
m1.Lock();
return 0; // not reached
}
Bug 1315138 - gtestify storage/test/*.cpp. r=mak,erahm. This change is mostly straightforward, except for the following. - It removes all the printing from the do_check_* macros because gtest macros do appropriate printing. - test_StatementCache.cpp needs some special gtest magic for the type parameterization. - It merges the four tests in test_unlock_notify.cpp because they rely on being executed in order, and so aren't independent. - storage_test_harness_tail.h is no longer necessary because gtest provides the test looping functionality. - It uses #include and the preprocessor to remove the duplication between test_deadlock_detector.cpp and xpcom/tests/DeadlockDetector.cpp. - It makes the test in test_service_init_background_thread.cpp a death test to force it to be the first storage gtest, because it fails otherwise. - It adds code to undo the SQLite mutex hooking as necessary, so that tests don't interfere with each other. - It de-virtualizes Spinner's destructor (as identified in bug 1318282). --HG-- rename : storage/test/storage_test_harness.h => storage/test/gtest/storage_test_harness.h rename : storage/test/test_AsXXX_helpers.cpp => storage/test/gtest/test_AsXXX_helpers.cpp rename : storage/test/test_StatementCache.cpp => storage/test/gtest/test_StatementCache.cpp rename : storage/test/test_asyncStatementExecution_transaction.cpp => storage/test/gtest/test_asyncStatementExecution_transaction.cpp rename : storage/test/test_async_callbacks_with_spun_event_loops.cpp => storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp rename : storage/test/test_binding_params.cpp => storage/test/gtest/test_binding_params.cpp rename : storage/test/test_deadlock_detector.cpp => storage/test/gtest/test_deadlock_detector.cpp rename : storage/test/test_file_perms.cpp => storage/test/gtest/test_file_perms.cpp rename : storage/test/test_mutex.cpp => storage/test/gtest/test_mutex.cpp rename : storage/test/test_service_init_background_thread.cpp => storage/test/gtest/test_service_init_background_thread.cpp rename : storage/test/test_statement_scoper.cpp => storage/test/gtest/test_statement_scoper.cpp rename : storage/test/test_transaction_helper.cpp => storage/test/gtest/test_transaction_helper.cpp rename : storage/test/test_true_async.cpp => storage/test/gtest/test_true_async.cpp rename : storage/test/test_unlock_notify.cpp => storage/test/gtest/test_unlock_notify.cpp extra : rebase_source : dbb695c112564efa1945116be1a8435988982e74
2016-11-11 01:59:23 +03:00
TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(SanityDeathTest)) {
const char* const regex =
"###!!! ERROR: Potential deadlock detected.*"
"=== Cyclical dependency starts at.*--- Mutex : dd.sanity.m1.*"
"=== Cycle completed at.*--- Mutex : dd.sanity.m1.*"
"###!!! Deadlock may happen NOW!.*" // better catch these easy cases...
"###!!! ASSERTION: Potential deadlock detected.*";
ASSERT_DEATH_IF_SUPPORTED(Sanity_Child(), regex);
}
// Slightly less stupid deadlock.
Bug 1534878 - xpcom: Make some global functions static. r=erahm clang's -Wmissing-prototypes option identifies global functions that can be made static (because they're only called from one compilation unit) or removed (if they're never called). xpcom/base/Logging.cpp:85:13 [-Wmissing-prototypes] no previous prototype for function 'ToLogStr' xpcom/base/Logging.cpp:132:13 [-Wmissing-prototypes] no previous prototype for function 'ExpandPIDMarker' xpcom/base/LogModulePrefWatcher.cpp:37:6 [-Wmissing-prototypes] no previous prototype for function 'ResetExistingPrefs' xpcom/base/LogModulePrefWatcher.cpp:109:6 [-Wmissing-prototypes] no previous prototype for function 'LoadExistingPrefs' xpcom/base/nsCycleCollector.cpp:212:6 [-Wmissing-prototypes] no previous prototype for function 'SuspectUsingNurseryPurpleBuffer' xpcom/components/nsComponentManager.cpp:421:31 [-Wmissing-prototypes] no previous prototype for function 'begin' xpcom/components/nsComponentManager.cpp:427:31 [-Wmissing-prototypes] no previous prototype for function 'end' xpcom/ds/Dafsa.cpp:23:6 [-Wmissing-prototypes] no previous prototype for function 'GetNextOffset' xpcom/ds/Dafsa.cpp:55:6 [-Wmissing-prototypes] no previous prototype for function 'IsEOL' xpcom/ds/Dafsa.cpp:62:6 [-Wmissing-prototypes] no previous prototype for function 'IsMatch' xpcom/ds/Dafsa.cpp:70:6 [-Wmissing-prototypes] no previous prototype for function 'IsEndCharMatch' xpcom/ds/Dafsa.cpp:78:6 [-Wmissing-prototypes] no previous prototype for function 'GetReturnValue' xpcom/ds/Dafsa.cpp:91:5 [-Wmissing-prototypes] no previous prototype for function 'LookupString' xpcom/io/CocoaFileUtils.mm:195:13 [-Wmissing-prototypes] no previous prototype for function 'GetQuarantinePropKey' xpcom/io/CocoaFileUtils.mm:203:24 [-Wmissing-prototypes] no previous prototype for function 'CreateQuarantineDictionary' xpcom/rust/gtest/bench-collections/Bench.cpp:65:11 [-Wmissing-prototypes] no previous prototype for function 'MyRand' xpcom/rust/gtest/bench-collections/Bench.cpp:85:6 [-Wmissing-prototypes] no previous prototype for function 'Bench_Cpp_unordered_set' xpcom/rust/gtest/bench-collections/Bench.cpp:125:6 [-Wmissing-prototypes] no previous prototype for function 'Bench_Cpp_PLDHashTable' xpcom/rust/gtest/bench-collections/Bench.cpp:166:6 [-Wmissing-prototypes] no previous prototype for function 'Bench_Cpp_MozHashSet' xpcom/tests/gtest/TestAtoms.cpp:114:6 [-Wmissing-prototypes] no previous prototype for function 'isStaticAtom' xpcom/tests/gtest/TestCallTemplates.cpp:72:6 [-Wmissing-prototypes] no previous prototype for function 'JustTestingCompilation' xpcom/tests/gtest/TestCOMPtr.cpp:87:10 [-Wmissing-prototypes] no previous prototype for function 'CreateIFoo' xpcom/tests/gtest/TestCOMPtr.cpp:98:6 [-Wmissing-prototypes] no previous prototype for function 'set_a_IFoo' xpcom/tests/gtest/TestCOMPtr.cpp:105:16 [-Wmissing-prototypes] no previous prototype for function 'return_a_IFoo' xpcom/tests/gtest/TestCOMPtr.cpp:164:10 [-Wmissing-prototypes] no previous prototype for function 'CreateIBar' xpcom/tests/gtest/TestCOMPtr.cpp:175:6 [-Wmissing-prototypes] no previous prototype for function 'AnIFooPtrPtrContext' xpcom/tests/gtest/TestCOMPtr.cpp:177:6 [-Wmissing-prototypes] no previous prototype for function 'AVoidPtrPtrContext' xpcom/tests/gtest/TestCOMPtr.cpp:179:6 [-Wmissing-prototypes] no previous prototype for function 'AnISupportsPtrPtrContext' xpcom/tests/gtest/TestCOMPtr.cpp:263:6 [-Wmissing-prototypes] no previous prototype for function 'Comparison' xpcom/tests/gtest/TestCOMPtr.cpp:298:6 [-Wmissing-prototypes] no previous prototype for function 'DontAddRef' xpcom/tests/gtest/TestCRT.cpp:17:5 [-Wmissing-prototypes] no previous prototype for function 'sign' xpcom/tests/gtest/TestDeadlockDetector.cpp:62:6 [-Wmissing-prototypes] no previous prototype for function 'DisableCrashReporter' xpcom/tests/gtest/TestDeadlockDetector.cpp:74:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:95:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity2_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:159:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity4_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:182:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity5_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:303:5 [-Wmissing-prototypes] no previous prototype for function 'ContentionNoDeadlock_Child' xpcom/tests/gtest/TestHashtables.cpp:88:6 [-Wmissing-prototypes] no previous prototype for function 'testTHashtable' xpcom/tests/gtest/TestHashtables.cpp:205:10 [-Wmissing-prototypes] no previous prototype for function 'CreateIFoo' xpcom/tests/gtest/TestMoveString.cpp:25:6 [-Wmissing-prototypes] no previous prototype for function 'SetAsOwned' xpcom/tests/gtest/TestMoveString.cpp:34:6 [-Wmissing-prototypes] no previous prototype for function 'ExpectTruncated' xpcom/tests/gtest/TestMoveString.cpp:40:6 [-Wmissing-prototypes] no previous prototype for function 'ExpectNew' xpcom/tests/gtest/TestMruCache.cpp:52:11 [-Wmissing-prototypes] no previous prototype for function 'MakeStringKey' xpcom/tests/gtest/TestMultiplexInputStream.cpp:106:34 [-Wmissing-prototypes] no previous prototype for function 'CreateStreamHelper' xpcom/tests/gtest/TestNonBlockingAsyncInputStream.cpp:62:10 [-Wmissing-prototypes] no previous prototype for function 'ReadSegmentsFunction' xpcom/tests/gtest/TestNsDeque.cpp:240:6 [-Wmissing-prototypes] no previous prototype for function 'CheckIfQueueEmpty' xpcom/tests/gtest/TestNsRefPtr.cpp:105:10 [-Wmissing-prototypes] no previous prototype for function 'CreateFoo' xpcom/tests/gtest/TestNsRefPtr.cpp:116:6 [-Wmissing-prototypes] no previous prototype for function 'set_a_Foo' xpcom/tests/gtest/TestNsRefPtr.cpp:123:13 [-Wmissing-prototypes] no previous prototype for function 'return_a_Foo' xpcom/tests/gtest/TestNsRefPtr.cpp:391:6 [-Wmissing-prototypes] no previous prototype for function 'AnFooPtrPtrContext' xpcom/tests/gtest/TestNsRefPtr.cpp:392:6 [-Wmissing-prototypes] no previous prototype for function 'AVoidPtrPtrContext' xpcom/tests/gtest/TestPLDHash.cpp:33:6 [-Wmissing-prototypes] no previous prototype for function 'TestCrashyOperation' xpcom/tests/gtest/TestPipes.cpp:98:10 [-Wmissing-prototypes] no previous prototype for function 'TestPipe' xpcom/tests/gtest/TestPipes.cpp:212:10 [-Wmissing-prototypes] no previous prototype for function 'TestShortWrites' xpcom/tests/gtest/TestPipes.cpp:354:6 [-Wmissing-prototypes] no previous prototype for function 'RunTests' xpcom/tests/gtest/TestPLDHash.cpp:90:6 [-Wmissing-prototypes] no previous prototype for function 'InitCapacityOk_InitialLengthTooBig' xpcom/tests/gtest/TestPLDHash.cpp:95:6 [-Wmissing-prototypes] no previous prototype for function 'InitCapacityOk_InitialEntryStoreTooBig' xpcom/tests/gtest/TestPLDHash.cpp:102:6 [-Wmissing-prototypes] no previous prototype for function 'InitCapacityOk_EntrySizeTooBig' xpcom/tests/gtest/TestSlicedInputStream.cpp:111:20 [-Wmissing-prototypes] no previous prototype for function 'CreateSeekableStreams' xpcom/tests/gtest/TestSlicedInputStream.cpp:125:20 [-Wmissing-prototypes] no previous prototype for function 'CreateNonSeekableStreams' xpcom/tests/gtest/TestStrings.cpp:471:6 [-Wmissing-prototypes] no previous prototype for function 'test_assign_helper' xpcom/tests/gtest/TestTArray.cpp:60:22 [-Wmissing-prototypes] no previous prototype for function 'DummyArray' xpcom/tests/gtest/TestTArray.cpp:72:22 [-Wmissing-prototypes] no previous prototype for function 'FakeHugeArray' xpcom/tests/gtest/TestThrottledEventQueue.cpp:96:6 [-Wmissing-prototypes] no previous prototype for function 'Enqueue' xpcom/threads/BlockingResourceBase.cpp:86:6 [-Wmissing-prototypes] no previous prototype for function 'PrintCycle' xpcom/threads/CPUUsageWatcher.cpp:41:10 [-Wmissing-prototypes] no previous prototype for function 'GetMicroseconds' xpcom/threads/CPUUsageWatcher.cpp:46:10 [-Wmissing-prototypes] no previous prototype for function 'GetMicroseconds' xpcom/threads/CPUUsageWatcher.cpp:51:40 [-Wmissing-prototypes] no previous prototype for function 'GetProcessCPUStats' xpcom/threads/CPUUsageWatcher.cpp:80:40 [-Wmissing-prototypes] no previous prototype for function 'GetGlobalCPUStats' xpcom/threads/nsTimerImpl.cpp:196:21 [-Wmissing-prototypes] no previous prototype for function 'GetTimerFiringsLog' Differential Revision: https://phabricator.services.mozilla.com/D23264 --HG-- extra : rebase_source : e03df033209e0a08fc263603e78bc16a09467f15 extra : source : 3beec9fbfdedf346fff85309029e7805717958ac
2019-02-25 04:35:59 +03:00
static int Sanity2_Child() {
DisableCrashReporter();
Bug 1315138 - gtestify storage/test/*.cpp. r=mak,erahm. This change is mostly straightforward, except for the following. - It removes all the printing from the do_check_* macros because gtest macros do appropriate printing. - test_StatementCache.cpp needs some special gtest magic for the type parameterization. - It merges the four tests in test_unlock_notify.cpp because they rely on being executed in order, and so aren't independent. - storage_test_harness_tail.h is no longer necessary because gtest provides the test looping functionality. - It uses #include and the preprocessor to remove the duplication between test_deadlock_detector.cpp and xpcom/tests/DeadlockDetector.cpp. - It makes the test in test_service_init_background_thread.cpp a death test to force it to be the first storage gtest, because it fails otherwise. - It adds code to undo the SQLite mutex hooking as necessary, so that tests don't interfere with each other. - It de-virtualizes Spinner's destructor (as identified in bug 1318282). --HG-- rename : storage/test/storage_test_harness.h => storage/test/gtest/storage_test_harness.h rename : storage/test/test_AsXXX_helpers.cpp => storage/test/gtest/test_AsXXX_helpers.cpp rename : storage/test/test_StatementCache.cpp => storage/test/gtest/test_StatementCache.cpp rename : storage/test/test_asyncStatementExecution_transaction.cpp => storage/test/gtest/test_asyncStatementExecution_transaction.cpp rename : storage/test/test_async_callbacks_with_spun_event_loops.cpp => storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp rename : storage/test/test_binding_params.cpp => storage/test/gtest/test_binding_params.cpp rename : storage/test/test_deadlock_detector.cpp => storage/test/gtest/test_deadlock_detector.cpp rename : storage/test/test_file_perms.cpp => storage/test/gtest/test_file_perms.cpp rename : storage/test/test_mutex.cpp => storage/test/gtest/test_mutex.cpp rename : storage/test/test_service_init_background_thread.cpp => storage/test/gtest/test_service_init_background_thread.cpp rename : storage/test/test_statement_scoper.cpp => storage/test/gtest/test_statement_scoper.cpp rename : storage/test/test_transaction_helper.cpp => storage/test/gtest/test_transaction_helper.cpp rename : storage/test/test_true_async.cpp => storage/test/gtest/test_true_async.cpp rename : storage/test/test_unlock_notify.cpp => storage/test/gtest/test_unlock_notify.cpp extra : rebase_source : dbb695c112564efa1945116be1a8435988982e74
2016-11-11 01:59:23 +03:00
MUTEX m1("dd.sanity2.m1");
MUTEX m2("dd.sanity2.m2");
m1.Lock();
m2.Lock();
m1.Lock();
return 0; // not reached
}
Bug 1315138 - gtestify storage/test/*.cpp. r=mak,erahm. This change is mostly straightforward, except for the following. - It removes all the printing from the do_check_* macros because gtest macros do appropriate printing. - test_StatementCache.cpp needs some special gtest magic for the type parameterization. - It merges the four tests in test_unlock_notify.cpp because they rely on being executed in order, and so aren't independent. - storage_test_harness_tail.h is no longer necessary because gtest provides the test looping functionality. - It uses #include and the preprocessor to remove the duplication between test_deadlock_detector.cpp and xpcom/tests/DeadlockDetector.cpp. - It makes the test in test_service_init_background_thread.cpp a death test to force it to be the first storage gtest, because it fails otherwise. - It adds code to undo the SQLite mutex hooking as necessary, so that tests don't interfere with each other. - It de-virtualizes Spinner's destructor (as identified in bug 1318282). --HG-- rename : storage/test/storage_test_harness.h => storage/test/gtest/storage_test_harness.h rename : storage/test/test_AsXXX_helpers.cpp => storage/test/gtest/test_AsXXX_helpers.cpp rename : storage/test/test_StatementCache.cpp => storage/test/gtest/test_StatementCache.cpp rename : storage/test/test_asyncStatementExecution_transaction.cpp => storage/test/gtest/test_asyncStatementExecution_transaction.cpp rename : storage/test/test_async_callbacks_with_spun_event_loops.cpp => storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp rename : storage/test/test_binding_params.cpp => storage/test/gtest/test_binding_params.cpp rename : storage/test/test_deadlock_detector.cpp => storage/test/gtest/test_deadlock_detector.cpp rename : storage/test/test_file_perms.cpp => storage/test/gtest/test_file_perms.cpp rename : storage/test/test_mutex.cpp => storage/test/gtest/test_mutex.cpp rename : storage/test/test_service_init_background_thread.cpp => storage/test/gtest/test_service_init_background_thread.cpp rename : storage/test/test_statement_scoper.cpp => storage/test/gtest/test_statement_scoper.cpp rename : storage/test/test_transaction_helper.cpp => storage/test/gtest/test_transaction_helper.cpp rename : storage/test/test_true_async.cpp => storage/test/gtest/test_true_async.cpp rename : storage/test/test_unlock_notify.cpp => storage/test/gtest/test_unlock_notify.cpp extra : rebase_source : dbb695c112564efa1945116be1a8435988982e74
2016-11-11 01:59:23 +03:00
TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(Sanity2DeathTest)) {
const char* const regex =
"###!!! ERROR: Potential deadlock detected.*"
"=== Cyclical dependency starts at.*--- Mutex : dd.sanity2.m1.*"
"--- Next dependency:.*--- Mutex : dd.sanity2.m2.*"
"=== Cycle completed at.*--- Mutex : dd.sanity2.m1.*"
"###!!! Deadlock may happen NOW!.*" // better catch these easy cases...
"###!!! ASSERTION: Potential deadlock detected.*";
ASSERT_DEATH_IF_SUPPORTED(Sanity2_Child(), regex);
}
#if 0
// Temporarily disabled, see bug 1370644.
int
Sanity3_Child()
{
DisableCrashReporter();
Bug 1315138 - gtestify storage/test/*.cpp. r=mak,erahm. This change is mostly straightforward, except for the following. - It removes all the printing from the do_check_* macros because gtest macros do appropriate printing. - test_StatementCache.cpp needs some special gtest magic for the type parameterization. - It merges the four tests in test_unlock_notify.cpp because they rely on being executed in order, and so aren't independent. - storage_test_harness_tail.h is no longer necessary because gtest provides the test looping functionality. - It uses #include and the preprocessor to remove the duplication between test_deadlock_detector.cpp and xpcom/tests/DeadlockDetector.cpp. - It makes the test in test_service_init_background_thread.cpp a death test to force it to be the first storage gtest, because it fails otherwise. - It adds code to undo the SQLite mutex hooking as necessary, so that tests don't interfere with each other. - It de-virtualizes Spinner's destructor (as identified in bug 1318282). --HG-- rename : storage/test/storage_test_harness.h => storage/test/gtest/storage_test_harness.h rename : storage/test/test_AsXXX_helpers.cpp => storage/test/gtest/test_AsXXX_helpers.cpp rename : storage/test/test_StatementCache.cpp => storage/test/gtest/test_StatementCache.cpp rename : storage/test/test_asyncStatementExecution_transaction.cpp => storage/test/gtest/test_asyncStatementExecution_transaction.cpp rename : storage/test/test_async_callbacks_with_spun_event_loops.cpp => storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp rename : storage/test/test_binding_params.cpp => storage/test/gtest/test_binding_params.cpp rename : storage/test/test_deadlock_detector.cpp => storage/test/gtest/test_deadlock_detector.cpp rename : storage/test/test_file_perms.cpp => storage/test/gtest/test_file_perms.cpp rename : storage/test/test_mutex.cpp => storage/test/gtest/test_mutex.cpp rename : storage/test/test_service_init_background_thread.cpp => storage/test/gtest/test_service_init_background_thread.cpp rename : storage/test/test_statement_scoper.cpp => storage/test/gtest/test_statement_scoper.cpp rename : storage/test/test_transaction_helper.cpp => storage/test/gtest/test_transaction_helper.cpp rename : storage/test/test_true_async.cpp => storage/test/gtest/test_true_async.cpp rename : storage/test/test_unlock_notify.cpp => storage/test/gtest/test_unlock_notify.cpp extra : rebase_source : dbb695c112564efa1945116be1a8435988982e74
2016-11-11 01:59:23 +03:00
MUTEX m1("dd.sanity3.m1");
MUTEX m2("dd.sanity3.m2");
MUTEX m3("dd.sanity3.m3");
MUTEX m4("dd.sanity3.m4");
m1.Lock();
m2.Lock();
m3.Lock();
m4.Lock();
m4.Unlock();
m3.Unlock();
m2.Unlock();
m1.Unlock();
m4.Lock();
m1.Lock();
return 0;
}
Bug 1315138 - gtestify storage/test/*.cpp. r=mak,erahm. This change is mostly straightforward, except for the following. - It removes all the printing from the do_check_* macros because gtest macros do appropriate printing. - test_StatementCache.cpp needs some special gtest magic for the type parameterization. - It merges the four tests in test_unlock_notify.cpp because they rely on being executed in order, and so aren't independent. - storage_test_harness_tail.h is no longer necessary because gtest provides the test looping functionality. - It uses #include and the preprocessor to remove the duplication between test_deadlock_detector.cpp and xpcom/tests/DeadlockDetector.cpp. - It makes the test in test_service_init_background_thread.cpp a death test to force it to be the first storage gtest, because it fails otherwise. - It adds code to undo the SQLite mutex hooking as necessary, so that tests don't interfere with each other. - It de-virtualizes Spinner's destructor (as identified in bug 1318282). --HG-- rename : storage/test/storage_test_harness.h => storage/test/gtest/storage_test_harness.h rename : storage/test/test_AsXXX_helpers.cpp => storage/test/gtest/test_AsXXX_helpers.cpp rename : storage/test/test_StatementCache.cpp => storage/test/gtest/test_StatementCache.cpp rename : storage/test/test_asyncStatementExecution_transaction.cpp => storage/test/gtest/test_asyncStatementExecution_transaction.cpp rename : storage/test/test_async_callbacks_with_spun_event_loops.cpp => storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp rename : storage/test/test_binding_params.cpp => storage/test/gtest/test_binding_params.cpp rename : storage/test/test_deadlock_detector.cpp => storage/test/gtest/test_deadlock_detector.cpp rename : storage/test/test_file_perms.cpp => storage/test/gtest/test_file_perms.cpp rename : storage/test/test_mutex.cpp => storage/test/gtest/test_mutex.cpp rename : storage/test/test_service_init_background_thread.cpp => storage/test/gtest/test_service_init_background_thread.cpp rename : storage/test/test_statement_scoper.cpp => storage/test/gtest/test_statement_scoper.cpp rename : storage/test/test_transaction_helper.cpp => storage/test/gtest/test_transaction_helper.cpp rename : storage/test/test_true_async.cpp => storage/test/gtest/test_true_async.cpp rename : storage/test/test_unlock_notify.cpp => storage/test/gtest/test_unlock_notify.cpp extra : rebase_source : dbb695c112564efa1945116be1a8435988982e74
2016-11-11 01:59:23 +03:00
TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(Sanity3DeathTest))
{
const char* const regex =
"###!!! ERROR: Potential deadlock detected.*"
"=== Cyclical dependency starts at.*--- Mutex : dd.sanity3.m1.*"
"--- Next dependency:.*--- Mutex : dd.sanity3.m2.*"
"--- Next dependency:.*--- Mutex : dd.sanity3.m3.*"
"--- Next dependency:.*--- Mutex : dd.sanity3.m4.*"
"=== Cycle completed at.*--- Mutex : dd.sanity3.m1.*"
"###!!! ASSERTION: Potential deadlock detected.*";
ASSERT_DEATH_IF_SUPPORTED(Sanity3_Child(), regex);
}
#endif
Bug 1534878 - xpcom: Make some global functions static. r=erahm clang's -Wmissing-prototypes option identifies global functions that can be made static (because they're only called from one compilation unit) or removed (if they're never called). xpcom/base/Logging.cpp:85:13 [-Wmissing-prototypes] no previous prototype for function 'ToLogStr' xpcom/base/Logging.cpp:132:13 [-Wmissing-prototypes] no previous prototype for function 'ExpandPIDMarker' xpcom/base/LogModulePrefWatcher.cpp:37:6 [-Wmissing-prototypes] no previous prototype for function 'ResetExistingPrefs' xpcom/base/LogModulePrefWatcher.cpp:109:6 [-Wmissing-prototypes] no previous prototype for function 'LoadExistingPrefs' xpcom/base/nsCycleCollector.cpp:212:6 [-Wmissing-prototypes] no previous prototype for function 'SuspectUsingNurseryPurpleBuffer' xpcom/components/nsComponentManager.cpp:421:31 [-Wmissing-prototypes] no previous prototype for function 'begin' xpcom/components/nsComponentManager.cpp:427:31 [-Wmissing-prototypes] no previous prototype for function 'end' xpcom/ds/Dafsa.cpp:23:6 [-Wmissing-prototypes] no previous prototype for function 'GetNextOffset' xpcom/ds/Dafsa.cpp:55:6 [-Wmissing-prototypes] no previous prototype for function 'IsEOL' xpcom/ds/Dafsa.cpp:62:6 [-Wmissing-prototypes] no previous prototype for function 'IsMatch' xpcom/ds/Dafsa.cpp:70:6 [-Wmissing-prototypes] no previous prototype for function 'IsEndCharMatch' xpcom/ds/Dafsa.cpp:78:6 [-Wmissing-prototypes] no previous prototype for function 'GetReturnValue' xpcom/ds/Dafsa.cpp:91:5 [-Wmissing-prototypes] no previous prototype for function 'LookupString' xpcom/io/CocoaFileUtils.mm:195:13 [-Wmissing-prototypes] no previous prototype for function 'GetQuarantinePropKey' xpcom/io/CocoaFileUtils.mm:203:24 [-Wmissing-prototypes] no previous prototype for function 'CreateQuarantineDictionary' xpcom/rust/gtest/bench-collections/Bench.cpp:65:11 [-Wmissing-prototypes] no previous prototype for function 'MyRand' xpcom/rust/gtest/bench-collections/Bench.cpp:85:6 [-Wmissing-prototypes] no previous prototype for function 'Bench_Cpp_unordered_set' xpcom/rust/gtest/bench-collections/Bench.cpp:125:6 [-Wmissing-prototypes] no previous prototype for function 'Bench_Cpp_PLDHashTable' xpcom/rust/gtest/bench-collections/Bench.cpp:166:6 [-Wmissing-prototypes] no previous prototype for function 'Bench_Cpp_MozHashSet' xpcom/tests/gtest/TestAtoms.cpp:114:6 [-Wmissing-prototypes] no previous prototype for function 'isStaticAtom' xpcom/tests/gtest/TestCallTemplates.cpp:72:6 [-Wmissing-prototypes] no previous prototype for function 'JustTestingCompilation' xpcom/tests/gtest/TestCOMPtr.cpp:87:10 [-Wmissing-prototypes] no previous prototype for function 'CreateIFoo' xpcom/tests/gtest/TestCOMPtr.cpp:98:6 [-Wmissing-prototypes] no previous prototype for function 'set_a_IFoo' xpcom/tests/gtest/TestCOMPtr.cpp:105:16 [-Wmissing-prototypes] no previous prototype for function 'return_a_IFoo' xpcom/tests/gtest/TestCOMPtr.cpp:164:10 [-Wmissing-prototypes] no previous prototype for function 'CreateIBar' xpcom/tests/gtest/TestCOMPtr.cpp:175:6 [-Wmissing-prototypes] no previous prototype for function 'AnIFooPtrPtrContext' xpcom/tests/gtest/TestCOMPtr.cpp:177:6 [-Wmissing-prototypes] no previous prototype for function 'AVoidPtrPtrContext' xpcom/tests/gtest/TestCOMPtr.cpp:179:6 [-Wmissing-prototypes] no previous prototype for function 'AnISupportsPtrPtrContext' xpcom/tests/gtest/TestCOMPtr.cpp:263:6 [-Wmissing-prototypes] no previous prototype for function 'Comparison' xpcom/tests/gtest/TestCOMPtr.cpp:298:6 [-Wmissing-prototypes] no previous prototype for function 'DontAddRef' xpcom/tests/gtest/TestCRT.cpp:17:5 [-Wmissing-prototypes] no previous prototype for function 'sign' xpcom/tests/gtest/TestDeadlockDetector.cpp:62:6 [-Wmissing-prototypes] no previous prototype for function 'DisableCrashReporter' xpcom/tests/gtest/TestDeadlockDetector.cpp:74:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:95:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity2_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:159:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity4_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:182:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity5_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:303:5 [-Wmissing-prototypes] no previous prototype for function 'ContentionNoDeadlock_Child' xpcom/tests/gtest/TestHashtables.cpp:88:6 [-Wmissing-prototypes] no previous prototype for function 'testTHashtable' xpcom/tests/gtest/TestHashtables.cpp:205:10 [-Wmissing-prototypes] no previous prototype for function 'CreateIFoo' xpcom/tests/gtest/TestMoveString.cpp:25:6 [-Wmissing-prototypes] no previous prototype for function 'SetAsOwned' xpcom/tests/gtest/TestMoveString.cpp:34:6 [-Wmissing-prototypes] no previous prototype for function 'ExpectTruncated' xpcom/tests/gtest/TestMoveString.cpp:40:6 [-Wmissing-prototypes] no previous prototype for function 'ExpectNew' xpcom/tests/gtest/TestMruCache.cpp:52:11 [-Wmissing-prototypes] no previous prototype for function 'MakeStringKey' xpcom/tests/gtest/TestMultiplexInputStream.cpp:106:34 [-Wmissing-prototypes] no previous prototype for function 'CreateStreamHelper' xpcom/tests/gtest/TestNonBlockingAsyncInputStream.cpp:62:10 [-Wmissing-prototypes] no previous prototype for function 'ReadSegmentsFunction' xpcom/tests/gtest/TestNsDeque.cpp:240:6 [-Wmissing-prototypes] no previous prototype for function 'CheckIfQueueEmpty' xpcom/tests/gtest/TestNsRefPtr.cpp:105:10 [-Wmissing-prototypes] no previous prototype for function 'CreateFoo' xpcom/tests/gtest/TestNsRefPtr.cpp:116:6 [-Wmissing-prototypes] no previous prototype for function 'set_a_Foo' xpcom/tests/gtest/TestNsRefPtr.cpp:123:13 [-Wmissing-prototypes] no previous prototype for function 'return_a_Foo' xpcom/tests/gtest/TestNsRefPtr.cpp:391:6 [-Wmissing-prototypes] no previous prototype for function 'AnFooPtrPtrContext' xpcom/tests/gtest/TestNsRefPtr.cpp:392:6 [-Wmissing-prototypes] no previous prototype for function 'AVoidPtrPtrContext' xpcom/tests/gtest/TestPLDHash.cpp:33:6 [-Wmissing-prototypes] no previous prototype for function 'TestCrashyOperation' xpcom/tests/gtest/TestPipes.cpp:98:10 [-Wmissing-prototypes] no previous prototype for function 'TestPipe' xpcom/tests/gtest/TestPipes.cpp:212:10 [-Wmissing-prototypes] no previous prototype for function 'TestShortWrites' xpcom/tests/gtest/TestPipes.cpp:354:6 [-Wmissing-prototypes] no previous prototype for function 'RunTests' xpcom/tests/gtest/TestPLDHash.cpp:90:6 [-Wmissing-prototypes] no previous prototype for function 'InitCapacityOk_InitialLengthTooBig' xpcom/tests/gtest/TestPLDHash.cpp:95:6 [-Wmissing-prototypes] no previous prototype for function 'InitCapacityOk_InitialEntryStoreTooBig' xpcom/tests/gtest/TestPLDHash.cpp:102:6 [-Wmissing-prototypes] no previous prototype for function 'InitCapacityOk_EntrySizeTooBig' xpcom/tests/gtest/TestSlicedInputStream.cpp:111:20 [-Wmissing-prototypes] no previous prototype for function 'CreateSeekableStreams' xpcom/tests/gtest/TestSlicedInputStream.cpp:125:20 [-Wmissing-prototypes] no previous prototype for function 'CreateNonSeekableStreams' xpcom/tests/gtest/TestStrings.cpp:471:6 [-Wmissing-prototypes] no previous prototype for function 'test_assign_helper' xpcom/tests/gtest/TestTArray.cpp:60:22 [-Wmissing-prototypes] no previous prototype for function 'DummyArray' xpcom/tests/gtest/TestTArray.cpp:72:22 [-Wmissing-prototypes] no previous prototype for function 'FakeHugeArray' xpcom/tests/gtest/TestThrottledEventQueue.cpp:96:6 [-Wmissing-prototypes] no previous prototype for function 'Enqueue' xpcom/threads/BlockingResourceBase.cpp:86:6 [-Wmissing-prototypes] no previous prototype for function 'PrintCycle' xpcom/threads/CPUUsageWatcher.cpp:41:10 [-Wmissing-prototypes] no previous prototype for function 'GetMicroseconds' xpcom/threads/CPUUsageWatcher.cpp:46:10 [-Wmissing-prototypes] no previous prototype for function 'GetMicroseconds' xpcom/threads/CPUUsageWatcher.cpp:51:40 [-Wmissing-prototypes] no previous prototype for function 'GetProcessCPUStats' xpcom/threads/CPUUsageWatcher.cpp:80:40 [-Wmissing-prototypes] no previous prototype for function 'GetGlobalCPUStats' xpcom/threads/nsTimerImpl.cpp:196:21 [-Wmissing-prototypes] no previous prototype for function 'GetTimerFiringsLog' Differential Revision: https://phabricator.services.mozilla.com/D23264 --HG-- extra : rebase_source : e03df033209e0a08fc263603e78bc16a09467f15 extra : source : 3beec9fbfdedf346fff85309029e7805717958ac
2019-02-25 04:35:59 +03:00
static int Sanity4_Child() {
DisableCrashReporter();
mozilla::ReentrantMonitor m1("dd.sanity4.m1");
Bug 1315138 - gtestify storage/test/*.cpp. r=mak,erahm. This change is mostly straightforward, except for the following. - It removes all the printing from the do_check_* macros because gtest macros do appropriate printing. - test_StatementCache.cpp needs some special gtest magic for the type parameterization. - It merges the four tests in test_unlock_notify.cpp because they rely on being executed in order, and so aren't independent. - storage_test_harness_tail.h is no longer necessary because gtest provides the test looping functionality. - It uses #include and the preprocessor to remove the duplication between test_deadlock_detector.cpp and xpcom/tests/DeadlockDetector.cpp. - It makes the test in test_service_init_background_thread.cpp a death test to force it to be the first storage gtest, because it fails otherwise. - It adds code to undo the SQLite mutex hooking as necessary, so that tests don't interfere with each other. - It de-virtualizes Spinner's destructor (as identified in bug 1318282). --HG-- rename : storage/test/storage_test_harness.h => storage/test/gtest/storage_test_harness.h rename : storage/test/test_AsXXX_helpers.cpp => storage/test/gtest/test_AsXXX_helpers.cpp rename : storage/test/test_StatementCache.cpp => storage/test/gtest/test_StatementCache.cpp rename : storage/test/test_asyncStatementExecution_transaction.cpp => storage/test/gtest/test_asyncStatementExecution_transaction.cpp rename : storage/test/test_async_callbacks_with_spun_event_loops.cpp => storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp rename : storage/test/test_binding_params.cpp => storage/test/gtest/test_binding_params.cpp rename : storage/test/test_deadlock_detector.cpp => storage/test/gtest/test_deadlock_detector.cpp rename : storage/test/test_file_perms.cpp => storage/test/gtest/test_file_perms.cpp rename : storage/test/test_mutex.cpp => storage/test/gtest/test_mutex.cpp rename : storage/test/test_service_init_background_thread.cpp => storage/test/gtest/test_service_init_background_thread.cpp rename : storage/test/test_statement_scoper.cpp => storage/test/gtest/test_statement_scoper.cpp rename : storage/test/test_transaction_helper.cpp => storage/test/gtest/test_transaction_helper.cpp rename : storage/test/test_true_async.cpp => storage/test/gtest/test_true_async.cpp rename : storage/test/test_unlock_notify.cpp => storage/test/gtest/test_unlock_notify.cpp extra : rebase_source : dbb695c112564efa1945116be1a8435988982e74
2016-11-11 01:59:23 +03:00
MUTEX m2("dd.sanity4.m2");
m1.Enter();
m2.Lock();
m1.Enter();
return 0;
}
Bug 1315138 - gtestify storage/test/*.cpp. r=mak,erahm. This change is mostly straightforward, except for the following. - It removes all the printing from the do_check_* macros because gtest macros do appropriate printing. - test_StatementCache.cpp needs some special gtest magic for the type parameterization. - It merges the four tests in test_unlock_notify.cpp because they rely on being executed in order, and so aren't independent. - storage_test_harness_tail.h is no longer necessary because gtest provides the test looping functionality. - It uses #include and the preprocessor to remove the duplication between test_deadlock_detector.cpp and xpcom/tests/DeadlockDetector.cpp. - It makes the test in test_service_init_background_thread.cpp a death test to force it to be the first storage gtest, because it fails otherwise. - It adds code to undo the SQLite mutex hooking as necessary, so that tests don't interfere with each other. - It de-virtualizes Spinner's destructor (as identified in bug 1318282). --HG-- rename : storage/test/storage_test_harness.h => storage/test/gtest/storage_test_harness.h rename : storage/test/test_AsXXX_helpers.cpp => storage/test/gtest/test_AsXXX_helpers.cpp rename : storage/test/test_StatementCache.cpp => storage/test/gtest/test_StatementCache.cpp rename : storage/test/test_asyncStatementExecution_transaction.cpp => storage/test/gtest/test_asyncStatementExecution_transaction.cpp rename : storage/test/test_async_callbacks_with_spun_event_loops.cpp => storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp rename : storage/test/test_binding_params.cpp => storage/test/gtest/test_binding_params.cpp rename : storage/test/test_deadlock_detector.cpp => storage/test/gtest/test_deadlock_detector.cpp rename : storage/test/test_file_perms.cpp => storage/test/gtest/test_file_perms.cpp rename : storage/test/test_mutex.cpp => storage/test/gtest/test_mutex.cpp rename : storage/test/test_service_init_background_thread.cpp => storage/test/gtest/test_service_init_background_thread.cpp rename : storage/test/test_statement_scoper.cpp => storage/test/gtest/test_statement_scoper.cpp rename : storage/test/test_transaction_helper.cpp => storage/test/gtest/test_transaction_helper.cpp rename : storage/test/test_true_async.cpp => storage/test/gtest/test_true_async.cpp rename : storage/test/test_unlock_notify.cpp => storage/test/gtest/test_unlock_notify.cpp extra : rebase_source : dbb695c112564efa1945116be1a8435988982e74
2016-11-11 01:59:23 +03:00
TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(Sanity4DeathTest)) {
const char* const regex =
"Re-entering ReentrantMonitor after acquiring other resources.*"
"###!!! ERROR: Potential deadlock detected.*"
"=== Cyclical dependency starts at.*--- ReentrantMonitor : "
"dd.sanity4.m1.*"
"--- Next dependency:.*--- Mutex : dd.sanity4.m2.*"
"=== Cycle completed at.*--- ReentrantMonitor : dd.sanity4.m1.*"
"###!!! ASSERTION: Potential deadlock detected.*";
ASSERT_DEATH_IF_SUPPORTED(Sanity4_Child(), regex);
}
Bug 1534878 - xpcom: Make some global functions static. r=erahm clang's -Wmissing-prototypes option identifies global functions that can be made static (because they're only called from one compilation unit) or removed (if they're never called). xpcom/base/Logging.cpp:85:13 [-Wmissing-prototypes] no previous prototype for function 'ToLogStr' xpcom/base/Logging.cpp:132:13 [-Wmissing-prototypes] no previous prototype for function 'ExpandPIDMarker' xpcom/base/LogModulePrefWatcher.cpp:37:6 [-Wmissing-prototypes] no previous prototype for function 'ResetExistingPrefs' xpcom/base/LogModulePrefWatcher.cpp:109:6 [-Wmissing-prototypes] no previous prototype for function 'LoadExistingPrefs' xpcom/base/nsCycleCollector.cpp:212:6 [-Wmissing-prototypes] no previous prototype for function 'SuspectUsingNurseryPurpleBuffer' xpcom/components/nsComponentManager.cpp:421:31 [-Wmissing-prototypes] no previous prototype for function 'begin' xpcom/components/nsComponentManager.cpp:427:31 [-Wmissing-prototypes] no previous prototype for function 'end' xpcom/ds/Dafsa.cpp:23:6 [-Wmissing-prototypes] no previous prototype for function 'GetNextOffset' xpcom/ds/Dafsa.cpp:55:6 [-Wmissing-prototypes] no previous prototype for function 'IsEOL' xpcom/ds/Dafsa.cpp:62:6 [-Wmissing-prototypes] no previous prototype for function 'IsMatch' xpcom/ds/Dafsa.cpp:70:6 [-Wmissing-prototypes] no previous prototype for function 'IsEndCharMatch' xpcom/ds/Dafsa.cpp:78:6 [-Wmissing-prototypes] no previous prototype for function 'GetReturnValue' xpcom/ds/Dafsa.cpp:91:5 [-Wmissing-prototypes] no previous prototype for function 'LookupString' xpcom/io/CocoaFileUtils.mm:195:13 [-Wmissing-prototypes] no previous prototype for function 'GetQuarantinePropKey' xpcom/io/CocoaFileUtils.mm:203:24 [-Wmissing-prototypes] no previous prototype for function 'CreateQuarantineDictionary' xpcom/rust/gtest/bench-collections/Bench.cpp:65:11 [-Wmissing-prototypes] no previous prototype for function 'MyRand' xpcom/rust/gtest/bench-collections/Bench.cpp:85:6 [-Wmissing-prototypes] no previous prototype for function 'Bench_Cpp_unordered_set' xpcom/rust/gtest/bench-collections/Bench.cpp:125:6 [-Wmissing-prototypes] no previous prototype for function 'Bench_Cpp_PLDHashTable' xpcom/rust/gtest/bench-collections/Bench.cpp:166:6 [-Wmissing-prototypes] no previous prototype for function 'Bench_Cpp_MozHashSet' xpcom/tests/gtest/TestAtoms.cpp:114:6 [-Wmissing-prototypes] no previous prototype for function 'isStaticAtom' xpcom/tests/gtest/TestCallTemplates.cpp:72:6 [-Wmissing-prototypes] no previous prototype for function 'JustTestingCompilation' xpcom/tests/gtest/TestCOMPtr.cpp:87:10 [-Wmissing-prototypes] no previous prototype for function 'CreateIFoo' xpcom/tests/gtest/TestCOMPtr.cpp:98:6 [-Wmissing-prototypes] no previous prototype for function 'set_a_IFoo' xpcom/tests/gtest/TestCOMPtr.cpp:105:16 [-Wmissing-prototypes] no previous prototype for function 'return_a_IFoo' xpcom/tests/gtest/TestCOMPtr.cpp:164:10 [-Wmissing-prototypes] no previous prototype for function 'CreateIBar' xpcom/tests/gtest/TestCOMPtr.cpp:175:6 [-Wmissing-prototypes] no previous prototype for function 'AnIFooPtrPtrContext' xpcom/tests/gtest/TestCOMPtr.cpp:177:6 [-Wmissing-prototypes] no previous prototype for function 'AVoidPtrPtrContext' xpcom/tests/gtest/TestCOMPtr.cpp:179:6 [-Wmissing-prototypes] no previous prototype for function 'AnISupportsPtrPtrContext' xpcom/tests/gtest/TestCOMPtr.cpp:263:6 [-Wmissing-prototypes] no previous prototype for function 'Comparison' xpcom/tests/gtest/TestCOMPtr.cpp:298:6 [-Wmissing-prototypes] no previous prototype for function 'DontAddRef' xpcom/tests/gtest/TestCRT.cpp:17:5 [-Wmissing-prototypes] no previous prototype for function 'sign' xpcom/tests/gtest/TestDeadlockDetector.cpp:62:6 [-Wmissing-prototypes] no previous prototype for function 'DisableCrashReporter' xpcom/tests/gtest/TestDeadlockDetector.cpp:74:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:95:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity2_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:159:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity4_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:182:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity5_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:303:5 [-Wmissing-prototypes] no previous prototype for function 'ContentionNoDeadlock_Child' xpcom/tests/gtest/TestHashtables.cpp:88:6 [-Wmissing-prototypes] no previous prototype for function 'testTHashtable' xpcom/tests/gtest/TestHashtables.cpp:205:10 [-Wmissing-prototypes] no previous prototype for function 'CreateIFoo' xpcom/tests/gtest/TestMoveString.cpp:25:6 [-Wmissing-prototypes] no previous prototype for function 'SetAsOwned' xpcom/tests/gtest/TestMoveString.cpp:34:6 [-Wmissing-prototypes] no previous prototype for function 'ExpectTruncated' xpcom/tests/gtest/TestMoveString.cpp:40:6 [-Wmissing-prototypes] no previous prototype for function 'ExpectNew' xpcom/tests/gtest/TestMruCache.cpp:52:11 [-Wmissing-prototypes] no previous prototype for function 'MakeStringKey' xpcom/tests/gtest/TestMultiplexInputStream.cpp:106:34 [-Wmissing-prototypes] no previous prototype for function 'CreateStreamHelper' xpcom/tests/gtest/TestNonBlockingAsyncInputStream.cpp:62:10 [-Wmissing-prototypes] no previous prototype for function 'ReadSegmentsFunction' xpcom/tests/gtest/TestNsDeque.cpp:240:6 [-Wmissing-prototypes] no previous prototype for function 'CheckIfQueueEmpty' xpcom/tests/gtest/TestNsRefPtr.cpp:105:10 [-Wmissing-prototypes] no previous prototype for function 'CreateFoo' xpcom/tests/gtest/TestNsRefPtr.cpp:116:6 [-Wmissing-prototypes] no previous prototype for function 'set_a_Foo' xpcom/tests/gtest/TestNsRefPtr.cpp:123:13 [-Wmissing-prototypes] no previous prototype for function 'return_a_Foo' xpcom/tests/gtest/TestNsRefPtr.cpp:391:6 [-Wmissing-prototypes] no previous prototype for function 'AnFooPtrPtrContext' xpcom/tests/gtest/TestNsRefPtr.cpp:392:6 [-Wmissing-prototypes] no previous prototype for function 'AVoidPtrPtrContext' xpcom/tests/gtest/TestPLDHash.cpp:33:6 [-Wmissing-prototypes] no previous prototype for function 'TestCrashyOperation' xpcom/tests/gtest/TestPipes.cpp:98:10 [-Wmissing-prototypes] no previous prototype for function 'TestPipe' xpcom/tests/gtest/TestPipes.cpp:212:10 [-Wmissing-prototypes] no previous prototype for function 'TestShortWrites' xpcom/tests/gtest/TestPipes.cpp:354:6 [-Wmissing-prototypes] no previous prototype for function 'RunTests' xpcom/tests/gtest/TestPLDHash.cpp:90:6 [-Wmissing-prototypes] no previous prototype for function 'InitCapacityOk_InitialLengthTooBig' xpcom/tests/gtest/TestPLDHash.cpp:95:6 [-Wmissing-prototypes] no previous prototype for function 'InitCapacityOk_InitialEntryStoreTooBig' xpcom/tests/gtest/TestPLDHash.cpp:102:6 [-Wmissing-prototypes] no previous prototype for function 'InitCapacityOk_EntrySizeTooBig' xpcom/tests/gtest/TestSlicedInputStream.cpp:111:20 [-Wmissing-prototypes] no previous prototype for function 'CreateSeekableStreams' xpcom/tests/gtest/TestSlicedInputStream.cpp:125:20 [-Wmissing-prototypes] no previous prototype for function 'CreateNonSeekableStreams' xpcom/tests/gtest/TestStrings.cpp:471:6 [-Wmissing-prototypes] no previous prototype for function 'test_assign_helper' xpcom/tests/gtest/TestTArray.cpp:60:22 [-Wmissing-prototypes] no previous prototype for function 'DummyArray' xpcom/tests/gtest/TestTArray.cpp:72:22 [-Wmissing-prototypes] no previous prototype for function 'FakeHugeArray' xpcom/tests/gtest/TestThrottledEventQueue.cpp:96:6 [-Wmissing-prototypes] no previous prototype for function 'Enqueue' xpcom/threads/BlockingResourceBase.cpp:86:6 [-Wmissing-prototypes] no previous prototype for function 'PrintCycle' xpcom/threads/CPUUsageWatcher.cpp:41:10 [-Wmissing-prototypes] no previous prototype for function 'GetMicroseconds' xpcom/threads/CPUUsageWatcher.cpp:46:10 [-Wmissing-prototypes] no previous prototype for function 'GetMicroseconds' xpcom/threads/CPUUsageWatcher.cpp:51:40 [-Wmissing-prototypes] no previous prototype for function 'GetProcessCPUStats' xpcom/threads/CPUUsageWatcher.cpp:80:40 [-Wmissing-prototypes] no previous prototype for function 'GetGlobalCPUStats' xpcom/threads/nsTimerImpl.cpp:196:21 [-Wmissing-prototypes] no previous prototype for function 'GetTimerFiringsLog' Differential Revision: https://phabricator.services.mozilla.com/D23264 --HG-- extra : rebase_source : e03df033209e0a08fc263603e78bc16a09467f15 extra : source : 3beec9fbfdedf346fff85309029e7805717958ac
2019-02-25 04:35:59 +03:00
static int Sanity5_Child() {
DisableCrashReporter();
mozilla::RecursiveMutex m1("dd.sanity4.m1");
MUTEX m2("dd.sanity4.m2");
m1.Lock();
m2.Lock();
m1.Lock();
return 0;
}
#if !defined(DISABLE_STORAGE_SANITY5_DEATH_TEST)
TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(Sanity5DeathTest)) {
const char* const regex =
"Re-entering RecursiveMutex after acquiring other resources.*"
"###!!! ERROR: Potential deadlock detected.*"
"=== Cyclical dependency starts at.*--- RecursiveMutex : dd.sanity4.m1.*"
"--- Next dependency:.*--- Mutex : dd.sanity4.m2.*"
"=== Cycle completed at.*--- RecursiveMutex : dd.sanity4.m1.*"
"###!!! ASSERTION: Potential deadlock detected.*";
ASSERT_DEATH_IF_SUPPORTED(Sanity5_Child(), regex);
}
#endif
//-----------------------------------------------------------------------------
// Multithreaded tests
/**
* Helper for passing state to threads in the multithread tests.
*/
struct ThreadState {
/**
* Locks to use during the test. This is just a reference and is owned by
* the main test thread.
*/
Bug 1315138 - gtestify storage/test/*.cpp. r=mak,erahm. This change is mostly straightforward, except for the following. - It removes all the printing from the do_check_* macros because gtest macros do appropriate printing. - test_StatementCache.cpp needs some special gtest magic for the type parameterization. - It merges the four tests in test_unlock_notify.cpp because they rely on being executed in order, and so aren't independent. - storage_test_harness_tail.h is no longer necessary because gtest provides the test looping functionality. - It uses #include and the preprocessor to remove the duplication between test_deadlock_detector.cpp and xpcom/tests/DeadlockDetector.cpp. - It makes the test in test_service_init_background_thread.cpp a death test to force it to be the first storage gtest, because it fails otherwise. - It adds code to undo the SQLite mutex hooking as necessary, so that tests don't interfere with each other. - It de-virtualizes Spinner's destructor (as identified in bug 1318282). --HG-- rename : storage/test/storage_test_harness.h => storage/test/gtest/storage_test_harness.h rename : storage/test/test_AsXXX_helpers.cpp => storage/test/gtest/test_AsXXX_helpers.cpp rename : storage/test/test_StatementCache.cpp => storage/test/gtest/test_StatementCache.cpp rename : storage/test/test_asyncStatementExecution_transaction.cpp => storage/test/gtest/test_asyncStatementExecution_transaction.cpp rename : storage/test/test_async_callbacks_with_spun_event_loops.cpp => storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp rename : storage/test/test_binding_params.cpp => storage/test/gtest/test_binding_params.cpp rename : storage/test/test_deadlock_detector.cpp => storage/test/gtest/test_deadlock_detector.cpp rename : storage/test/test_file_perms.cpp => storage/test/gtest/test_file_perms.cpp rename : storage/test/test_mutex.cpp => storage/test/gtest/test_mutex.cpp rename : storage/test/test_service_init_background_thread.cpp => storage/test/gtest/test_service_init_background_thread.cpp rename : storage/test/test_statement_scoper.cpp => storage/test/gtest/test_statement_scoper.cpp rename : storage/test/test_transaction_helper.cpp => storage/test/gtest/test_transaction_helper.cpp rename : storage/test/test_true_async.cpp => storage/test/gtest/test_true_async.cpp rename : storage/test/test_unlock_notify.cpp => storage/test/gtest/test_unlock_notify.cpp extra : rebase_source : dbb695c112564efa1945116be1a8435988982e74
2016-11-11 01:59:23 +03:00
const nsTArray<MUTEX*>& locks;
/**
* Integer argument used to identify each thread.
*/
int id;
};
#if 0
// Temporarily disabled, see bug 1370644.
static void
TwoThreads_thread(void* arg)
{
ThreadState* state = static_cast<ThreadState*>(arg);
Bug 1315138 - gtestify storage/test/*.cpp. r=mak,erahm. This change is mostly straightforward, except for the following. - It removes all the printing from the do_check_* macros because gtest macros do appropriate printing. - test_StatementCache.cpp needs some special gtest magic for the type parameterization. - It merges the four tests in test_unlock_notify.cpp because they rely on being executed in order, and so aren't independent. - storage_test_harness_tail.h is no longer necessary because gtest provides the test looping functionality. - It uses #include and the preprocessor to remove the duplication between test_deadlock_detector.cpp and xpcom/tests/DeadlockDetector.cpp. - It makes the test in test_service_init_background_thread.cpp a death test to force it to be the first storage gtest, because it fails otherwise. - It adds code to undo the SQLite mutex hooking as necessary, so that tests don't interfere with each other. - It de-virtualizes Spinner's destructor (as identified in bug 1318282). --HG-- rename : storage/test/storage_test_harness.h => storage/test/gtest/storage_test_harness.h rename : storage/test/test_AsXXX_helpers.cpp => storage/test/gtest/test_AsXXX_helpers.cpp rename : storage/test/test_StatementCache.cpp => storage/test/gtest/test_StatementCache.cpp rename : storage/test/test_asyncStatementExecution_transaction.cpp => storage/test/gtest/test_asyncStatementExecution_transaction.cpp rename : storage/test/test_async_callbacks_with_spun_event_loops.cpp => storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp rename : storage/test/test_binding_params.cpp => storage/test/gtest/test_binding_params.cpp rename : storage/test/test_deadlock_detector.cpp => storage/test/gtest/test_deadlock_detector.cpp rename : storage/test/test_file_perms.cpp => storage/test/gtest/test_file_perms.cpp rename : storage/test/test_mutex.cpp => storage/test/gtest/test_mutex.cpp rename : storage/test/test_service_init_background_thread.cpp => storage/test/gtest/test_service_init_background_thread.cpp rename : storage/test/test_statement_scoper.cpp => storage/test/gtest/test_statement_scoper.cpp rename : storage/test/test_transaction_helper.cpp => storage/test/gtest/test_transaction_helper.cpp rename : storage/test/test_true_async.cpp => storage/test/gtest/test_true_async.cpp rename : storage/test/test_unlock_notify.cpp => storage/test/gtest/test_unlock_notify.cpp extra : rebase_source : dbb695c112564efa1945116be1a8435988982e74
2016-11-11 01:59:23 +03:00
MUTEX* ttM1 = state->locks[0];
MUTEX* ttM2 = state->locks[1];
if (state->id) {
ttM1->Lock();
ttM2->Lock();
ttM2->Unlock();
ttM1->Unlock();
}
else {
ttM2->Lock();
ttM1->Lock();
ttM1->Unlock();
ttM2->Unlock();
}
}
int
TwoThreads_Child()
{
DisableCrashReporter();
Bug 1315138 - gtestify storage/test/*.cpp. r=mak,erahm. This change is mostly straightforward, except for the following. - It removes all the printing from the do_check_* macros because gtest macros do appropriate printing. - test_StatementCache.cpp needs some special gtest magic for the type parameterization. - It merges the four tests in test_unlock_notify.cpp because they rely on being executed in order, and so aren't independent. - storage_test_harness_tail.h is no longer necessary because gtest provides the test looping functionality. - It uses #include and the preprocessor to remove the duplication between test_deadlock_detector.cpp and xpcom/tests/DeadlockDetector.cpp. - It makes the test in test_service_init_background_thread.cpp a death test to force it to be the first storage gtest, because it fails otherwise. - It adds code to undo the SQLite mutex hooking as necessary, so that tests don't interfere with each other. - It de-virtualizes Spinner's destructor (as identified in bug 1318282). --HG-- rename : storage/test/storage_test_harness.h => storage/test/gtest/storage_test_harness.h rename : storage/test/test_AsXXX_helpers.cpp => storage/test/gtest/test_AsXXX_helpers.cpp rename : storage/test/test_StatementCache.cpp => storage/test/gtest/test_StatementCache.cpp rename : storage/test/test_asyncStatementExecution_transaction.cpp => storage/test/gtest/test_asyncStatementExecution_transaction.cpp rename : storage/test/test_async_callbacks_with_spun_event_loops.cpp => storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp rename : storage/test/test_binding_params.cpp => storage/test/gtest/test_binding_params.cpp rename : storage/test/test_deadlock_detector.cpp => storage/test/gtest/test_deadlock_detector.cpp rename : storage/test/test_file_perms.cpp => storage/test/gtest/test_file_perms.cpp rename : storage/test/test_mutex.cpp => storage/test/gtest/test_mutex.cpp rename : storage/test/test_service_init_background_thread.cpp => storage/test/gtest/test_service_init_background_thread.cpp rename : storage/test/test_statement_scoper.cpp => storage/test/gtest/test_statement_scoper.cpp rename : storage/test/test_transaction_helper.cpp => storage/test/gtest/test_transaction_helper.cpp rename : storage/test/test_true_async.cpp => storage/test/gtest/test_true_async.cpp rename : storage/test/test_unlock_notify.cpp => storage/test/gtest/test_unlock_notify.cpp extra : rebase_source : dbb695c112564efa1945116be1a8435988982e74
2016-11-11 01:59:23 +03:00
nsTArray<MUTEX*> locks = {
new MUTEX("dd.twothreads.m1"),
new MUTEX("dd.twothreads.m2")
};
ThreadState state_1 {locks, 0};
PRThread* t1 = spawn(TwoThreads_thread, &state_1);
PR_JoinThread(t1);
ThreadState state_2 {locks, 1};
PRThread* t2 = spawn(TwoThreads_thread, &state_2);
PR_JoinThread(t2);
for (auto& lock : locks) {
delete lock;
}
return 0;
}
Bug 1315138 - gtestify storage/test/*.cpp. r=mak,erahm. This change is mostly straightforward, except for the following. - It removes all the printing from the do_check_* macros because gtest macros do appropriate printing. - test_StatementCache.cpp needs some special gtest magic for the type parameterization. - It merges the four tests in test_unlock_notify.cpp because they rely on being executed in order, and so aren't independent. - storage_test_harness_tail.h is no longer necessary because gtest provides the test looping functionality. - It uses #include and the preprocessor to remove the duplication between test_deadlock_detector.cpp and xpcom/tests/DeadlockDetector.cpp. - It makes the test in test_service_init_background_thread.cpp a death test to force it to be the first storage gtest, because it fails otherwise. - It adds code to undo the SQLite mutex hooking as necessary, so that tests don't interfere with each other. - It de-virtualizes Spinner's destructor (as identified in bug 1318282). --HG-- rename : storage/test/storage_test_harness.h => storage/test/gtest/storage_test_harness.h rename : storage/test/test_AsXXX_helpers.cpp => storage/test/gtest/test_AsXXX_helpers.cpp rename : storage/test/test_StatementCache.cpp => storage/test/gtest/test_StatementCache.cpp rename : storage/test/test_asyncStatementExecution_transaction.cpp => storage/test/gtest/test_asyncStatementExecution_transaction.cpp rename : storage/test/test_async_callbacks_with_spun_event_loops.cpp => storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp rename : storage/test/test_binding_params.cpp => storage/test/gtest/test_binding_params.cpp rename : storage/test/test_deadlock_detector.cpp => storage/test/gtest/test_deadlock_detector.cpp rename : storage/test/test_file_perms.cpp => storage/test/gtest/test_file_perms.cpp rename : storage/test/test_mutex.cpp => storage/test/gtest/test_mutex.cpp rename : storage/test/test_service_init_background_thread.cpp => storage/test/gtest/test_service_init_background_thread.cpp rename : storage/test/test_statement_scoper.cpp => storage/test/gtest/test_statement_scoper.cpp rename : storage/test/test_transaction_helper.cpp => storage/test/gtest/test_transaction_helper.cpp rename : storage/test/test_true_async.cpp => storage/test/gtest/test_true_async.cpp rename : storage/test/test_unlock_notify.cpp => storage/test/gtest/test_unlock_notify.cpp extra : rebase_source : dbb695c112564efa1945116be1a8435988982e74
2016-11-11 01:59:23 +03:00
TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(TwoThreadsDeathTest))
{
const char* const regex =
"###!!! ERROR: Potential deadlock detected.*"
"=== Cyclical dependency starts at.*--- Mutex : dd.twothreads.m2.*"
"--- Next dependency:.*--- Mutex : dd.twothreads.m1.*"
"=== Cycle completed at.*--- Mutex : dd.twothreads.m2.*"
"###!!! ASSERTION: Potential deadlock detected.*";
ASSERT_DEATH_IF_SUPPORTED(TwoThreads_Child(), regex);
}
#endif
static void ContentionNoDeadlock_thread(void* arg) {
const uint32_t K = 100000;
ThreadState* state = static_cast<ThreadState*>(arg);
int32_t starti = static_cast<int32_t>(state->id);
auto& cndMs = state->locks;
for (uint32_t k = 0; k < K; ++k) {
for (int32_t i = starti; i < (int32_t)cndMs.Length(); ++i) cndMs[i]->Lock();
// comment out the next two lines for deadlocking fun!
for (int32_t i = cndMs.Length() - 1; i >= starti; --i) cndMs[i]->Unlock();
starti = (starti + 1) % 3;
}
}
Bug 1534878 - xpcom: Make some global functions static. r=erahm clang's -Wmissing-prototypes option identifies global functions that can be made static (because they're only called from one compilation unit) or removed (if they're never called). xpcom/base/Logging.cpp:85:13 [-Wmissing-prototypes] no previous prototype for function 'ToLogStr' xpcom/base/Logging.cpp:132:13 [-Wmissing-prototypes] no previous prototype for function 'ExpandPIDMarker' xpcom/base/LogModulePrefWatcher.cpp:37:6 [-Wmissing-prototypes] no previous prototype for function 'ResetExistingPrefs' xpcom/base/LogModulePrefWatcher.cpp:109:6 [-Wmissing-prototypes] no previous prototype for function 'LoadExistingPrefs' xpcom/base/nsCycleCollector.cpp:212:6 [-Wmissing-prototypes] no previous prototype for function 'SuspectUsingNurseryPurpleBuffer' xpcom/components/nsComponentManager.cpp:421:31 [-Wmissing-prototypes] no previous prototype for function 'begin' xpcom/components/nsComponentManager.cpp:427:31 [-Wmissing-prototypes] no previous prototype for function 'end' xpcom/ds/Dafsa.cpp:23:6 [-Wmissing-prototypes] no previous prototype for function 'GetNextOffset' xpcom/ds/Dafsa.cpp:55:6 [-Wmissing-prototypes] no previous prototype for function 'IsEOL' xpcom/ds/Dafsa.cpp:62:6 [-Wmissing-prototypes] no previous prototype for function 'IsMatch' xpcom/ds/Dafsa.cpp:70:6 [-Wmissing-prototypes] no previous prototype for function 'IsEndCharMatch' xpcom/ds/Dafsa.cpp:78:6 [-Wmissing-prototypes] no previous prototype for function 'GetReturnValue' xpcom/ds/Dafsa.cpp:91:5 [-Wmissing-prototypes] no previous prototype for function 'LookupString' xpcom/io/CocoaFileUtils.mm:195:13 [-Wmissing-prototypes] no previous prototype for function 'GetQuarantinePropKey' xpcom/io/CocoaFileUtils.mm:203:24 [-Wmissing-prototypes] no previous prototype for function 'CreateQuarantineDictionary' xpcom/rust/gtest/bench-collections/Bench.cpp:65:11 [-Wmissing-prototypes] no previous prototype for function 'MyRand' xpcom/rust/gtest/bench-collections/Bench.cpp:85:6 [-Wmissing-prototypes] no previous prototype for function 'Bench_Cpp_unordered_set' xpcom/rust/gtest/bench-collections/Bench.cpp:125:6 [-Wmissing-prototypes] no previous prototype for function 'Bench_Cpp_PLDHashTable' xpcom/rust/gtest/bench-collections/Bench.cpp:166:6 [-Wmissing-prototypes] no previous prototype for function 'Bench_Cpp_MozHashSet' xpcom/tests/gtest/TestAtoms.cpp:114:6 [-Wmissing-prototypes] no previous prototype for function 'isStaticAtom' xpcom/tests/gtest/TestCallTemplates.cpp:72:6 [-Wmissing-prototypes] no previous prototype for function 'JustTestingCompilation' xpcom/tests/gtest/TestCOMPtr.cpp:87:10 [-Wmissing-prototypes] no previous prototype for function 'CreateIFoo' xpcom/tests/gtest/TestCOMPtr.cpp:98:6 [-Wmissing-prototypes] no previous prototype for function 'set_a_IFoo' xpcom/tests/gtest/TestCOMPtr.cpp:105:16 [-Wmissing-prototypes] no previous prototype for function 'return_a_IFoo' xpcom/tests/gtest/TestCOMPtr.cpp:164:10 [-Wmissing-prototypes] no previous prototype for function 'CreateIBar' xpcom/tests/gtest/TestCOMPtr.cpp:175:6 [-Wmissing-prototypes] no previous prototype for function 'AnIFooPtrPtrContext' xpcom/tests/gtest/TestCOMPtr.cpp:177:6 [-Wmissing-prototypes] no previous prototype for function 'AVoidPtrPtrContext' xpcom/tests/gtest/TestCOMPtr.cpp:179:6 [-Wmissing-prototypes] no previous prototype for function 'AnISupportsPtrPtrContext' xpcom/tests/gtest/TestCOMPtr.cpp:263:6 [-Wmissing-prototypes] no previous prototype for function 'Comparison' xpcom/tests/gtest/TestCOMPtr.cpp:298:6 [-Wmissing-prototypes] no previous prototype for function 'DontAddRef' xpcom/tests/gtest/TestCRT.cpp:17:5 [-Wmissing-prototypes] no previous prototype for function 'sign' xpcom/tests/gtest/TestDeadlockDetector.cpp:62:6 [-Wmissing-prototypes] no previous prototype for function 'DisableCrashReporter' xpcom/tests/gtest/TestDeadlockDetector.cpp:74:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:95:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity2_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:159:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity4_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:182:5 [-Wmissing-prototypes] no previous prototype for function 'Sanity5_Child' xpcom/tests/gtest/TestDeadlockDetector.cpp:303:5 [-Wmissing-prototypes] no previous prototype for function 'ContentionNoDeadlock_Child' xpcom/tests/gtest/TestHashtables.cpp:88:6 [-Wmissing-prototypes] no previous prototype for function 'testTHashtable' xpcom/tests/gtest/TestHashtables.cpp:205:10 [-Wmissing-prototypes] no previous prototype for function 'CreateIFoo' xpcom/tests/gtest/TestMoveString.cpp:25:6 [-Wmissing-prototypes] no previous prototype for function 'SetAsOwned' xpcom/tests/gtest/TestMoveString.cpp:34:6 [-Wmissing-prototypes] no previous prototype for function 'ExpectTruncated' xpcom/tests/gtest/TestMoveString.cpp:40:6 [-Wmissing-prototypes] no previous prototype for function 'ExpectNew' xpcom/tests/gtest/TestMruCache.cpp:52:11 [-Wmissing-prototypes] no previous prototype for function 'MakeStringKey' xpcom/tests/gtest/TestMultiplexInputStream.cpp:106:34 [-Wmissing-prototypes] no previous prototype for function 'CreateStreamHelper' xpcom/tests/gtest/TestNonBlockingAsyncInputStream.cpp:62:10 [-Wmissing-prototypes] no previous prototype for function 'ReadSegmentsFunction' xpcom/tests/gtest/TestNsDeque.cpp:240:6 [-Wmissing-prototypes] no previous prototype for function 'CheckIfQueueEmpty' xpcom/tests/gtest/TestNsRefPtr.cpp:105:10 [-Wmissing-prototypes] no previous prototype for function 'CreateFoo' xpcom/tests/gtest/TestNsRefPtr.cpp:116:6 [-Wmissing-prototypes] no previous prototype for function 'set_a_Foo' xpcom/tests/gtest/TestNsRefPtr.cpp:123:13 [-Wmissing-prototypes] no previous prototype for function 'return_a_Foo' xpcom/tests/gtest/TestNsRefPtr.cpp:391:6 [-Wmissing-prototypes] no previous prototype for function 'AnFooPtrPtrContext' xpcom/tests/gtest/TestNsRefPtr.cpp:392:6 [-Wmissing-prototypes] no previous prototype for function 'AVoidPtrPtrContext' xpcom/tests/gtest/TestPLDHash.cpp:33:6 [-Wmissing-prototypes] no previous prototype for function 'TestCrashyOperation' xpcom/tests/gtest/TestPipes.cpp:98:10 [-Wmissing-prototypes] no previous prototype for function 'TestPipe' xpcom/tests/gtest/TestPipes.cpp:212:10 [-Wmissing-prototypes] no previous prototype for function 'TestShortWrites' xpcom/tests/gtest/TestPipes.cpp:354:6 [-Wmissing-prototypes] no previous prototype for function 'RunTests' xpcom/tests/gtest/TestPLDHash.cpp:90:6 [-Wmissing-prototypes] no previous prototype for function 'InitCapacityOk_InitialLengthTooBig' xpcom/tests/gtest/TestPLDHash.cpp:95:6 [-Wmissing-prototypes] no previous prototype for function 'InitCapacityOk_InitialEntryStoreTooBig' xpcom/tests/gtest/TestPLDHash.cpp:102:6 [-Wmissing-prototypes] no previous prototype for function 'InitCapacityOk_EntrySizeTooBig' xpcom/tests/gtest/TestSlicedInputStream.cpp:111:20 [-Wmissing-prototypes] no previous prototype for function 'CreateSeekableStreams' xpcom/tests/gtest/TestSlicedInputStream.cpp:125:20 [-Wmissing-prototypes] no previous prototype for function 'CreateNonSeekableStreams' xpcom/tests/gtest/TestStrings.cpp:471:6 [-Wmissing-prototypes] no previous prototype for function 'test_assign_helper' xpcom/tests/gtest/TestTArray.cpp:60:22 [-Wmissing-prototypes] no previous prototype for function 'DummyArray' xpcom/tests/gtest/TestTArray.cpp:72:22 [-Wmissing-prototypes] no previous prototype for function 'FakeHugeArray' xpcom/tests/gtest/TestThrottledEventQueue.cpp:96:6 [-Wmissing-prototypes] no previous prototype for function 'Enqueue' xpcom/threads/BlockingResourceBase.cpp:86:6 [-Wmissing-prototypes] no previous prototype for function 'PrintCycle' xpcom/threads/CPUUsageWatcher.cpp:41:10 [-Wmissing-prototypes] no previous prototype for function 'GetMicroseconds' xpcom/threads/CPUUsageWatcher.cpp:46:10 [-Wmissing-prototypes] no previous prototype for function 'GetMicroseconds' xpcom/threads/CPUUsageWatcher.cpp:51:40 [-Wmissing-prototypes] no previous prototype for function 'GetProcessCPUStats' xpcom/threads/CPUUsageWatcher.cpp:80:40 [-Wmissing-prototypes] no previous prototype for function 'GetGlobalCPUStats' xpcom/threads/nsTimerImpl.cpp:196:21 [-Wmissing-prototypes] no previous prototype for function 'GetTimerFiringsLog' Differential Revision: https://phabricator.services.mozilla.com/D23264 --HG-- extra : rebase_source : e03df033209e0a08fc263603e78bc16a09467f15 extra : source : 3beec9fbfdedf346fff85309029e7805717958ac
2019-02-25 04:35:59 +03:00
static int ContentionNoDeadlock_Child() {
const size_t kMutexCount = 4;
PRThread* threads[3];
Bug 1315138 - gtestify storage/test/*.cpp. r=mak,erahm. This change is mostly straightforward, except for the following. - It removes all the printing from the do_check_* macros because gtest macros do appropriate printing. - test_StatementCache.cpp needs some special gtest magic for the type parameterization. - It merges the four tests in test_unlock_notify.cpp because they rely on being executed in order, and so aren't independent. - storage_test_harness_tail.h is no longer necessary because gtest provides the test looping functionality. - It uses #include and the preprocessor to remove the duplication between test_deadlock_detector.cpp and xpcom/tests/DeadlockDetector.cpp. - It makes the test in test_service_init_background_thread.cpp a death test to force it to be the first storage gtest, because it fails otherwise. - It adds code to undo the SQLite mutex hooking as necessary, so that tests don't interfere with each other. - It de-virtualizes Spinner's destructor (as identified in bug 1318282). --HG-- rename : storage/test/storage_test_harness.h => storage/test/gtest/storage_test_harness.h rename : storage/test/test_AsXXX_helpers.cpp => storage/test/gtest/test_AsXXX_helpers.cpp rename : storage/test/test_StatementCache.cpp => storage/test/gtest/test_StatementCache.cpp rename : storage/test/test_asyncStatementExecution_transaction.cpp => storage/test/gtest/test_asyncStatementExecution_transaction.cpp rename : storage/test/test_async_callbacks_with_spun_event_loops.cpp => storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp rename : storage/test/test_binding_params.cpp => storage/test/gtest/test_binding_params.cpp rename : storage/test/test_deadlock_detector.cpp => storage/test/gtest/test_deadlock_detector.cpp rename : storage/test/test_file_perms.cpp => storage/test/gtest/test_file_perms.cpp rename : storage/test/test_mutex.cpp => storage/test/gtest/test_mutex.cpp rename : storage/test/test_service_init_background_thread.cpp => storage/test/gtest/test_service_init_background_thread.cpp rename : storage/test/test_statement_scoper.cpp => storage/test/gtest/test_statement_scoper.cpp rename : storage/test/test_transaction_helper.cpp => storage/test/gtest/test_transaction_helper.cpp rename : storage/test/test_true_async.cpp => storage/test/gtest/test_true_async.cpp rename : storage/test/test_unlock_notify.cpp => storage/test/gtest/test_unlock_notify.cpp extra : rebase_source : dbb695c112564efa1945116be1a8435988982e74
2016-11-11 01:59:23 +03:00
nsTArray<MUTEX*> locks;
ThreadState states[] = {{locks, 0}, {locks, 1}, {locks, 2}};
for (uint32_t i = 0; i < kMutexCount; ++i)
locks.AppendElement(new MUTEX("dd.cnd.ms"));
for (int32_t i = 0; i < (int32_t)ArrayLength(threads); ++i)
threads[i] = spawn(ContentionNoDeadlock_thread, states + i);
for (uint32_t i = 0; i < ArrayLength(threads); ++i) PR_JoinThread(threads[i]);
for (uint32_t i = 0; i < locks.Length(); ++i) delete locks[i];
return 0;
}
Bug 1315138 - gtestify storage/test/*.cpp. r=mak,erahm. This change is mostly straightforward, except for the following. - It removes all the printing from the do_check_* macros because gtest macros do appropriate printing. - test_StatementCache.cpp needs some special gtest magic for the type parameterization. - It merges the four tests in test_unlock_notify.cpp because they rely on being executed in order, and so aren't independent. - storage_test_harness_tail.h is no longer necessary because gtest provides the test looping functionality. - It uses #include and the preprocessor to remove the duplication between test_deadlock_detector.cpp and xpcom/tests/DeadlockDetector.cpp. - It makes the test in test_service_init_background_thread.cpp a death test to force it to be the first storage gtest, because it fails otherwise. - It adds code to undo the SQLite mutex hooking as necessary, so that tests don't interfere with each other. - It de-virtualizes Spinner's destructor (as identified in bug 1318282). --HG-- rename : storage/test/storage_test_harness.h => storage/test/gtest/storage_test_harness.h rename : storage/test/test_AsXXX_helpers.cpp => storage/test/gtest/test_AsXXX_helpers.cpp rename : storage/test/test_StatementCache.cpp => storage/test/gtest/test_StatementCache.cpp rename : storage/test/test_asyncStatementExecution_transaction.cpp => storage/test/gtest/test_asyncStatementExecution_transaction.cpp rename : storage/test/test_async_callbacks_with_spun_event_loops.cpp => storage/test/gtest/test_async_callbacks_with_spun_event_loops.cpp rename : storage/test/test_binding_params.cpp => storage/test/gtest/test_binding_params.cpp rename : storage/test/test_deadlock_detector.cpp => storage/test/gtest/test_deadlock_detector.cpp rename : storage/test/test_file_perms.cpp => storage/test/gtest/test_file_perms.cpp rename : storage/test/test_mutex.cpp => storage/test/gtest/test_mutex.cpp rename : storage/test/test_service_init_background_thread.cpp => storage/test/gtest/test_service_init_background_thread.cpp rename : storage/test/test_statement_scoper.cpp => storage/test/gtest/test_statement_scoper.cpp rename : storage/test/test_transaction_helper.cpp => storage/test/gtest/test_transaction_helper.cpp rename : storage/test/test_true_async.cpp => storage/test/gtest/test_true_async.cpp rename : storage/test/test_unlock_notify.cpp => storage/test/gtest/test_unlock_notify.cpp extra : rebase_source : dbb695c112564efa1945116be1a8435988982e74
2016-11-11 01:59:23 +03:00
TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(ContentionNoDeadlock)) {
// Just check that this test runs to completion.
ASSERT_EQ(ContentionNoDeadlock_Child(), 0);
}