Back out changeset cd741d3ae78a (bug 1168737) for mochitest failures on Mac OS X 10.10.
authorL. David Baron <dbaron@dbaron.org>
Sat, 20 Jun 2015 22:51:48 -0700
changeset 249923 ed1115ca40839f7e31bca14293c447f2373fc550
parent 249922 b60de195ad59e7170b56a3f7470bf64aa69dc035
child 249924 b7653e3d5f919816b8e58750450ef505257027a8
push id28940
push usercbook@mozilla.com
push dateMon, 22 Jun 2015 12:03:34 +0000
treeherdermozilla-central@be81b8d6fae9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1168737
milestone41.0a1
backs outcd741d3ae78a7ef127b6baf7c4efc0fff0472267
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
Back out changeset cd741d3ae78a (bug 1168737) for mochitest failures on Mac OS X 10.10. CLOSED TREE Failures were: 2358 INFO TEST-UNEXPECTED-FAIL | toolkit/webapps/tests/test_webapp_runtime_executable_update.xul | Test timed out. - expected PASS 2359 INFO TEST-UNEXPECTED-FAIL | toolkit/webapps/tests/test_webapp_runtime_executable_update.xul | Webapp runtime executable has been replaced - got 256, expected 42 2362 INFO TEST-UNEXPECTED-ERROR | toolkit/webapps/tests/test_webapp_runtime_executable_update.xul | called finish() multiple times
testing/mochitest/mach_commands.py
webapprt/mac/webapprt.mm
--- a/testing/mochitest/mach_commands.py
+++ b/testing/mochitest/mach_commands.py
@@ -328,20 +328,16 @@ class MochitestRunner(MozbuildObject):
             if not options.app or options.app == self.get_binary_path():
                 options.app = self.get_webapp_runtime_path()
             options.xrePath = self.get_webapp_runtime_xre_path()
         elif suite == 'webapprt-chrome':
             options.browserArgs.append("-test-mode")
             if not options.app or options.app == self.get_binary_path():
                 options.app = self.get_webapp_runtime_path()
             options.xrePath = self.get_webapp_runtime_xre_path()
-            # On Mac, pass the path to the runtime, to ensure the test app
-            # uses that specific runtime instead of another one on the system.
-            if sys.platform.startswith('darwin'):
-                options.browserArgs.extend(('-runtime', os.path.join(self.distdir, self.substs['MOZ_MACBUNDLE_NAME'])))
 
         from manifestparser import TestManifest
         manifest = TestManifest()
         manifest.tests.extend(tests)
         options.manifestFile = manifest
 
         # XXX why is this such a special case?
         if len(tests) == 1 and options.closeWhenDone and suite == 'plain':
--- a/webapprt/mac/webapprt.mm
+++ b/webapprt/mac/webapprt.mm
@@ -39,17 +39,17 @@ const char WEBRTINI_NAME[] = "webapprt.i
 
 //need the correct relative path here
 const char APP_MACOS_PATH[]     = "/Contents/MacOS/";
 const char APP_RESOURCES_PATH[] = "/Contents/Resources/";
 
 //the path to the WebappRT subdir within the Firefox app contents dir
 const char WEBAPPRT_PATH[] = "webapprt/";
 
-void ExecNewBinary(NSString* launchPath, NSDictionary* args);
+void ExecNewBinary(NSString* launchPath);
 
 NSString *PathToWebRT(NSString* alternateBinaryID);
 
 NSException* MakeException(NSString* name, NSString* message);
 
 void DisplayErrorAlert(NSString* title, NSString* message);
 
 XRE_GetFileFromPathType XRE_GetFileFromPath;
