Bug 1552657 (xpcshell test only) - Fix app update xpcshell tests so it is possible to run them locally. r=bytesized
authorRobert Strong <robert.bugzilla@gmail.com>
Mon, 20 May 2019 16:42:47 +0000
changeset 474563 2adbd9cb0977c797d152abbc7b6411ce1e507e1e
parent 474562 67e2703726dad4f41430ba2962695d8fb9cdb31d
child 474564 8b074e2a3b68a339928e5b9f1d52f712e4bfce44
push id36042
push userdvarga@mozilla.com
push dateTue, 21 May 2019 04:19:40 +0000
treeherdermozilla-central@ca560ff55451 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbytesized
bugs1552657
milestone69.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
Bug 1552657 (xpcshell test only) - Fix app update xpcshell tests so it is possible to run them locally. r=bytesized Specify a profile when running marAppApply* xpcshell tests to prevent the application from trying to display the profile manager Don't unset LD_LIBRARY_PATH when running the tests on Linux so startup dependencies can be found Differential Revision: https://phabricator.services.mozilla.com/D31740
toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
--- a/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
+++ b/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
@@ -138,17 +138,16 @@ var gPostUpdateBinFile = "postup_app" + 
 var gTimeoutRuns = 0;
 
 // Environment related globals
 var gShouldResetEnv = undefined;
 var gAddedEnvXRENoWindowsCrashDialog = false;
 var gEnvXPCOMDebugBreak;
 var gEnvXPCOMMemLeakLog;
 var gEnvDyldLibraryPath;
-var gEnvLdLibraryPath;
 
 const URL_HTTP_UPDATE_SJS = "http://test_details/";
 const DATA_URI_SPEC = Services.io.newFileURI(do_get_file("", false)).spec;
 
 /* import-globals-from shared.js */
 load("shared.js");
 
 // Set to true to log additional information for debugging. To log additional
@@ -3651,31 +3650,42 @@ function getProcessArgs(aExtraArgs) {
   let appBin = getApplyDirFile(DIR_MACOS + FILE_APP_BIN);
   Assert.ok(appBin.exists(),
             MSG_SHOULD_EXIST + ", path: " + appBin.path);
   let appBinPath = appBin.path;
   if (/ /.test(appBinPath)) {
     appBinPath = '"' + appBinPath + '"';
   }
 
+  // The profile must be specified for the tests that launch the application to
+  // run locally when the profiles.ini and installs.ini files already exist.
+  let profileDir = appBin.parent.parent;
+  profileDir.append("profile");
+  let profilePath = profileDir.path;
+  if (/ /.test(profilePath)) {
+    profilePath = '"' + profilePath + '"';
+  }
+
   let args;
   if (AppConstants.platform == "macosx" || AppConstants.platform == "linux") {
     let launchScript = getLaunchScript();
     // Precreate the script with executable permissions
     launchScript.create(Ci.nsIFile.NORMAL_FILE_TYPE, PERMS_DIRECTORY);
 
     let scriptContents = "#! /bin/sh\n";
+    scriptContents += "export XRE_PROFILE_PATH=" + profilePath + "\n";
     scriptContents += appBinPath + " -no-remote -test-process-updates " +
                       aExtraArgs.join(" ") + " " + PIPE_TO_NULL;
     writeFile(launchScript, scriptContents);
     debugDump("created " + launchScript.path + " containing:\n" +
               scriptContents);
     args = [launchScript.path];
   } else {
-    args = ["/D", "/Q", "/C", appBinPath, "-no-remote", "-test-process-updates",
+    args = ["/D", "/Q", "/C", "set", "XRE_PROFILE_PATH=" + profilePath, "&&",
+            appBinPath, "-no-remote", "-test-process-updates",
             "-wait-for-browser"].concat(aExtraArgs).concat([PIPE_TO_NULL]);
   }
   return args;
 }
 
 /**
  * Gets a file path for the application to dump its arguments into.  This is used
  * to verify that a callback application is launched.
@@ -4033,24 +4043,16 @@ function setEnvironment() {
 
     if (shouldSetEnv) {
       debugDump("setting DYLD_LIBRARY_PATH environment variable value to " +
                 appGreBinDir.path);
       gEnv.set("DYLD_LIBRARY_PATH", appGreBinDir.path);
     }
   }
 
-  if (AppConstants.platform == "linux" && gEnv.exists("LD_LIBRARY_PATH")) {
-    gEnvLdLibraryPath = gEnv.get("LD_LIBRARY_PATH");
-    debugDump("removing LD_LIBRARY_PATH environment variable");
-    // By removing the LD_LIBRARY_PATH environment variable this will test
-    // that setting the rpath for the updater is working properly.
-    gEnv.set("LD_LIBRARY_PATH", "");
-  }
-
   if (gEnv.exists("XPCOM_MEM_LEAK_LOG")) {
     gEnvXPCOMMemLeakLog = gEnv.get("XPCOM_MEM_LEAK_LOG");
     debugDump("removing the XPCOM_MEM_LEAK_LOG environment variable... " +
               "previous value " + gEnvXPCOMMemLeakLog);
     gEnv.set("XPCOM_MEM_LEAK_LOG", "");
   }
 
   if (gEnv.exists("XPCOM_DEBUG_BREAK")) {
@@ -4103,22 +4105,16 @@ function resetEnvironment() {
                 "back to " + gEnvDyldLibraryPath);
       gEnv.set("DYLD_LIBRARY_PATH", gEnvDyldLibraryPath);
     } else if (gEnvDyldLibraryPath !== null) {
       debugDump("removing DYLD_LIBRARY_PATH environment variable");
       gEnv.set("DYLD_LIBRARY_PATH", "");
     }
   }
 
-  if (AppConstants.platform == "linux" && gEnvLdLibraryPath) {
-    debugDump("setting LD_LIBRARY_PATH environment variable value back " +
-              "to " + gEnvLdLibraryPath);
-    gEnv.set("LD_LIBRARY_PATH", gEnvLdLibraryPath);
-  }
-
   if (AppConstants.platform == "win" && gAddedEnvXRENoWindowsCrashDialog) {
     debugDump("removing the XRE_NO_WINDOWS_CRASH_DIALOG environment " +
               "variable");
     gEnv.set("XRE_NO_WINDOWS_CRASH_DIALOG", "");
   }
 
   if (gIsServiceTest) {
     debugDump("removing MOZ_NO_SERVICE_FALLBACK environment variable");