From 7328385057bc5f6aa4daca8281b90c64e328a354 Mon Sep 17 00:00:00 2001 From: Robert Strong Date: Wed, 28 Aug 2013 15:42:43 -0700 Subject: [PATCH] Test only - additional logging for Bug 909489 - Intermittent test_0202_app_launch_apply_update_dirlocked.js | Test timed out | test failed (with xpcshell return code: 1). r=bbondy --- toolkit/mozapps/update/test/shared.js | 13 +++++++++++-- toolkit/mozapps/update/test/unit/head_update.js.in | 4 ++++ .../test_0202_app_launch_apply_update_dirlocked.js | 6 ++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/toolkit/mozapps/update/test/shared.js b/toolkit/mozapps/update/test/shared.js index afc67f1b142a..ee5b7293bac0 100644 --- a/toolkit/mozapps/update/test/shared.js +++ b/toolkit/mozapps/update/test/shared.js @@ -590,8 +590,17 @@ function getUpdatedDir() { */ function logTestInfo(aText, aCaller) { let caller = (aCaller ? aCaller : Components.stack.caller); - dump("TEST-INFO | " + caller.filename + " | [" + caller.name + " : " + - caller.lineNumber + "] " + aText + "\n"); + let now = new Date; + let hh = now.getHours(); + let mm = now.getMinutes(); + let ss = now.getSeconds(); + let ms = now.getMilliseconds(); + let time = (hh < 10 ? "0" + hh : hh) + ":" + + (mm < 10 ? "0" + mm : mm) + ":" + + (ss < 10 ? "0" + ss : ss) + ":" + + (ms < 10 ? "00" + ms : ms < 100 ? "0" + ms : ms); + dump(time + " | TEST-INFO | " + caller.filename + " | [" + caller.name + + " : " + caller.lineNumber + "] " + aText + "\n"); } /** diff --git a/toolkit/mozapps/update/test/unit/head_update.js.in b/toolkit/mozapps/update/test/unit/head_update.js.in index 988e7d9a9473..e11739881f7b 100644 --- a/toolkit/mozapps/update/test/unit/head_update.js.in +++ b/toolkit/mozapps/update/test/unit/head_update.js.in @@ -2076,13 +2076,16 @@ function shouldAdjustPathsOnMac() { * files. */ function adjustPathsOnWindows() { + logTestInfo("start - setup new process directory"); // We copy the entire GRE directory into another location so that xpcshell // running doesn't prevent the updater from moving stuff around. let tmpDir = do_get_profile(); tmpDir.append("ExecutableDir.tmp"); tmpDir.createUnique(tmpDir.DIRECTORY_TYPE, 0755); let procDir = getCurrentProcessDir(); + logTestInfo("start - copy the process directory"); copyDirRecursive(procDir, tmpDir, "bin"); + logTestInfo("finish - copy the process directory"); let newDir = tmpDir.clone(); newDir.append("bin"); gWindowsBinDir = newDir; @@ -2113,6 +2116,7 @@ function adjustPathsOnWindows() { do_register_cleanup(function() { ds.unregisterProvider(dirProvider); }); + logTestInfo("finish - setup new process directory"); } let gWindowsBinDir = null; diff --git a/toolkit/mozapps/update/test/unit/test_0202_app_launch_apply_update_dirlocked.js b/toolkit/mozapps/update/test/unit/test_0202_app_launch_apply_update_dirlocked.js index 92684ebec79c..1cf78ca7df12 100644 --- a/toolkit/mozapps/update/test/unit/test_0202_app_launch_apply_update_dirlocked.js +++ b/toolkit/mozapps/update/test/unit/test_0202_app_launch_apply_update_dirlocked.js @@ -105,6 +105,8 @@ function run_test() { do_test_pending(); do_register_cleanup(end_test); + logTestInfo("setting up environment for the update test..."); + removeUpdateDirsAndFiles(); symlinkUpdateFilesIntoBundleDirectory(); @@ -186,10 +188,12 @@ function run_test() { writeFile(updateSettingsIni, UPDATE_SETTINGS_CONTENTS); // Initiate a background update. + logTestInfo("update preparation completed - calling processUpdate"); AUS_Cc["@mozilla.org/updates/update-processor;1"]. createInstance(AUS_Ci.nsIUpdateProcessor). processUpdate(gActiveUpdate); + logTestInfo("processUpdate completed - calling checkUpdateApplied"); checkUpdateApplied(); } @@ -261,6 +265,8 @@ function checkUpdateApplied() { return; } + logTestInfo("update state equals " + gUpdateManager.activeUpdate.state); + // Don't proceed until the update status is pending. let status = readStatusFile(); do_check_eq(status, STATE_PENDING);