Bug 521225 - Stop syncing for random failing Places tests, and make sheriffs happier, r=sdwilsh

This commit is contained in:
Marco Bonardo 2009-10-13 15:31:46 +02:00
Родитель c69a620964
Коммит 6bfb40e73d
6 изменённых файлов: 71 добавлений и 4 удалений

Просмотреть файл

@ -329,3 +329,15 @@ function flush_main_thread_events()
while (tm.mainThread.hasPendingEvents()) while (tm.mainThread.hasPendingEvents())
tm.mainThread.processNextEvent(false); tm.mainThread.processNextEvent(false);
} }
// These tests are known to randomly fail due to bug 507790 when database
// flushes are active, so we turn off syncing for them.
let randomFailingSyncTests = [
"test_browserGlue_smartBookmarks.js",
];
let currentTestFilename = do_get_file(_TEST_FILE[0], true).leafName;
if (randomFailingSyncTests.indexOf(currentTestFilename) != -1) {
print("Test " + currentTestFilename + " is known random due to bug 507790, disabling PlacesDBFlush component.");
let sync = Cc["@mozilla.org/places/sync;1"].getService(Ci.nsIObserver);
sync.observe(null, "places-debug-stop-sync", null);
}

Просмотреть файл

@ -50,6 +50,8 @@ const Cu = Components.utils;
const kQuitApplication = "quit-application"; const kQuitApplication = "quit-application";
const kSyncFinished = "places-sync-finished"; const kSyncFinished = "places-sync-finished";
const kDebugStopSync = "places-debug-stop-sync";
const kDebugStartSync = "places-debug-start-sync";
const kSyncPrefName = "places.syncDBTableIntervalInSecs"; const kSyncPrefName = "places.syncDBTableIntervalInSecs";
const kDefaultSyncInterval = 120; const kDefaultSyncInterval = 120;
@ -108,6 +110,8 @@ function nsPlacesDBFlush()
this._os = Cc["@mozilla.org/observer-service;1"]. this._os = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService); getService(Ci.nsIObserverService);
this._os.addObserver(this, kQuitApplication, false); this._os.addObserver(this, kQuitApplication, false);
this._os.addObserver(this, kDebugStopSync, false);
this._os.addObserver(this, kDebugStartSync, false);
let (pb2 = this._prefs.QueryInterface(Ci.nsIPrefBranch2)) { let (pb2 = this._prefs.QueryInterface(Ci.nsIPrefBranch2)) {
pb2.addObserver(kSyncPrefName, this, false); pb2.addObserver(kSyncPrefName, this, false);
@ -147,6 +151,9 @@ nsPlacesDBFlush.prototype = {
{ {
if (aTopic == kQuitApplication) { if (aTopic == kQuitApplication) {
this._os.removeObserver(this, kQuitApplication); this._os.removeObserver(this, kQuitApplication);
this._os.removeObserver(this, kDebugStopSync);
this._os.removeObserver(this, kDebugStartSync);
let (pb2 = this._prefs.QueryInterface(Ci.nsIPrefBranch2)) { let (pb2 = this._prefs.QueryInterface(Ci.nsIPrefBranch2)) {
pb2.removeObserver(kSyncPrefName, this); pb2.removeObserver(kSyncPrefName, this);
pb2.removeObserver(kExpireDaysPrefName, this); pb2.removeObserver(kExpireDaysPrefName, this);
@ -195,6 +202,13 @@ nsPlacesDBFlush.prototype = {
if (this._expireDays <= 0) if (this._expireDays <= 0)
this._expireDays = kDefaultExpireDays; this._expireDays = kDefaultExpireDays;
} }
else if (aTopic == kDebugStopSync) {
this._syncStopped = true;
}
else if (aTopic == kDebugStartSync) {
if (_syncStopped in this)
delete this._syncStopped;
}
}, },
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
@ -338,7 +352,7 @@ nsPlacesDBFlush.prototype = {
_flushWithQueries: function DBFlush_flushWithQueries(aQueryNames) _flushWithQueries: function DBFlush_flushWithQueries(aQueryNames)
{ {
// No need to do extra work if we are in batch mode // No need to do extra work if we are in batch mode
if (this._inBatchMode) if (this._inBatchMode || this._syncStopped)
return; return;
let statements = []; let statements = [];

Просмотреть файл

@ -164,3 +164,19 @@ function flush_main_thread_events()
while (tm.mainThread.hasPendingEvents()) while (tm.mainThread.hasPendingEvents())
tm.mainThread.processNextEvent(false); tm.mainThread.processNextEvent(false);
} }
// These tests are known to randomly fail due to bug 507790 when database
// flushes are active, so we turn off syncing for them.
let randomFailingSyncTests = [
"test_384228.js",
"test_395593.js",
"test_405938_restore_queries.js",
"test_423515_forceCopyShortcuts.js",
"test_448584.js",
];
let currentTestFilename = do_get_file(_TEST_FILE[0], true).leafName;
if (randomFailingSyncTests.indexOf(currentTestFilename) != -1) {
print("Test " + currentTestFilename + " is known random due to bug 507790, disabling PlacesDBFlush component.");
let sync = Cc["@mozilla.org/places/sync;1"].getService(Ci.nsIObserver);
sync.observe(null, "places-debug-stop-sync", null);
}

Просмотреть файл

@ -562,3 +562,15 @@ function flush_main_thread_events()
while (tm.mainThread.hasPendingEvents()) while (tm.mainThread.hasPendingEvents())
tm.mainThread.processNextEvent(false); tm.mainThread.processNextEvent(false);
} }
// These tests are known to randomly fail due to bug 507790 when database
// flushes are active, so we turn off syncing for them.
let randomFailingSyncTests = [
" test_results-as-visits.js",
];
let currentTestFilename = do_get_file(_TEST_FILE[0], true).leafName;
if (randomFailingSyncTests.indexOf(currentTestFilename) != -1) {
print("Test " + currentTestFilename + " is known random due to bug 507790, disabling PlacesDBFlush component.");
let sync = Cc["@mozilla.org/places/sync;1"].getService(Ci.nsIObserver);
sync.observe(null, "places-debug-stop-sync", null);
}

Просмотреть файл

@ -64,9 +64,6 @@ function createTestData() {
* This test will test Queries that use relative search terms and URI options * This test will test Queries that use relative search terms and URI options
*/ */
function run_test() { function run_test() {
/* Temporarly disabled till we figure out what's up. See Bug 511860 */
return;
createTestData(); createTestData();
populateDB(testData); populateDB(testData);
var query = histsvc.getNewQuery(); var query = histsvc.getNewQuery();

Просмотреть файл

@ -206,3 +206,19 @@ function flush_main_thread_events()
while (tm.mainThread.hasPendingEvents()) while (tm.mainThread.hasPendingEvents())
tm.mainThread.processNextEvent(false); tm.mainThread.processNextEvent(false);
} }
// These tests are known to randomly fail due to bug 507790 when database
// flushes are active, so we turn off syncing for them.
let randomFailingSyncTests = [
"test_annotations.js",
"test_multi_word_tags.js",
"test_removeVisitsByTimeframe.js",
"test_tagging.js",
"test_utils_getURLsForContainerNode.js",
];
let currentTestFilename = do_get_file(_TEST_FILE[0], true).leafName;
if (randomFailingSyncTests.indexOf(currentTestFilename) != -1) {
print("Test " + currentTestFilename + " is known random due to bug 507790, disabling PlacesDBFlush component.");
let sync = Cc["@mozilla.org/places/sync;1"].getService(Ci.nsIObserver);
sync.observe(null, "places-debug-stop-sync", null);
}