Partial fix (all but test_0201_app_launch_apply_update_svc.js) for - Bug 762032 - Intermittent test_0201_app_launch_apply_update.js, test_0201_app_launch_apply_update_svc.js test_0203_app_launch_apply_update_svc.js | WindowsError: [Error 13] The process cannot access the file because it is being used by another process: '...helper.exe'. r=bbondy
authorRobert Strong <robert.bugzilla@gmail.com>
Thu, 13 Dec 2012 09:43:27 -0800
changeset 115945 049f91872fbfbbb241f65ca581988a2ed0e6f2f8
parent 115944 3e3800d9e4b67eb1c62da4fc96aa4cbd4bde54d6
child 115946 3cfc257e29a5a3725207fbaa0bf184e3719c8b73
push id24034
push useremorley@mozilla.com
push dateFri, 14 Dec 2012 15:28:57 +0000
treeherdermozilla-central@50d8f411d305 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbondy
bugs762032
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Partial fix (all but test_0201_app_launch_apply_update_svc.js) for - Bug 762032 - Intermittent test_0201_app_launch_apply_update.js, test_0201_app_launch_apply_update_svc.js test_0203_app_launch_apply_update_svc.js | WindowsError: [Error 13] The process cannot access the file because it is being used by another process: '...helper.exe'. r=bbondy
toolkit/mozapps/update/test/unit/test_0201_app_launch_apply_update.js
toolkit/mozapps/update/test/unit/test_0202_app_launch_apply_update_dirlocked.js
toolkit/mozapps/update/test/unit/test_0203_app_launch_apply_update.js
toolkit/mozapps/update/test_svc/unit/test_0201_app_launch_apply_update_svc.js
toolkit/mozapps/update/test_svc/unit/test_0202_app_launch_apply_update_dirlocked_svc.js
toolkit/mozapps/update/test_svc/unit/test_0203_app_launch_apply_update_svc.js
--- a/toolkit/mozapps/update/test/unit/test_0201_app_launch_apply_update.js
+++ b/toolkit/mozapps/update/test/unit/test_0201_app_launch_apply_update.js
@@ -157,16 +157,24 @@ function run_test() {
   updatesPatchDir.append("0");
   let mar = do_get_file("data/simple.mar");
   mar.copyTo(updatesPatchDir, FILE_UPDATE_ARCHIVE);
 
   reloadUpdateManagerData();
   gActiveUpdate = gUpdateManager.activeUpdate;
   do_check_true(!!gActiveUpdate);
 
+  // Backup the updater.ini if it exists by moving it. This prevents the post
+  // update executable from being launched if it is specified.
+  let updaterIni = processDir.clone();
+  updaterIni.append(FILE_UPDATER_INI);
+  if (updaterIni.exists()) {
+    updaterIni.moveTo(processDir, FILE_UPDATER_INI_BAK);
+  }
+
   let updateSettingsIni = processDir.clone();
   updateSettingsIni.append(UPDATE_SETTINGS_INI_FILE);
   writeFile(updateSettingsIni, UPDATE_SETTINGS_CONTENTS);
 
   // Initiate a background update.
   AUS_Cc["@mozilla.org/updates/update-processor;1"].
     createInstance(AUS_Ci.nsIUpdateProcessor).
     processUpdate(gActiveUpdate);
@@ -203,16 +211,24 @@ function end_test() {
   if (gAppTimer) {
     logTestInfo("cancelling timer");
     gAppTimer.cancel();
     gAppTimer = null;
   }
 
   resetEnvironment();
 
+  let processDir = getAppDir();
+  // Restore the backup of the updater.ini if it exists
+  let updaterIni = processDir.clone();
+  updaterIni.append(FILE_UPDATER_INI_BAK);
+  if (updaterIni.exists()) {
+    updaterIni.moveTo(processDir, FILE_UPDATER_INI);
+  }
+
   // Remove the files added by the update.
   let updateTestDir = getUpdateTestDir();
   try {
     logTestInfo("removing update test directory " + updateTestDir.path);
     removeDirRecursive(updateTestDir);
   }
   catch (e) {
     logTestInfo("unable to remove directory - path: " + updateTestDir.path +
--- 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
@@ -163,16 +163,24 @@ function run_test() {
   updatesPatchDir.append("0");
   let mar = do_get_file("data/simple.mar");
   mar.copyTo(updatesPatchDir, FILE_UPDATE_ARCHIVE);
 
   reloadUpdateManagerData();
   gActiveUpdate = gUpdateManager.activeUpdate;
   do_check_true(!!gActiveUpdate);
 
+  // Backup the updater.ini if it exists by moving it. This prevents the post
+  // update executable from being launched if it is specified.
+  let updaterIni = processDir.clone();
+  updaterIni.append(FILE_UPDATER_INI);
+  if (updaterIni.exists()) {
+    updaterIni.moveTo(processDir, FILE_UPDATER_INI_BAK);
+  }
+
   let updateSettingsIni = processDir.clone();
   updateSettingsIni.append(UPDATE_SETTINGS_INI_FILE);
   writeFile(updateSettingsIni, UPDATE_SETTINGS_CONTENTS);
 
   // Initiate a background update.
   AUS_Cc["@mozilla.org/updates/update-processor;1"].
     createInstance(AUS_Ci.nsIUpdateProcessor).
     processUpdate(gActiveUpdate);
@@ -187,16 +195,24 @@ function end_test() {
     logTestInfo("removing update test directory " + updateTestDir.path);
     removeDirRecursive(updateTestDir);
   }
   catch (e) {
     logTestInfo("unable to remove directory - path: " + updateTestDir.path +
                 ", exception: " + e);
   }
 
+  let processDir = getAppDir();
+  // Restore the backup of the updater.ini if it exists
+  let updaterIni = processDir.clone();
+  updaterIni.append(FILE_UPDATER_INI_BAK);
+  if (updaterIni.exists()) {
+    updaterIni.moveTo(processDir, FILE_UPDATER_INI);
+  }
+
   if (IS_UNIX) {
     // This will delete the launch script if it exists.
     getLaunchScript();
     if (IS_MACOSX) {
       // This will delete the version script and version file if they exist.
       getVersionScriptAndFile();
     }
   }
--- a/toolkit/mozapps/update/test/unit/test_0203_app_launch_apply_update.js
+++ b/toolkit/mozapps/update/test/unit/test_0203_app_launch_apply_update.js
@@ -164,16 +164,24 @@ function run_test() {
   updatesPatchDir.append("0");
   let mar = do_get_file("data/simple.mar");
   mar.copyTo(updatesPatchDir, FILE_UPDATE_ARCHIVE);
 
   reloadUpdateManagerData();
   gActiveUpdate = gUpdateManager.activeUpdate;
   do_check_true(!!gActiveUpdate);
 
+  // Backup the updater.ini if it exists by moving it. This prevents the post
+  // update executable from being launched if it is specified.
+  let updaterIni = processDir.clone();
+  updaterIni.append(FILE_UPDATER_INI);
+  if (updaterIni.exists()) {
+    updaterIni.moveTo(processDir, FILE_UPDATER_INI_BAK);
+  }
+
   let updateSettingsIni = processDir.clone();
   updateSettingsIni.append(UPDATE_SETTINGS_INI_FILE);
   writeFile(updateSettingsIni, UPDATE_SETTINGS_CONTENTS);
 
   // Initiate a background update.
   AUS_Cc["@mozilla.org/updates/update-processor;1"].
     createInstance(AUS_Ci.nsIUpdateProcessor).
     processUpdate(gActiveUpdate);
@@ -231,16 +239,24 @@ function end_test() {
   if (gAppTimer) {
     logTestInfo("cancelling timer");
     gAppTimer.cancel();
     gAppTimer = null;
   }
 
   resetEnvironment();
 
+  let processDir = getAppDir();
+  // Restore the backup of the updater.ini if it exists
+  let updaterIni = processDir.clone();
+  updaterIni.append(FILE_UPDATER_INI_BAK);
+  if (updaterIni.exists()) {
+    updaterIni.moveTo(processDir, FILE_UPDATER_INI);
+  }
+
   // Remove the files added by the update.
   let updateTestDir = getUpdateTestDir();
   try {
     logTestInfo("removing update test directory " + updateTestDir.path);
     removeDirRecursive(updateTestDir);
   }
   catch (e) {
     logTestInfo("unable to remove directory - path: " + updateTestDir.path +
--- a/toolkit/mozapps/update/test_svc/unit/test_0201_app_launch_apply_update_svc.js
+++ b/toolkit/mozapps/update/test_svc/unit/test_0201_app_launch_apply_update_svc.js
@@ -163,16 +163,27 @@ function run_test() {
   mar.copyTo(updatesPatchDir, FILE_UPDATE_ARCHIVE);
 
   reloadUpdateManagerData();
   gActiveUpdate = gUpdateManager.activeUpdate;
   do_check_true(!!gActiveUpdate);
 
   setEnvironment();
 
+  // Backup the updater.ini if it exists by moving it. This prevents the post
+  // update executable from being launched if it is specified.
+//XXX disabled until bug 820933 and bug 820934 are fixed
+if (0) {
+  let updaterIni = processDir.clone();
+  updaterIni.append(FILE_UPDATER_INI);
+  if (updaterIni.exists()) {
+    updaterIni.moveTo(processDir, FILE_UPDATER_INI_BAK);
+  }
+}
+
   let updateSettingsIni = processDir.clone();
   updateSettingsIni.append(UPDATE_SETTINGS_INI_FILE);
   writeFile(updateSettingsIni, UPDATE_SETTINGS_CONTENTS);
 
   // Initiate a background update.
   AUS_Cc["@mozilla.org/updates/update-processor;1"].
     createInstance(AUS_Ci.nsIUpdateProcessor).
     processUpdate(gActiveUpdate);
@@ -211,16 +222,24 @@ function end_test() {
   if (gAppTimer) {
     logTestInfo("cancelling timer");
     gAppTimer.cancel();
     gAppTimer = null;
   }
 
   resetEnvironment();
 
+  let processDir = getAppDir();
+  // Restore the backup of the updater.ini if it exists
+  let updaterIni = processDir.clone();
+  updaterIni.append(FILE_UPDATER_INI_BAK);
+  if (updaterIni.exists()) {
+    updaterIni.moveTo(processDir, FILE_UPDATER_INI);
+  }
+
   // Remove the files added by the update.
   let updateTestDir = getUpdateTestDir();
   try {
     logTestInfo("removing update test directory " + updateTestDir.path);
     removeDirRecursive(updateTestDir);
   }
   catch (e) {
     logTestInfo("unable to remove directory - path: " + updateTestDir.path +
--- a/toolkit/mozapps/update/test_svc/unit/test_0202_app_launch_apply_update_dirlocked_svc.js
+++ b/toolkit/mozapps/update/test_svc/unit/test_0202_app_launch_apply_update_dirlocked_svc.js
@@ -165,29 +165,23 @@ function run_test() {
                 ", exception: " + e);
   }
 
   let updatesPatchDir = getUpdatesDir();
   updatesPatchDir.append("0");
   let mar = do_get_file("data/simple.mar");
   mar.copyTo(updatesPatchDir, FILE_UPDATE_ARCHIVE);
 
-  // Backup the updater.ini
+  // Backup the updater.ini if it exists by moving it. This prevents the post
+  // update executable from being launched if it is specified.
   let updaterIni = processDir.clone();
   updaterIni.append(FILE_UPDATER_INI);
-  updaterIni.moveTo(processDir, FILE_UPDATER_INI_BAK);
-  // Create a new updater.ini to avoid applications that provide a post update
-  // executable.
-  let updaterIniContents = "[Strings]\n" +
-                           "Title=Update Test\n" +
-                           "Info=Application Update XPCShell Test - " +
-                           "test_0200_general.js\n";
-  updaterIni = processDir.clone();
-  updaterIni.append(FILE_UPDATER_INI);
-  writeFile(updaterIni, updaterIniContents);
+  if (updaterIni.exists()) {
+    updaterIni.moveTo(processDir, FILE_UPDATER_INI_BAK);
+  }
 
   let updateSettingsIni = processDir.clone();
   updateSettingsIni.append(UPDATE_SETTINGS_INI_FILE);
   writeFile(updateSettingsIni, UPDATE_SETTINGS_CONTENTS);
 
   reloadUpdateManagerData();
   gActiveUpdate = gUpdateManager.activeUpdate;
   do_check_true(!!gActiveUpdate);
@@ -202,16 +196,24 @@ function run_test() {
   resetEnvironment();
 
   checkUpdateApplied();
 }
 
 function end_test() {
   resetEnvironment();
 
+  let processDir = getAppDir();
+  // Restore the backup of the updater.ini if it exists
+  let updaterIni = processDir.clone();
+  updaterIni.append(FILE_UPDATER_INI_BAK);
+  if (updaterIni.exists()) {
+    updaterIni.moveTo(processDir, FILE_UPDATER_INI);
+  }
+
   // Remove the files added by the update.
   let updateTestDir = getUpdateTestDir();
   try {
     logTestInfo("removing update test directory " + updateTestDir.path);
     removeDirRecursive(updateTestDir);
   }
   catch (e) {
     logTestInfo("unable to remove directory - path: " + updateTestDir.path +
--- a/toolkit/mozapps/update/test_svc/unit/test_0203_app_launch_apply_update_svc.js
+++ b/toolkit/mozapps/update/test_svc/unit/test_0203_app_launch_apply_update_svc.js
@@ -171,16 +171,24 @@ function run_test() {
   mar.copyTo(updatesPatchDir, FILE_UPDATE_ARCHIVE);
 
   reloadUpdateManagerData();
   gActiveUpdate = gUpdateManager.activeUpdate;
   do_check_true(!!gActiveUpdate);
 
   setEnvironment();
 
+  // Backup the updater.ini if it exists by moving it. This prevents the post
+  // update executable from being launched if it is specified.
+  let updaterIni = processDir.clone();
+  updaterIni.append(FILE_UPDATER_INI);
+  if (updaterIni.exists()) {
+    updaterIni.moveTo(processDir, FILE_UPDATER_INI_BAK);
+  }
+
   let updateSettingsIni = processDir.clone();
   updateSettingsIni.append(UPDATE_SETTINGS_INI_FILE);
   writeFile(updateSettingsIni, UPDATE_SETTINGS_CONTENTS);
 
   // Initiate a background update.
   AUS_Cc["@mozilla.org/updates/update-processor;1"].
     createInstance(AUS_Ci.nsIUpdateProcessor).
     processUpdate(gActiveUpdate);
@@ -240,16 +248,24 @@ function end_test() {
   if (gAppTimer) {
     logTestInfo("cancelling timer");
     gAppTimer.cancel();
     gAppTimer = null;
   }
 
   resetEnvironment();
 
+  let processDir = getAppDir();
+  // Restore the backup of the updater.ini if it exists
+  let updaterIni = processDir.clone();
+  updaterIni.append(FILE_UPDATER_INI_BAK);
+  if (updaterIni.exists()) {
+    updaterIni.moveTo(processDir, FILE_UPDATER_INI);
+  }
+
   // Remove the files added by the update.
   let updateTestDir = getUpdateTestDir();
   try {
     logTestInfo("removing update test directory " + updateTestDir.path);
     removeDirRecursive(updateTestDir);
   }
   catch (e) {
     logTestInfo("unable to remove directory - path: " + updateTestDir.path +