Test only patch - Bug 899709 - gIsLessThanMacOSX_10_6 is no longer needed in head_update.js.in. r=bbondy
authorRobert Strong <robert.bugzilla@gmail.com>
Thu, 01 Aug 2013 10:19:01 -0700
changeset 140837 03a9b0dead08d1a99a48286ec187ee4b259d6cb7
parent 140836 1788bbaa0f6adfd096aefe87ac92359ef43afa32
child 140838 c4fcf8be2bd2ae240e6d0faaa2d5fa4a4e661cb4
push id1999
push userrstrong@mozilla.com
push dateThu, 01 Aug 2013 17:19:08 +0000
treeherderfx-team@03a9b0dead08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbondy
bugs899709
milestone25.0a1
Test only patch - Bug 899709 - gIsLessThanMacOSX_10_6 is no longer needed in head_update.js.in. r=bbondy
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_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/head_update.js.in
+++ b/toolkit/mozapps/update/test/unit/head_update.js.in
@@ -1956,20 +1956,16 @@ function getProcessArgs(aExtraArgs) {
 
   let args;
   if (IS_UNIX) {
     let launchScript = getLaunchScript();
     // Precreate the script with executable permissions
     launchScript.create(AUS_Ci.nsILocalFile.NORMAL_FILE_TYPE, PERMS_DIRECTORY);
 
     let scriptContents = "#! /bin/sh\n";
-    // On Mac OS X versions prior to 10.6 the i386 acrhitecture must be used.
-    if (gIsLessThanMacOSX_10_6) {
-      scriptContents += "arch -arch i386 ";
-    }
     scriptContents += gAppBinPath + " -no-remote -process-updates " +
                       aExtraArgs.join(" ") + " 1> " +
                       appConsoleLogPath + " 2>&1";
     writeFile(launchScript, scriptContents);
     logTestInfo("created " + launchScript.path + " containing:\n" +
                 scriptContents);
     args = [launchScript.path];
   }
@@ -2029,55 +2025,16 @@ function getLaunchScript() {
   let launchScript = do_get_file("/", true);
   launchScript.append("launch.sh");
   if (launchScript.exists()) {
     launchScript.remove(false);
   }
   return launchScript;
 }
 
-// A shell script is used to get the OS version due to nsSystemInfo not
-// returning the actual OS version. It is possible to get the actual OS version
-// using ctypes but it would be more complicated than using a shell script.
-XPCOMUtils.defineLazyGetter(this, "gIsLessThanMacOSX_10_6", function test_gMacVer() {
-  if (!IS_MACOSX) {
-    return false;
-  }
-
-  let [versionScript, versionFile] = getVersionScriptAndFile();
-  // Precreate the script with executable permissions
-  versionScript.create(AUS_Ci.nsILocalFile.NORMAL_FILE_TYPE, PERMS_DIRECTORY);
-  let scriptContents = "#! /bin/sh\nsw_vers -productVersion >> " + versionFile.path;
-  writeFile(versionScript, scriptContents);
-  logTestInfo("created " + versionScript.path + " shell script containing:\n" +
-              scriptContents);
-
-  let versionScriptPath = versionScript.path;
-  if (/ /.test(versionScriptPath)) {
-    versionScriptPath = '"' + versionScriptPath + '"';
-  }
-
-
-  let launchBin = getLaunchBin();
-  let args = [versionScriptPath];
-  let process = AUS_Cc["@mozilla.org/process/util;1"].
-                createInstance(AUS_Ci.nsIProcess);
-  process.init(launchBin);
-  process.run(true, args, args.length);
-  if (process.exitValue != 0) {
-    do_throw("Version script exited with " + process.exitValue + "... unable " +
-             "to get Mac OS X version!");
-  }
-
-  let version = readFile(versionFile).split("\n")[0];
-  logTestInfo("executing on Mac OS X verssion " + version);
-
-  return (Services.vc.compare(version, "10.6") < 0)
-});
-
 /**
  * Checks for the existence of a platform specific application binary that can
  * be used for the test and gets its path if it is found.
  *
  * Note: The application shell scripts for launching the application work on all
  * platforms that provide a launch shell script except for Mac OS X 10.5 which
  * is why this test uses the binaries to launch the application.
  */
@@ -2258,40 +2215,16 @@ let gTimerCallback = {
     if (gProcess.isRunning) {
       gProcess.kill();
     }
     do_throw("launch application timer expired");
   },
   QueryInterface: XPCOMUtils.generateQI([AUS_Ci.nsITimerCallback])
 };
 
