Backed out changeset 93e4c5f0dc7b (bug 1318644) because it made changes to geckodriver that should have been left out.
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 23 Nov 2016 09:04:05 -0500
changeset 324089 ef0568a85aa40bd2a2a43c8c813c059451f3d328
parent 324088 11a036eafea224ab9ff1fde88f72ab75768be98c
child 324090 fe5975fad5d1f325657eb815076587a3bdc6bc74
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
bugs1318644
milestone53.0a1
backs out93e4c5f0dc7bc959bccf8ebbac606d71ac7d8139
Backed out changeset 93e4c5f0dc7b (bug 1318644) because it made changes to geckodriver that should have been left out.
testing/marionette/client/marionette_driver/geckoinstance.py
testing/marionette/client/marionette_driver/marionette.py
testing/marionette/harness/marionette/runner/base.py
--- a/testing/marionette/client/marionette_driver/geckoinstance.py
+++ b/testing/marionette/client/marionette_driver/geckoinstance.py
@@ -313,16 +313,11 @@ class DesktopInstance(GeckoInstance):
 
 
 class NullOutput(object):
     def __call__(self, line):
         pass
 
 
 apps = {
+    'fxdesktop': DesktopInstance,
     'fennec': FennecInstance,
-    'fxdesktop': DesktopInstance,
 }
-
-app_ids = {
-    '{aa3c5121-dab2-40e2-81ca-7ea25febc110}': 'fennec',
-    '{ec8030f7-c20a-464f-9b0e-13a3a9e97384}': 'fxdesktop',
-}
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -1,12 +1,13 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+import ConfigParser
 import base64
 import datetime
 import json
 import os
 import socket
 import sys
 import time
 import traceback
@@ -587,17 +588,28 @@ class Marionette(object):
             # select instance class for the given app
             try:
                 instance_class = geckoinstance.apps[app]
             except KeyError:
                 msg = 'Application "{0}" unknown (should be one of {1})'
                 raise NotImplementedError(
                     msg.format(app, geckoinstance.apps.keys()))
         else:
-            instance_class = geckoinstance.GeckoInstance
+            try:
+                if not isinstance(self.bin, basestring):
+                    raise TypeError("bin must be a string if app is not specified")
+                config = ConfigParser.RawConfigParser()
+                config.read(os.path.join(os.path.dirname(self.bin),
+                                         'application.ini'))
+                app = config.get('App', 'Name')
+                instance_class = geckoinstance.apps[app.lower()]
+            except (ConfigParser.NoOptionError,
+                    ConfigParser.NoSectionError,
+                    KeyError):
+                instance_class = geckoinstance.GeckoInstance
         return instance_class(host=self.host, port=self.port, bin=self.bin,
                               **instance_args)
 
     @property
     def profile_path(self):
         if self.instance and self.instance.profile:
             return self.instance.profile.profile
 
--- a/testing/marionette/harness/marionette/runner/base.py
+++ b/testing/marionette/harness/marionette/runner/base.py
@@ -17,17 +17,16 @@ import time
 import traceback
 import unittest
 import warnings
 import mozprofile
 
 
 from manifestparser import TestManifest
 from manifestparser.filters import tags
-from marionette_driver.geckoinstance import app_ids
 from marionette_driver.marionette import Marionette
 from moztest.adapters.unit import StructuredTestRunner, StructuredTestResult
 from moztest.results import TestResultCollection, TestResult, relevant_line
 import mozversion
 
 import httpd
 
 
@@ -428,19 +427,16 @@ class BaseMarionetteArguments(ArgumentPa
 
         missing_tests = [path for path in args.tests if not os.path.exists(path)]
         if missing_tests:
             self.error("Test file(s) not found: " + " ".join([path for path in missing_tests]))
 
         if not args.address and not args.binary and not args.emulator:
             self.error('You must specify --binary, or --address, or --emulator')
 
-        if not os.path.isfile(args.binary):
-            self.error('You must specify an existing binary.')
-
         if args.total_chunks is not None and args.this_chunk is None:
             self.error('You must specify which chunk to run.')
 
         if args.this_chunk is not None and args.total_chunks is None:
             self.error('You must specify how many chunks to split the tests into.')
 
         if args.total_chunks is not None:
             if not 1 < args.total_chunks:
@@ -511,23 +507,16 @@ class BaseMarionetteTestRunner(object):
                  symbols_path=None, timeout=None,
                  shuffle=False, shuffle_seed=random.randint(0, sys.maxint), this_chunk=1,
                  total_chunks=1,
                  server_root=None, gecko_log=None, result_callbacks=None,
                  prefs=None, test_tags=None,
                  socket_timeout=BaseMarionetteArguments.socket_timeout_default,
                  startup_timeout=None, addons=None, workspace=None,
                  verbose=0, e10s=True, emulator=False, **kwargs):
