Bug 766264 Fix test failures in test_0201_app_launch_apply_update.js and test_0203_app_launch_apply_update.js when MOZ_MAINTENANCE_SERVICE isn't set for the build by correctly handling the applied state value. Also tidy up some error statements to provide better debug. r=ehsan
authorMark Banner <bugzilla@standard8.plus.com>
Thu, 05 Jul 2012 08:42:03 +0100
changeset 98389 675f55c4310cb363115fe7061c5aa2998acd29da
parent 98388 76fd67373e897d6407d73b4bb3bb1b18e27ed13b
child 98403 7209f9f14a7d9c53d0f1be3dde40ac495c38cc89
push id11465
push usereakhgari@mozilla.com
push dateThu, 05 Jul 2012 15:14:00 +0000
treeherdermozilla-inbound@f4e2d7842325 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs766264
milestone16.0a1
first release with
nightly linux32
675f55c4310c / 16.0a1 / 20120705030540 / files
nightly linux64
675f55c4310c / 16.0a1 / 20120705030540 / files
nightly mac
675f55c4310c / 16.0a1 / 20120705030540 / files
nightly win32
675f55c4310c / 16.0a1 / 20120705030540 / files
nightly win64
675f55c4310c / 16.0a1 / 20120705030540 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 766264 Fix test failures in test_0201_app_launch_apply_update.js and test_0203_app_launch_apply_update.js when MOZ_MAINTENANCE_SERVICE isn't set for the build by correctly handling the applied state value. Also tidy up some error statements to provide better debug. r=ehsan
toolkit/mozapps/update/test/Makefile.in
toolkit/mozapps/update/test/unit/head_update.js.in
toolkit/mozapps/update/test/unit/test_0200_app_launch_apply_update.js
toolkit/mozapps/update/test/unit/test_0201_app_launch_apply_update.js
toolkit/mozapps/update/test/unit/test_0203_app_launch_apply_update.js
toolkit/mozapps/update/test_svc/unit/test_0200_app_launch_apply_update_svc.js
toolkit/mozapps/update/test_svc/unit/test_0201_app_launch_apply_update_svc.js
toolkit/mozapps/update/test_svc/unit/test_0203_app_launch_apply_update_svc.js
--- a/toolkit/mozapps/update/test/Makefile.in
+++ b/toolkit/mozapps/update/test/Makefile.in
@@ -20,16 +20,20 @@ DEFINES += \
   -DAB_CD=$(AB_CD) \
   -DMOZ_APP_NAME=$(MOZ_APP_NAME) \
   -DMOZ_APP_DISPLAYNAME=$(MOZ_APP_DISPLAYNAME) \
   -DBIN_SUFFIX=$(BIN_SUFFIX) \
   -DNS_NO_XPCOM \
   -DMOZ_DEBUG=$(MOZ_DEBUG) \
   $(NULL)
 
+ifdef MOZ_MAINTENANCE_SERVICE
+DEFINES += -DMOZ_MAINTENANCE_SERVICE=$(MOZ_MAINTENANCE_SERVICE)
+endif
+
 # Android doesn't build the updater binary, so it skips the things that test it.
 ifneq ($(OS_TARGET),Android)
 DIRS = \
   chrome \
   $(NULL)
 
 CPPSRCS = \
   TestAUSReadStrings.cpp \
--- a/toolkit/mozapps/update/test/unit/head_update.js.in
+++ b/toolkit/mozapps/update/test/unit/head_update.js.in
@@ -283,17 +283,21 @@ var ADDITIONAL_TEST_DIRS = [];
 
 // Set to true to log additional information for debugging. To log additional
 // information for an individual test set DEBUG_AUS_TEST to true in the test's
 // run_test function.
 var DEBUG_AUS_TEST = true;
 
 #include ../shared.js
 
+#ifdef MOZ_MAINTENANCE_SERVICE
 const STATE_APPLIED_PLATFORM = IS_WIN ? STATE_APPLIED_SVC : STATE_APPLIED;