@@ -105,25 +105,19 @@ main(int argc, char **argv)
 
   //I need to look in our bundle first, before deciding what firefox binary to use
   NSBundle* myBundle = [NSBundle mainBundle];
   NSString* myBundlePath = [myBundle bundlePath];
   alternateBinaryID = [myBundle objectForInfoDictionaryKey:@"FirefoxBinary"];
   NSLog(@"found override firefox binary: %@", alternateBinaryID);
 
   @try {
-    // Determine the runtime with which to run the application.
-    // Throws an exception with an error dialog if it can't find one.
-    firefoxPath = [args objectForKey:@"runtime"];
-    if (firefoxPath) {
-      NSLog(@"Runtime specified with -runtime flag: %@", firefoxPath);
-    } else {
-      firefoxPath = PathToWebRT(alternateBinaryID);
-      NSLog(@"Found runtime: %@", firefoxPath);
-    }
+    //find a webapprt binary to launch with.  throws an exception with error dialog if none found.
+    firefoxPath = PathToWebRT(alternateBinaryID);
+    NSLog(@"USING FIREFOX : %@", firefoxPath);
 
     NSString* myWebRTPath = [myBundle pathForResource:@"webapprt"
                                                ofType:nil];
     if (!myWebRTPath) {
       myWebRTPath = [myBundlePath stringByAppendingPathComponent:@"Contents"];
       myWebRTPath = [myWebRTPath stringByAppendingPathComponent:@"MacOS"];
       myWebRTPath = [myWebRTPath stringByAppendingPathComponent:@"webapprt"];
       if ([[NSFileManager defaultManager] fileExistsAtPath:myWebRTPath] == NO) {
@@ -199,17 +193,17 @@ main(int argc, char **argv)
       if (errorDesc != nil) {
         NSLog(@"failed to copy new webrt file: %@", errorDesc);
         @throw MakeException(@"Unable To Update Web Runtime", @"Failed to update Web Runtime");
       } else {
         NSLog(@"### Successfully updated webapprt, relaunching");
       }
 
       //execv the new binary, and ride off into the sunset
-      ExecNewBinary(myWebRTPath, args);
+      ExecNewBinary(myWebRTPath);
 
     } else {
       //we are ready to load XUL and such, and go go go
 
       NSLog(@"This Application has the newest webrt.  Launching!");
 
       int result = 0;
       char rtINIPath[MAXPATHLEN];
@@ -268,17 +262,17 @@ main(int argc, char **argv)
         nsXREAppData *webShellAppData;
         if (NS_FAILED(XRE_CreateAppData(rtINI, &webShellAppData))) {
           NSLog(@"Couldn't read WebappRT application.ini: %s", rtINIPath);
           @throw MakeException(@"Error", @"Unable to parse base INI file.");
         }
 
         NSString *profile = [args objectForKey:@"profile"];
         if (profile) {
-          NSLog(@"Profile specified with -profile flag: %@", profile);
+          NSLog(@"Profile specified with --profile: %@", profile);
         }
         else {
           nsINIParser parser;
           if (NS_FAILED(parser.Init(appEnv))) {
             NSLog(@"%s was not found\n", appEnv);
             @throw MakeException(@"Error", @"Unable to parse environment files for application startup");
           }
           char profile[MAXPATHLEN];
@@ -352,16 +346,25 @@ DisplayErrorAlert(NSString* title, NSStr
 /* Find the currently installed Firefox, if any, and return
  * an absolute path to it. may return nil */
 NSString
 *PathToWebRT(NSString* alternateBinaryID)
 {
   //default is firefox
   NSString *binaryPath = nil;
 
+  // We're run from the Firefox bundle during WebappRT chrome and content tests.
+  NSString *myBundlePath = [[NSBundle mainBundle] bundlePath];
+  NSString *fxPath =
+    [NSString stringWithFormat:@"%@%sfirefox-bin", myBundlePath,
+                                                   APP_MACOS_PATH];
+  if ([[NSFileManager defaultManager] fileExistsAtPath:fxPath]) {
+    return myBundlePath;
+  }
+
   //we look for these flavors of Firefox, in this order
   NSArray* launchBinarySearchList = [NSArray arrayWithObjects: @"org.mozilla.nightly",
                                                                 @"org.mozilla.firefoxdeveloperedition",
                                                                 @"org.mozilla.firefox", nil];
 
   // If they provided a binary ID, use that.
   if (alternateBinaryID != nil && ([alternateBinaryID length] > 0)) {
     binaryPath = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:alternateBinaryID];
@@ -381,31 +384,17 @@ NSString
 
   NSLog(@"unable to find a valid webrt path");
   @throw MakeException(@"This App requires that Firefox version 16 or above is installed.", @"Firefox 16+ has not been detected.");
 
   return nil;
 }
 
 void
-ExecNewBinary(NSString* launchPath, NSDictionary* args)
+ExecNewBinary(NSString* launchPath)
 {
   NSLog(@" launching webrt at path: %@\n", launchPath);
 
-  NSUInteger numArgs = [args count];
-  const char *newargv[numArgs + 2];
-  NSMutableString *commandLine = [NSMutableString string];
-  newargv[0] = [launchPath UTF8String];
-  [commandLine appendString:launchPath];
+  const char *const newargv[] = {[launchPath UTF8String], NULL};
 
-  NSUInteger i = 1;
-  for (id key in args) {
-    NSString *name = [@"-" stringByAppendingString:key];
-    NSString *value = [args objectForKey:key];
-    newargv[i++] = [name UTF8String];
-    newargv[i++] = [value UTF8String];
-    [commandLine appendFormat:@" %@ %@", name, value];
-  }
-  newargv[i] = NULL;
-
-  NSLog(@"Command line: '%@'", commandLine);
+  NSLog(@"COMMAND LINE: '%@ %s'", launchPath, newargv[0]);
   execv([launchPath UTF8String], (char **)newargv);
 }