Bug 1119211 - Disable the 360 second socket timeout when marionette is invoked with --jsdebugger.;r=ato draft
authorChris Manchester <cmanchester@mozilla.com>
Mon, 02 Feb 2015 13:48:32 -0500
changeset 240405 3a6352aec108516ba677529d9e4f387d48039c27
parent 240404 3bf7ed413e87f086a3f5ede1ddd475f310b117e0
child 505201 3977a7f748e4f4453b39d1fe66bfb138b4a38c0f
push id535
push usercmanchester@mozilla.com
push dateMon, 02 Feb 2015 19:04:18 +0000
reviewersato
bugs1119211
milestone38.0a1
Bug 1119211 - Disable the 360 second socket timeout when marionette is invoked with --jsdebugger.;r=ato
testing/marionette/client/marionette/runner/base.py
--- a/testing/marionette/client/marionette/runner/base.py
+++ b/testing/marionette/client/marionette/runner/base.py
@@ -237,16 +237,18 @@ class MarionetteTextTestRunner(Structure
             pre_run_func()
 
         result = super(MarionetteTextTestRunner, self).run(test)
         result.printLogs(test)
         return result
 
 
 class BaseMarionetteOptions(OptionParser):
+    socket_timeout_default = 360.0
+
     def __init__(self, **kwargs):
         OptionParser.__init__(self, **kwargs)
         self.parse_args_handlers = [] # Used by mixins
         self.verify_usage_handlers = [] # Used by mixins
         self.add_option('--emulator',
                         action='store',
                         dest='emulator',
                         choices=['x86', 'arm'],
@@ -396,16 +398,21 @@ class BaseMarionetteOptions(OptionParser
                         action='store',
                         default='Marionette-based Tests',
                         help='Define the name to associate with the logger used')
         self.add_option('--jsdebugger',
                         dest='jsdebugger',
                         action='store_true',
                         default=False,
                         help='Enable the jsdebugger for marionette javascript.')
+        self.add_option('--socket-timeout',
+                        dest='socket_timeout',
+                        action='store',
+                        default=self.socket_timeout_default,
+                        help='Set the global timeout for marionette socket operations.')
         self.add_option('--e10s',
                         dest='e10s',
                         action='store_true',
                         default=False,
                         help='Enable e10s when running marionette tests.')
 
     def parse_args(self, args=None, values=None):
         options, tests = OptionParser.parse_args(self, args, values)
@@ -452,16 +459,17 @@ class BaseMarionetteOptions(OptionParser
         if options.total_chunks is not None:
             if not 1 <= options.total_chunks:
                 self.error('Total chunks must be greater than 1.')
             if not 1 <= options.this_chunk <= options.total_chunks:
                 self.error('Chunk to run must be between 1 and %s.' % options.total_chunks)
 
         if options.jsdebugger:
             options.app_args.append('-jsdebugger')
+            options.socket_timeout = None
 
         if options.e10s:
             options.prefs = {
                 'browser.tabs.remote.autostart': True
             }
 
         for handler in self.verify_usage_handlers:
             handler(options, tests)
@@ -477,17 +485,19 @@ class BaseMarionetteTestRunner(object):
                  emulator_img=None, emulator_res='480x800', homedir=None,
                  app=None, app_args=None, binary=None, profile=None,
                  logger=None, no_window=False, logdir=None, logcat_stdout=False,
                  xml_output=None, repeat=0, testvars=None, tree=None, type=None,
                  device_serial=None, symbols_path=None, timeout=None,
                  shuffle=False, shuffle_seed=random.randint(0, sys.maxint),
                  sdcard=None, this_chunk=1, total_chunks=1, sources=None,
                  server_root=None, gecko_log=None, result_callbacks=None,
-                 adb_host=None, adb_port=None, prefs=None, **kwargs):
+                 adb_host=None, adb_port=None, prefs=None,
+                 socket_timeout=BaseMarionetteOptions.socket_timeout_default,
+                 **kwargs):
         self.address = address
         self.emulator = emulator
         self.emulator_binary = emulator_binary
         self.emulator_img = emulator_img
         self.emulator_res = emulator_res
         self.homedir = homedir
         self.app = app
         self.app_args = app_args or []
@@ -502,16 +512,17 @@ class BaseMarionetteTestRunner(object):
         self.xml_output = xml_output
         self.repeat = repeat
         self.test_kwargs = kwargs
         self.tree = tree
         self.type = type
         self.device_serial = device_serial
         self.symbols_path = symbols_path
         self.timeout = timeout
+        self.socket_timeout = socket_timeout
         self._device = None
         self._capabilities = None
         self._appName = None
         self.shuffle = shuffle
         self.shuffle_seed = shuffle_seed
         self.sdcard = sdcard
         self.sources = sources
         self.server_root = server_root
@@ -633,16 +644,17 @@ class BaseMarionetteTestRunner(object):
             self.marionette.baseurl = self.server_root
             self.logger.info('using content from %s' % self.marionette.baseurl)
 
     def _build_kwargs(self):
         kwargs = {
             'device_serial': self.device_serial,
             'symbols_path': self.symbols_path,
             'timeout': self.timeout,
+            'socket_timeout': self.socket_timeout,
             'adb_host': self._adb_host,
             'adb_port': self._adb_port,
             'prefs': self.prefs,
         }
         if self.bin:
             kwargs.update({
                 'host': 'localhost',
                 'port': 2828,