Bug 1552657 (xpcshell test only) - Fix app update xpcshell tests so it is possible to run them locally. r=bytesized, a=testonly
authorRobert Strong <robert.bugzilla@gmail.com>
Tue, 21 May 2019 10:30:32 -0700
changeset 536378 e9d9035e11e58302276689eeda113513ab1165de
parent 536377 958825ce740165cc1afe064deed6bb8d0be6864c
child 536379 93b9f438f63997e94a1e2b395d8a1fe7297d3965
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbytesized, testonly
bugs1552657
milestone68.0
Bug 1552657 (xpcshell test only) - Fix app update xpcshell tests so it is possible to run them locally. r=bytesized, a=testonly 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");