Bug 820463 - Remove loadearly code from test runners, r=ahal
authorJonathan Griffin <jgriffin@mozilla.com>
Thu, 17 Jan 2013 12:18:37 -0800
changeset 119280 cde7a236b28d91ab04b4ff4757edfa98b14a5617
parent 119279 c635420087c866f321e153589423dd1796d064c1
child 119281 ef505122f02a8523fe909283825b781bf94a5032
push id24195
push userMs2ger@gmail.com
push dateSat, 19 Jan 2013 16:10:11 +0000
treeherdermozilla-central@02e12a80aef9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs820463
milestone21.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 820463 - Remove loadearly code from test runners, r=ahal
layout/tools/reftest/runreftestb2g.py
testing/marionette/client/marionette/emulator.py
testing/marionette/client/marionette/marionette.py
testing/marionette/client/marionette/runtests.py
testing/mochitest/runtestsb2g.py
--- a/layout/tools/reftest/runreftestb2g.py
+++ b/layout/tools/reftest/runreftestb2g.py
@@ -407,17 +407,16 @@ user_pref("network.dns.localDomains","ap
 user_pref("font.size.inflation.emPerLine", 0);
 user_pref("font.size.inflation.minTwips", 0);
 user_pref("reftest.browser.iframe.enabled", false);
 user_pref("reftest.remote", true);
 user_pref("reftest.uri", "%s");
 // Set a future policy version to avoid the telemetry prompt.
 user_pref("toolkit.telemetry.prompted", 999);
 user_pref("toolkit.telemetry.notifiedOptOut", 999);
-user_pref("marionette.loadearly", true);
 """ % reftestlist)
 
         #workaround for jsreftests.
         if getattr(options, 'enablePrivilege', False):
             fhandle.write("""
 user_pref("capability.principal.codebase.p2.granted", "UniversalXPConnect");
 user_pref("capability.principal.codebase.p2.id", "http://%s:%s");
 """ % (options.remoteWebServer, options.httpPort))
--- a/testing/marionette/client/marionette/emulator.py
+++ b/testing/marionette/client/marionette/emulator.py
@@ -283,19 +283,17 @@ waitFor(
             if datetime.datetime.now() - now > datetime.timedelta(seconds=60):
                 raise Exception('timed out waiting for emulator to be available')
             online, offline = self._get_adb_devices()
         self.port = int(list(online)[0])
 
         self.dm = devicemanagerADB.DeviceManagerADB(adbPath=self.adb,
                                                     deviceSerial='emulator-%d' % self.port)
 
-    def add_prefs_to_profile(self, prefs=None):
-        if not prefs:
-            prefs = ['user_pref("marionette.loadearly", true);']
+    def add_prefs_to_profile(self, prefs=()):
         local_user_js = tempfile.mktemp(prefix='localuserjs')
         self.dm.getFile(self.remote_user_js, local_user_js)
         with open(local_user_js, 'a') as f:
             f.write('%s\n' % '\n'.join(prefs))
         self.dm.pushFile(local_user_js, self.remote_user_js)
 
     def start(self):
         self._check_for_b2g()
@@ -333,36 +331,24 @@ waitFor(
         self.screen.initialize()
 
         if self.logcat_dir:
             self.save_logcat()
 
         # setup DNS fix for networking
         self._run_adb(['shell', 'setprop', 'net.dns1', '10.0.2.3'])
 
-    def setup(self, marionette, gecko_path=None, load_early=False, busybox=None):
+    def setup(self, marionette, gecko_path=None, busybox=None):
         if busybox:
             self.install_busybox(busybox)
 
         if gecko_path:
-            if load_early:
-                # Inject prefs into the profile now, since we have to restart
-                # B2G after installing a new gecko anyway.
-                self.add_prefs_to_profile()
             self.install_gecko(gecko_path, marionette)
-        elif load_early:
-            self.add_prefs_to_profile()
-            self.restart_b2g()
 
-        if load_early:
-            # If we're loading early, we have to wait for the
-            # system-message-listener-ready event again after restarting B2G.
-            # If we're not loading early, we skip this because Marionette
-            # doesn't load until after this event has fired.
-            self.wait_for_system_message(marionette)
+        self.wait_for_system_message(marionette)
 
     def restart_b2g(self):
         print 'restarting B2G'
         self.dm.shellCheckOutput(['stop', 'b2g'])
         time.sleep(10)
         self.dm.shellCheckOutput(['start', 'b2g'])
 
         if not self.wait_for_port():
--- a/testing/marionette/client/marionette/marionette.py
+++ b/testing/marionette/client/marionette/marionette.py
@@ -100,17 +100,17 @@ class Marionette(object):
     TIMEOUT_SEARCH = 'implicit'
     TIMEOUT_SCRIPT = 'script'
     TIMEOUT_PAGE = 'page load'
 
     def __init__(self, host='localhost', port=2828, bin=None, profile=None,
                  emulator=None, sdcard=None, emulatorBinary=None,
                  emulatorImg=None, emulator_res='480x800', gecko_path=None,
                  connectToRunningEmulator=False, homedir=None, baseurl=None,
-                 noWindow=False, logcat_dir=None, busybox=None, load_early=False):
+                 noWindow=False, logcat_dir=None, busybox=None):
         self.host = host
         self.port = self.local_port = port
         self.bin = bin
         self.instance = None
         self.profile = profile
         self.session = None
         self.window = None
         self.emulator = None
@@ -149,18 +149,18 @@ class Marionette(object):
                                      logcat_dir=self.logcat_dir)
             self.emulator.connect()
             self.port = self.emulator.setup_port_forwarding(self.port)
             assert(self.emulator.wait_for_port())
 
         self.client = MarionetteClient(self.host, self.port)
 
         if emulator:
-            self.emulator.setup(self, gecko_path=gecko_path,
-                                load_early=load_early,
+            self.emulator.setup(self,
+                                gecko_path=gecko_path,
                                 busybox=busybox)
 
     def __del__(self):
         if self.emulator:
             self.emulator.close()
         if self.instance:
             self.instance.close()
         for qemu in self.extra_emulators:
--- a/testing/marionette/client/marionette/runtests.py
+++ b/testing/marionette/client/marionette/runtests.py
@@ -180,18 +180,17 @@ class MarionetteTextTestRunner(unittest.
 class MarionetteTestRunner(object):
 
     def __init__(self, address=None, emulator=None, emulatorBinary=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, repeat=0, perf=False, perfserv=None,
-                 gecko_path=None, testvars=None, tree=None, load_early=False,
-                 device=None):
+                 gecko_path=None, testvars=None, tree=None, device=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
@@ -209,17 +208,16 @@ class MarionetteTestRunner(object):
         self.perfrequest = None
         self.xml_output = xml_output
         self.repeat = repeat
         self.perf = perf
         self.perfserv = perfserv
         self.gecko_path = gecko_path
         self.testvars = {}
         self.tree = tree
-        self.load_early = load_early
         self.device = device
 
         if testvars:
             if not os.path.exists(testvars):
                 raise Exception('--testvars file does not exist')
 
             import json
             with open(testvars) as f:
@@ -294,18 +292,17 @@ class MarionetteTestRunner(object):
                                          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,
-                                         gecko_path=self.gecko_path,
-                                         load_early=self.load_early)
+                                         gecko_path=self.gecko_path)
         else:
             raise Exception("must specify binary, address or emulator")
 
     def post_to_autolog(self, elapsedtime):
         self.logger.info('posting results to autolog')
 
         logfile = None
         if self.emulator:
@@ -650,21 +647,16 @@ def parse_options():
         parser.print_usage()
         parser.exit()
 
     if not options.emulator and not options.address and not options.bin:
         parser.print_usage()
         print "must specify --binary, --emulator or --address"
         parser.exit()
 
-    if options.load_early and not options.emulator:
-        parser.print_usage()
-        print "must specify --load-early on when using --emulator"
-        parser.exit()
-
     # default to storing logcat output for emulator runs
     if options.emulator and not options.logcat_dir:
         options.logcat_dir = 'logcat'
 
     if options.perf:
         import datazilla
 
     # check for valid resolution string, strip whitespaces
@@ -696,17 +688,16 @@ def startTestRunner(runner_class, option
                           tree=options.tree,
                           autolog=options.autolog,
                           xml_output=options.xml_output,
                           repeat=options.repeat,
                           perf=options.perf,
                           perfserv=options.perfserv,
                           gecko_path=options.gecko_path,
                           testvars=options.testvars,
-                          load_early=options.load_early,
                           device=options.device)
     runner.run_tests(tests, testtype=options.type)
     return runner
 
 def cli(runner_class=MarionetteTestRunner):
     options, tests = parse_options()
     runner = startTestRunner(runner_class, options, tests)
     if runner.failed > 0:
--- a/testing/mochitest/runtestsb2g.py
+++ b/testing/mochitest/runtestsb2g.py
@@ -78,17 +78,16 @@ container.src = '%s';
         f = open(os.path.join(options.profilePath, "user.js"), "a")
         f.write("""
 user_pref("browser.homescreenURL","app://test-container.gaiamobile.org/index.html");
 user_pref("browser.manifestURL","app://test-container.gaiamobile.org/manifest.webapp");
 user_pref("dom.mozBrowserFramesEnabled", %s);
 user_pref("dom.ipc.tabs.disabled", false);
 user_pref("dom.ipc.browser_frames.oop_by_default", false);
 user_pref("dom.mozBrowserFramesWhitelist","app://test-container.gaiamobile.org,http://mochi.test:8888");
-user_pref("marionette.loadearly", true);
 user_pref("marionette.force-local", true);
 """ % OOP_pref)
         f.close()
 
 
 class B2GOptions(MochitestOptions):
 
     def __init__(self, automation, scriptdir, **kwargs):