+#else
+const STATE_APPLIED_PLATFORM = STATE_APPLIED;
+#endif
 
 /**
  * Nulls out the most commonly used global vars used by tests as appropriate.
  */
 function cleanUp() {
   removeUpdateDirsAndFiles();
 
   // Force the update manager to reload the update data to prevent it from
--- a/toolkit/mozapps/update/test/unit/test_0200_app_launch_apply_update.js
+++ b/toolkit/mozapps/update/test/unit/test_0200_app_launch_apply_update.js
@@ -242,27 +242,27 @@ function getUpdateTestDir() {
 function checkUpdateFinished() {
   gTimeoutRuns++;
   // Don't proceed until the update.log has been created.
   let log = getUpdatesDir();
   log.append("0");
   log.append(FILE_UPDATE_LOG);
   if (!log.exists()) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS)
-      do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for updates log to be created");
+      do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for updates log to be created at " + log.path);
     else
       do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished);
     return;
   }
 
   // Don't proceed until the update status is no longer pending or applying.
   let status = readStatusFile();
   if (status == STATE_PENDING || status == STATE_APPLYING) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS)
-      do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for updates status to not be pending or applying");
+      do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for updates status to not be pending or applying, current status is: " + status);
     else
       do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished);
     return;
   }
 
   // Log the contents of the update.log so it is simpler to diagnose a test
   // failure. For example, on Windows if the application binary is in use the
   // updater will not apply the update.
