Bug 773086 - Add --emulatorImg option to Marionette, r=jgriffin, DONTBUILD because NPOTB
authorMihnea Balaur <mbalaur@mozilla.com>
Wed, 11 Jul 2012 17:53:51 -0700
changeset 99025 56141758a0f0f262a427c274412b336a76a8ec94
parent 99024 b33564258377e15f0b2755abea527aaf1ff1ce0c
child 99026 f14591911ad8f0c6b0e47abc89c08cd830492320
push id23099
push useremorley@mozilla.com
push dateThu, 12 Jul 2012 16:29:09 +0000
treeherdermozilla-central@f9499238bd4b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgriffin, DONTBUILD
bugs773086
milestone16.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 773086 - Add --emulatorImg option to Marionette, r=jgriffin, DONTBUILD because NPOTB
testing/marionette/client/marionette/marionette.py
testing/marionette/client/marionette/runtests.py
--- a/testing/marionette/client/marionette/marionette.py
+++ b/testing/marionette/client/marionette/marionette.py
@@ -66,19 +66,19 @@ class HTMLElement(object):
 
 
 class Marionette(object):
 
     CONTEXT_CHROME = 'chrome'
     CONTEXT_CONTENT = 'content'
 
     def __init__(self, host='localhost', port=2828, bin=None, profile=None,
-                 emulator=None, emulatorBinary=None, emulator_res='480x800',
-                 connectToRunningEmulator=False, homedir=None, baseurl=None,
-                 noWindow=False, logcat_dir=None):
+                 emulator=None, emulatorBinary=None, emulatorImg=None,
+                 emulator_res='480x800', connectToRunningEmulator=False,
+                 homedir=None, baseurl=None, noWindow=False, logcat_dir=None):
         self.host = host
         self.port = self.local_port = port
         self.bin = bin
         self.profile = profile
         self.session = None
         self.window = None
         self.emulator = None
         self.extra_emulators = []
@@ -93,16 +93,17 @@ class Marionette(object):
             self.instance.start()
             assert(self.instance.wait_for_port())
         if emulator:
             self.emulator = Emulator(homedir=homedir,
                                      noWindow=self.noWindow,
                                      logcat_dir=self.logcat_dir,
                                      arch=emulator,
                                      emulatorBinary=emulatorBinary,
+                                     userdata=emulatorImg,
                                      res=emulator_res)
             self.emulator.start()
             self.port = self.emulator.setup_port_forwarding(self.port)
             assert(self.emulator.wait_for_port())
 
         if connectToRunningEmulator:
             self.emulator = Emulator(homedir=homedir, logcat_dir=self.logcat_dir)
             self.emulator.connect()
--- a/testing/marionette/client/marionette/runtests.py
+++ b/testing/marionette/client/marionette/runtests.py
@@ -143,23 +143,25 @@ class MarionetteTextTestRunner(unittest.
         else:
             self.stream.write("\n")
         return result
 
 
 class MarionetteTestRunner(object):
 
     def __init__(self, address=None, emulator=None, emulatorBinary=None,
-                 emulator_res='480x800', homedir=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):
+                 emulatorImg=None, emulator_res='480x800', homedir=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):
         self.address = address
         self.emulator = emulator
         self.emulatorBinary = emulatorBinary
+        self.emulatorImg = emulatorImg
         self.emulator_res = emulator_res
         self.homedir = homedir
         self.bin = bin
         self.profile = profile
         self.autolog = autolog
         self.testgroup = testgroup
         self.revision = revision
         self.es_server = es_server
@@ -228,16 +230,17 @@ class MarionetteTestRunner(object):
                                              logcat_dir=self.logcat_dir)
             else:
                 self.marionette = Marionette(host=host,
                                              port=int(port),
                                              baseurl=self.baseurl)
         elif self.emulator:
             self.marionette = Marionette(emulator=self.emulator,
                                          emulatorBinary=self.emulatorBinary,
+                                         emulatorImg=self.emulatorImg,
                                          emulator_res=self.emulator_res,
                                          homedir=self.homedir,
                                          baseurl=self.baseurl,
                                          noWindow=self.noWindow,
                                          logcat_dir=self.logcat_dir)
         else:
             raise Exception("must specify binary, address or emulator")
 
@@ -509,16 +512,20 @@ if __name__ == "__main__":
                       default = None, choices = ["x86", "arm"],
                       help = "Launch a B2G emulator on which to run tests. "
                       "You need to specify which architecture to emulate.")
     parser.add_option("--emulator-binary",
                       action = "store", dest = "emulatorBinary",
                       default = None,
                       help = "Launch a specific emulator binary rather than "
                       "launching from the B2G built emulator")
+    parser.add_option('--emulator-img',
+                      action = 'store', dest = 'emulatorImg',
+                      default = None,
+                      help = "Use a specific image file instead of a fresh one")
     parser.add_option('--emulator-res',
                       action = 'store', dest = 'emulator_res',
                       default = '480x800', type= 'str',
                       help = 'Set a custom resolution for the emulator. '
                       'Example: "480x800"')
     parser.add_option("--no-window",
                       action = "store_true", dest = "noWindow",
                       default = False,
@@ -581,16 +588,17 @@ if __name__ == "__main__":
         res = 'x'.join([width, height])
     except:
         raise ValueError('Invalid emulator resolution format. '
                          'Should be like "480x800".\n')
 
     runner = MarionetteTestRunner(address=options.address,
                                   emulator=options.emulator,
                                   emulatorBinary=options.emulatorBinary,
+                                  emulatorImg=options.emulatorImg,
                                   emulator_res=res,
                                   homedir=options.homedir,
                                   logcat_dir=options.logcat_dir,
                                   bin=options.bin,
                                   profile=options.profile,
                                   noWindow=options.noWindow,
                                   revision=options.revision,
                                   testgroup=options.testgroup,