-/**
- * Gets the nsIFile references for the shell script to retrieve the Mac OS X
- * version and the nsIFile to pipe the output of the shell script. If either of
- * these files exist they will be removed by this function.
- *
- * @return  array containing two nsIFile references. The first array member is
- *          the nsIFile for the shell script to launch to get the Mac OS X
- *          version and the second array member is the nsIFile for the piped
- *          output from the shell script.
- */
-function getVersionScriptAndFile() {
-  let versionScript = do_get_file("/", true);
-  let versionFile = versionScript.clone();
-  versionScript.append("get_version.sh");
-  if (versionScript.exists()) {
-    versionScript.remove(false);
-  }
-  versionFile.append("version.out");
-  if (versionFile.exists()) {
-    versionFile.remove(false);
-  }
-  return [versionScript, versionFile];
-}
-
 // Environment related globals
 let gShouldResetEnv = undefined;
 let gAddedEnvXRENoWindowsCrashDialog = false;
 let gEnvXPCOMDebugBreak;
 let gEnvXPCOMMemLeakLog;
 let gEnvDyldLibraryPath;
 let gEnvLdLibraryPath;
 let gEnvUpdateRootOverride = null;
--- 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
@@ -193,20 +193,16 @@ function end_test() {
   }
   catch (e) {
     logTestInfo("unable to remove file during end_test. Exception: " + e);
   }
 
   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();
-    }
   }
 
   cleanUp();
 }
 
 /**
  * Gets the directory where the update adds / removes the files contained in 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
@@ -252,20 +252,16 @@ function end_test() {
   catch (e) {
     logTestInfo("unable to remove directory - path: " + updateTestDir.path +
                 ", exception: " + e);
   }
 
   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();
-    }
   }
 
   cleanUp();
 }
 
 function shouldAdjustPathsOnMac() {
   // When running xpcshell tests locally, xpcshell and firefox-bin do not live
   // in the same directory.
--- 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
@@ -218,20 +218,16 @@ function end_test() {
   updateSettingsIni.append(FILE_UPDATE_SETTINGS_INI_BAK);
   if (updateSettingsIni.exists()) {
     updateSettingsIni.moveTo(processDir, FILE_UPDATE_SETTINGS_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();
-    }
   }
 
   cleanUp();
 }
 
 function shouldAdjustPathsOnMac() {
   // When running xpcshell tests locally, xpcshell and firefox-bin do not live
   // in the same directory.
--- 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
@@ -281,20 +281,16 @@ function end_test() {
   catch (e) {
     logTestInfo("unable to remove directory - path: " + updateTestDir.path +
                 ", exception: " + e);
   }
 
   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();
-    }
   }
 
   cleanUp();
 }
 
 function shouldAdjustPathsOnMac() {
   // When running xpcshell tests locally, xpcshell and firefox-bin do not live
   // in the same directory.
--- 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
@@ -258,20 +258,16 @@ function end_test() {
   catch (e) {
     logTestInfo("unable to remove directory - path: " + updateTestDir.path +
                 ", exception: " + e);
   }
 
   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();
-    }
   }
 
   cleanUp();
 }
 
 function shouldAdjustPathsOnMac() {
   // When running xpcshell tests locally, xpcshell and firefox-bin do not live
   // in the same directory.
--- 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
@@ -227,20 +227,16 @@ function end_test() {
   catch (e) {
     logTestInfo("unable to remove directory - path: " + updateTestDir.path +
                 ", exception: " + e);
   }
 
   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();
-    }
   }
 
   cleanUp();
 }
 
 function shouldAdjustPathsOnMac() {
   // When running xpcshell tests locally, xpcshell and firefox-bin do not live
   // in the same directory.
--- 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
@@ -284,20 +284,16 @@ function end_test() {
   catch (e) {
     logTestInfo("unable to remove directory - path: " + updateTestDir.path +
                 ", exception: " + e);
   }
 
   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();
-    }
   }
 
   cleanUp();
 }
 
 function shouldAdjustPathsOnMac() {
   // When running xpcshell tests locally, xpcshell and firefox-bin do not live
   // in the same directory.