--- 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
@@ -330,17 +330,17 @@ function getUpdateTestDir() {
 /**
  * Checks if the update has finished being applied in the background.
  */
 function checkUpdateApplied() {
   gTimeoutRuns++;
   // Don't proceed until the update has been applied.
   if (gUpdateManager.activeUpdate.state != STATE_APPLIED_PLATFORM) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS)
-      do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for update to be applied");
+      do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for update to be applied, current state is: " + gUpdateManager.activeUpdate.state);
     else
       do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateApplied);
     return;
   }
 
   let updatedDir = getAppDir();
   if (IS_MACOSX) {
     updatedDir = updatedDir.parent.parent;
@@ -468,17 +468,17 @@ function checkUpdateApplied() {
  */
 function checkUpdateFinished() {
   gTimeoutRuns++;
   // Don't proceed until the update status is no longer applied.
   try {
     let status = readStatusFile();
     if (status != STATE_SUCCEEDED) {
       if (gTimeoutRuns > MAX_TIMEOUT_RUNS)
-        do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for succeeded state");
+        do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for state to change to succeeded, current status: " + status);
       else
         do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished);
       return;
     }
   } catch (e) {
     // Ignore exceptions if the status file is not found
   }
 
--- 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
@@ -358,17 +358,17 @@ function getUpdateTestDir() {
 /**
  * Checks if the update has finished being applied in the background.
  */
 function checkUpdateApplied() {
   gTimeoutRuns++;
   // Don't proceed until the update has been applied.
   if (gUpdateManager.activeUpdate.state != STATE_APPLIED_PLATFORM) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS)
-      do_throw("Exceeded whilst waiting for update to be applied");
+      do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for update to be applied, current state is: " + gUpdateManager.activeUpdate.state);
     else
       do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateApplied);
     return;
   }
 
   let updatedDir = getAppDir();
   if (IS_MACOSX) {
     updatedDir = updatedDir.parent.parent;
@@ -496,17 +496,17 @@ function checkUpdateApplied() {
  */
 function checkUpdateFinished() {
   // Don't proceed until the update status is no longer applied.
   gTimeoutRuns++;
   try {
     let status = readStatusFile();
     if (status != STATE_SUCCEEDED) {
       if (gTimeoutRuns > MAX_TIMEOUT_RUNS)
-        do_throw("Exceeded whilst waiting for succeeded state");
+        do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for state to change to succeeded, current status: " + status);
       else
         do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished);
       return;
     }
   } catch (e) {
     // Ignore exceptions if the status file is not found
   }
 
--- a/toolkit/mozapps/update/test_svc/unit/test_0200_app_launch_apply_update_svc.js
+++ b/toolkit/mozapps/update/test_svc/unit/test_0200_app_launch_apply_update_svc.js
@@ -199,17 +199,17 @@ function getUpdateTestDir() {
  */
 function checkUpdateFinished() {
   // Don't proceed until the update.log has been created.
   let log = getUpdatesDir();
   log.append("0");
   log.append(FILE_UPDATE_LOG);
   if (!log.exists()) {
     if (++gTimeoutRuns > MAX_TIMEOUT_RUNS)
-      do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for updates log to be created");
+      do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for updates log to be created at " + log.path);
     else
       do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished);
     return;
   }
 
   // Log the contents of the update.log so it is simpler to diagnose a test
   // failure. For example, on Windows if the application binary is in use the
   // updater will not apply the update.
--- 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
@@ -337,35 +337,35 @@ function getUpdateTestDir() {
 
 /**
  * Checks if the update has finished being applied in the background.
  */
 function checkUpdateApplied() {
   gTimeoutRuns++;
   // Don't proceed until the update has been applied.
   if (gUpdateManager.activeUpdate.state != STATE_APPLIED_PLATFORM) {
-    if (++gTimeoutRuns > MAX_TIMEOUT_RUNS)
-      do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for state to be applied to platform");
+    if (gTimeoutRuns > MAX_TIMEOUT_RUNS)
+      do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for update to be applied, current state is: " + gUpdateManager.activeUpdate.state);
     else
       do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateApplied);
     return;
   }
 
   let updatedDir = getAppDir();
   if (IS_MACOSX) {
     updatedDir = updatedDir.parent.parent;
   }
   updatedDir.append(UPDATED_DIR_SUFFIX.replace("/", ""));
   logTestInfo("testing " + updatedDir.path + " should exist");
   do_check_true(updatedDir.exists());
 
   let log = getUpdatesDir();
   log.append(FILE_LAST_LOG);
   if (!log.exists()) {
-    if (++gTimeoutRuns > MAX_TIMEOUT_RUNS)
+    if (gTimeoutRuns > MAX_TIMEOUT_RUNS)
       do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for update log to be created");
     else
       do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateApplied);
     return;
   }
 
   // Don't proceed until the update status is no longer pending or applying.
   let status = readStatusFile();
@@ -450,34 +450,34 @@ function checkUpdateApplied() {
  * the test.
  */
 function checkUpdateFinished() {
   gTimeoutRuns++;
   // Don't proceed until the update status is no longer applied.
   try {
     let status = readStatusFile();
     if (status != STATE_SUCCEEDED) {
-      if (++gTimeoutRuns > MAX_TIMEOUT_RUNS)
-        do_throw("Exceeded MAX_TIMEOUT_RUNS whist waiting for succeeded state");
+      if (gTimeoutRuns > MAX_TIMEOUT_RUNS)
+        do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for state to change to succeeded, current status: " + status);
       else
         do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished);
       return;
     }
   } catch (e) {
     // Ignore exceptions if the status file is not found
   }
 
   try {
     // This will delete the app console log file if it exists.
     getAppConsoleLogPath();
   } catch (e) {
     if (e.result == Components.results.NS_ERROR_FILE_IS_LOCKED) {
       // This might happen on Windows in case the callback application has not
       // finished its job yet.  So, we'll wait some more.
-      if (++gTimeoutRuns > MAX_TIMEOUT_RUNS)
+      if (gTimeoutRuns > MAX_TIMEOUT_RUNS)
         do_throw("Exceeded whilst waiting for file to be unlocked");
       else
         do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished);
       return;
     } else {
       do_throw("getAppConsoleLogPath threw: " + e);
     }
   }
--- 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
@@ -367,17 +367,17 @@ function getUpdateTestDir() {
 /**
  * Checks if the update has finished being applied in the background.
  */
 function checkUpdateApplied() {
   gTimeoutRuns++;
   // Don't proceed until the update has been applied.
   if (gUpdateManager.activeUpdate.state != STATE_APPLIED_PLATFORM) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS)
-      do_throw("Exceeded MAX_TIMEOUT_RUNS whist waiting for update to be applied to the platform");
+      do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for update to be applied, current state is: " + gUpdateManager.activeUpdate.state);
     else
       do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateApplied);
     return;
   }
 
   let updatedDir = getAppDir();
   if (IS_MACOSX) {
     updatedDir = updatedDir.parent.parent;
@@ -480,17 +480,17 @@ function checkUpdateApplied() {
  */
 function checkUpdateFinished() {
   gTimeoutRuns++;
   // Don't proceed until the update status is no longer applied.
   try {
     let status = readStatusFile();
     if (status != STATE_SUCCEEDED) {
       if (gTimeoutRuns > MAX_TIMEOUT_RUNS)
-        do_throw("Exceeded MAX_TIMEOUT_RUNS whist waiting for success status");
+        do_throw("Exceeded MAX_TIMEOUT_RUNS whilst waiting for state to change to succeeded, current status: " + status);
       else
         do_timeout(CHECK_TIMEOUT_MILLI, checkUpdateFinished);
       return;
     }
   } catch (e) {
     // Ignore exceptions if the status file is not found
   }