Bug 471579 - reftests timeout very frequently when run on maemo device; r=(dbaron + ted.mielczarek)

This commit is contained in:
Joel Maher 2009-06-19 20:17:55 +02:00
parent 5f6830fceb
commit 43ef3e73fd
2 changed files with 27 additions and 7 deletions

View File

@ -57,7 +57,7 @@ const NS_XREAPPINFO_CONTRACTID =
"@mozilla.org/xre/app-info;1";
const LOAD_FAILURE_TIMEOUT = 10000; // ms
var gLoadTimeout = 0;
// "<!--CLEAR-->"
const BLANK_URL_FOR_CLEARING = "data:text/html,%3C%21%2D%2DCLEAR%2D%2D%3E";
@ -141,6 +141,16 @@ function OnRefTestLoad()
{
gBrowser = document.getElementById("browser");
/* set the gLoadTimeout */
try {
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch2);
gLoadTimeout = prefs.getIntPref("reftest.timeout");
}
catch(e) {
gLoadTimeout = 5 * 60 * 1000; //5 minutes as per bug 479518
}
gBrowser.addEventListener("load", OnDocumentLoad, true);
try {
@ -247,9 +257,13 @@ function ReadManifest(aURL)
var sandbox = new Components.utils.Sandbox(aURL.spec);
var xr = CC[NS_XREAPPINFO_CONTRACTID].getService(CI.nsIXULRuntime);
sandbox.MOZ_WIDGET_TOOLKIT = xr.widgetToolkit;
sandbox.xulRuntime = {widgetToolkit: xr.widgetToolkit,
OS: xr.OS,
XPCOMABI: xr.XPCOMABI};
sandbox.xulRuntime = {widgetToolkit: xr.widgettoolkit, OS: xr.OS};
// xr.XPCOMABI throws exception for configurations without full ABI support (mobile builds on ARM)
try {
sandbox.XPCOMABI = xr.XPCOMABI;
} catch(e) {}
var hh = CC[NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX + "http"].
getService(CI.nsIHttpProtocolHandler);
sandbox.http = {};
@ -496,7 +510,7 @@ function StartCurrentURI(aState)
"| program error managing timeouts\n");
++gTestResults.Exception;
}
gFailureTimeout = setTimeout(LoadFailed, LOAD_FAILURE_TIMEOUT);
gFailureTimeout = setTimeout(LoadFailed, gLoadTimeout);
gFailureReason = "timed out waiting for onload to fire";
gState = aState;

View File

@ -55,7 +55,7 @@ def getFullPath(path):
"Get an absolute path relative to oldcwd."
return os.path.normpath(os.path.join(oldcwd, os.path.expanduser(path)))
def createReftestProfile(profileDir):
def createReftestProfile(options, profileDir):
"Sets up a clean profile for reftest."
# Start with a clean slate.
@ -65,6 +65,8 @@ def createReftestProfile(profileDir):
prefsFile = open(os.path.join(profileDir, "user.js"), "w")
prefsFile.write("""user_pref("browser.dom.window.dump.enabled", true);
""")
prefsFile.write('user_pref("reftest.timeout", %d);' % options.timeout)
prefsFile.close()
# install the reftest extension bits into the profile
profileExtensionsPath = os.path.join(profileDir, "extensions")
@ -87,6 +89,10 @@ def main():
action = "append", dest = "extraProfileFiles",
default = [],
help = "copy specified files/dirs to testing profile")
parser.add_option("--timeout",
action = "store", dest = "timeout", type = "int",
default = 5 * 60 * 1000, # 5 minutes per bug 479518
help = "reftest will timeout in specified number of milleseconds. [default %default ms].")
parser.add_option("--leak-threshold",
action = "store", type = "int", dest = "leakThreshold",
default = 0,
@ -117,7 +123,7 @@ Are you executing $objdir/_tests/reftest/runreftest.py?""" \
profileDir = None
try:
profileDir = mkdtemp()
createReftestProfile(profileDir)
createReftestProfile(options, profileDir)
copyExtraFilesToProfile(options, profileDir)
# browser environment