-
-        self._appinfo = None
-        self._appName = None
-        self._capabilities = None
-        self._filename_pattern = None
-        self._version_info = {}
-
         self.extra_kwargs = kwargs
         self.test_kwargs = deepcopy(kwargs)
         self.address = address
         self.app = app
         self.app_args = app_args or []
         self.bin = binary
         self.emulator = emulator
         self.profile = profile
@@ -535,16 +524,19 @@ class BaseMarionetteTestRunner(object):
         self.logger = logger
         self.httpd = None
         self.marionette = None
         self.logdir = logdir
         self.repeat = repeat
         self.symbols_path = symbols_path
         self.timeout = timeout
         self.socket_timeout = socket_timeout
+        self._capabilities = None
+        self._appinfo = None
+        self._appName = None
         self.shuffle = shuffle
         self.shuffle_seed = shuffle_seed
         self.server_root = server_root
         self.this_chunk = this_chunk
         self.total_chunks = total_chunks
         self.mixin_run_tests = []
         self.manifest_skipped_tests = []
         self.tests = []
@@ -553,24 +545,17 @@ class BaseMarionetteTestRunner(object):
         self.test_tags = test_tags
         self.startup_timeout = startup_timeout
         self.workspace = workspace
         # If no workspace is set, default location for gecko.log is .
         # and default location for profile is TMP
         self.workspace_path = workspace or os.getcwd()
         self.verbose = verbose
         self.e10s = e10s
-
-        # If no application type has been specified try to auto-detect it
-        if not self.app:
-            try:
-                app_id = self.version_info['application_id']
-                self.app = app_ids[app_id]
-            except KeyError:
-                self.logger.warning('Failed to detect the type of application.')
+        self._filename_pattern = None
 
         def gather_debug(test, status):
             rv = {}
             marionette = test._marionette_weakref()
 
             # In the event we're gathering debug without starting a session,
             # skip marionette commands
             if marionette.session is not None:
@@ -680,27 +665,16 @@ class BaseMarionetteTestRunner(object):
     def appName(self):
         if self._appName:
             return self._appName
 
         self._appName = self.capabilities.get('browserName')
         return self._appName
 
     @property
-    def version_info(self):
-        if not self._version_info:
-            try:
-                # TODO: Get version_info in Fennec case
-                self._version_info = mozversion.get_version(binary=self.bin)
-            except Exception:
-                self.logger.warning("Failed to retrieve version information for {}".format(
-                    self.bin))
-        return self._version_info
-
-    @property
     def bin(self):
         return self._bin
 
     @bin.setter
     def bin(self, path):
         """Set binary and reset parts of runner accordingly.
 
         Intended use: to change binary between calls to run_tests
@@ -854,20 +828,25 @@ class BaseMarionetteTestRunner(object):
 
         device_info = None
         if self.marionette.instance and self.emulator:
             try:
                 device_info = self.marionette.instance.runner.device.dm.getInfo()
             except Exception:
                 self.logger.warning('Could not get device info.')
 
+        # TODO: Get version_info in Fennec case
+        version_info = None
+        if self.bin:
+            version_info = mozversion.get_version(binary=self.bin)
+
         self.logger.info("running with e10s: {}".format(self.e10s))
 
         self.logger.suite_start(self.tests,
-                                version_info=self.version_info,
+                                version_info=version_info,
                                 device_info=device_info)
 
         self._log_skipped_tests()
 
         interrupted = None
         try:
             counter = self.repeat
             while counter >= 0: