Bug 889637 - Add --es-server arg to Marionette, r=mcote
authorJonathan Griffin <jgriffin@mozilla.com>
Mon, 08 Jul 2013 12:28:53 -0700
changeset 137703 40f668ee694c89a4cc21f247fab6cf13776871c1
parent 137702 17b2c4a3f10d0fdbeaa751db6a4bea2293c31d69
child 137704 c9d870de3b12c60ceb53aad0e07b77c3ba89a4c9
push id24932
push useremorley@mozilla.com
push dateTue, 09 Jul 2013 07:48:45 +0000
treeherdermozilla-central@b04e6266d457 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcote
bugs889637
milestone25.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 889637 - Add --es-server arg to Marionette, r=mcote
testing/marionette/client/marionette/runtests.py
--- a/testing/marionette/client/marionette/runtests.py
+++ b/testing/marionette/client/marionette/runtests.py
@@ -207,35 +207,32 @@ class MarionetteTextTestRunner(unittest.
 
 class MarionetteTestRunner(object):
 
     textrunnerclass = MarionetteTextTestRunner
 
     def __init__(self, address=None, emulator=None, emulatorBinary=None,
                  emulatorImg=None, emulator_res='480x800', homedir=None,
                  app=None, bin=None, profile=None, autolog=False, revision=None,
-                 es_server=None, rest_server=None, logger=None,
-                 testgroup="marionette", noWindow=False, logcat_dir=None,
-                 xml_output=None, repeat=0, gecko_path=None, testvars=None,
-                 tree=None, type=None, device_serial=None, symbols_path=None,
-                 timeout=None, **kwargs):
+                 logger=None, testgroup="marionette", noWindow=False,
+                 logcat_dir=None, xml_output=None, repeat=0, gecko_path=None,
+                 testvars=None, tree=None, type=None, device_serial=None,
+                 symbols_path=None, timeout=None, es_servers=None, **kwargs):
         self.address = address
         self.emulator = emulator
         self.emulatorBinary = emulatorBinary
         self.emulatorImg = emulatorImg
         self.emulator_res = emulator_res
         self.homedir = homedir
         self.app = app
         self.bin = bin
         self.profile = profile
         self.autolog = autolog
         self.testgroup = testgroup
         self.revision = revision
-        self.es_server = es_server
-        self.rest_server = rest_server
         self.logger = logger
         self.noWindow = noWindow
         self.httpd = None
         self.baseurl = None
         self.marionette = None
         self.logcat_dir = logcat_dir
         self.xml_output = xml_output
         self.repeat = repeat
@@ -245,16 +242,17 @@ class MarionetteTestRunner(object):
         self.tree = tree
         self.type = type
         self.device_serial = device_serial
         self.symbols_path = symbols_path
         self.timeout = timeout
         self._device = None
         self._capabilities = None
         self._appName = None
+        self.es_servers = es_servers
 
         if testvars:
             if not os.path.exists(testvars):
                 raise Exception('--testvars file does not exist')
 
             import json
             with open(testvars) as f:
                 self.testvars = json.loads(f.read())
@@ -378,47 +376,49 @@ class MarionetteTestRunner(object):
 
         logfile = None
         if self.emulator:
             filename = os.path.join(os.path.abspath(self.logcat_dir),
                                     "emulator-%d.log" % self.marionette.emulator.port)
             if os.access(filename, os.F_OK):
                 logfile = filename
 
-        # This is all autolog stuff.
-        # See: https://wiki.mozilla.org/Auto-tools/Projects/Autolog
-        from mozautolog import RESTfulAutologTestGroup
-        testgroup = RESTfulAutologTestGroup(
-            testgroup = self.testgroup,
-            os = 'android',
-            platform = 'emulator',
-            harness = 'marionette',
-            server = self.es_server,
-            restserver = self.rest_server,
-            machine = socket.gethostname(),
-            logfile = logfile)
+        for es_server in self.es_servers:
+
+            # This is all autolog stuff.
+            # See: https://wiki.mozilla.org/Auto-tools/Projects/Autolog
+            from mozautolog import RESTfulAutologTestGroup
+            testgroup = RESTfulAutologTestGroup(
+                testgroup=self.testgroup,
+                os='android',
+                platform='emulator',
+                harness='marionette',
+                server=es_server,
+                restserver=None,
+                machine=socket.gethostname(),
+                logfile=logfile)
 
-        testgroup.set_primary_product(
-            tree = self.tree,
-            buildtype = 'opt',
-            revision = self.revision)
+            testgroup.set_primary_product(
+                tree=self.tree,
+                buildtype='opt',
+                revision=self.revision)
 
-        testgroup.add_test_suite(
-            testsuite = 'b2g emulator testsuite',
-            elapsedtime = elapsedtime.seconds,
-            cmdline = '',
-            passed = self.passed,
-            failed = self.failed,
-            todo = self.todo)
+            testgroup.add_test_suite(
+                testsuite='b2g emulator testsuite',
+                elapsedtime=elapsedtime.seconds,
+                cmdline='',
+                passed=self.passed,
+                failed=self.failed,
+                todo=self.todo)
 
-        # Add in the test failures.
-        for f in self.failures:
-            testgroup.add_test_failure(test=f[0], text=f[1], status=f[2])
+            # Add in the test failures.
+            for f in self.failures:
+                testgroup.add_test_failure(test=f[0], text=f[1], status=f[2])
 
-        testgroup.submit()
+            testgroup.submit()
 
     def run_tests(self, tests):
         self.reset_test_stats()
         starttime = datetime.utcnow()
         while self.repeat >=0:
             for test in tests:
                 self.run_test(test)
             self.repeat -= 1
@@ -725,26 +725,34 @@ class MarionetteTestOptions(OptionParser
         self.add_option('--symbols-path',
                         dest='symbols_path',
                         action='store',
                         help='absolute path to directory containing breakpad symbols, or the url of a zip file containing symbols')
         self.add_option('--timeout',
                         dest='timeout',
                         type=int,
                         help='if a --timeout value is given, it will set the default page load timeout, search timeout and script timeout to the given value. If not passed in, it will use the default values of 30000ms for page load, 0ms for search timeout and 10000ms for script timeout')
+        self.add_option('--es-server',
+                        dest='es_servers',
+                        action='append',
+                        help='the ElasticSearch server to use for autolog submission')
 
     def verify_usage(self, options, tests):
         if not tests:
             print 'must specify one or more test files, manifests, or directories'
             sys.exit(1)
 
         if not options.emulator and not options.address and not options.bin:
             print 'must specify --binary, --emulator or --address'
             sys.exit(1)
 
+        if not options.es_servers:
+            options.es_servers = ['elasticsearch-zlb.dev.vlan81.phx.mozilla.com:9200',
+                                  'elasticsearch-zlb.webapp.scl3.mozilla.com:9200']
+
         # default to storing logcat output for emulator runs
         if options.emulator and not options.logcat_dir:
             options.logcat_dir = 'logcat'
 
         # check for valid resolution string, strip whitespaces
         try:
             if options.emulator_res:
                 dims = options.emulator_res.split('x')