Backed out changeset 92fc5580994a (bug 1038868) for causing intermittent OSX Marionette timeouts.

--HG--
extra : rebase_source : dcf4d8c25d8612b043c3a08a862ffef99c16fd95
This commit is contained in:
Ryan VanderMeulen 2014-11-12 14:39:59 -05:00
parent 98997a65af
commit f24acb59af
8 changed files with 43 additions and 62 deletions

View File

@ -20,7 +20,6 @@ from decorators import do_crash_check
from keys import Keys
from marionette_transport import MarionetteTransport
from mozrunner import B2GDeviceRunner
from mozrunner import B2GEmulatorRunner
import geckoinstance
@ -476,7 +475,7 @@ class Marionette(object):
busybox=None, symbols_path=None, timeout=None, socket_timeout=360,
device_serial=None, adb_path=None, process_args=None):
self.host = host
self.port = self.remote_port = port
self.port = self.local_port = port
self.bin = bin
self.instance = None
self.session = None
@ -493,7 +492,7 @@ class Marionette(object):
self.device_serial = device_serial
if bin:
port = int(self.remote_port)
port = int(self.port)
if not Marionette.is_port_available(port, host=self.host):
ex_msg = "%s:%d is unavailable." % (self.host, port)
raise errors.MarionetteException(message=ex_msg)
@ -514,14 +513,14 @@ class Marionette(object):
ConfigParser.NoSectionError,
KeyError):
instance_class = geckoinstance.GeckoInstance
self.instance = instance_class(host=self.host, port=self.remote_port,
self.instance = instance_class(host=self.host, port=self.port,
bin=self.bin, profile=profile,
app_args=app_args, symbols_path=symbols_path,
gecko_log=gecko_log)
self.instance.start()
assert(self.wait_for_port()), "Timed out waiting for port!"
elif emulator:
if emulator:
self.runner = B2GEmulatorRunner(b2g_home=homedir,
no_window=self.no_window,
logdir=logdir,
@ -536,36 +535,18 @@ class Marionette(object):
process_args=process_args)
self.emulator = self.runner.device
self.emulator.start()
self.port = self.emulator.setup_port_forwarding(remote_port=self.remote_port)
self.port = self.emulator.setup_port_forwarding(remote_port=self.port)
assert(self.emulator.wait_for_port(self.port)), "Timed out waiting for port!"
elif connect_to_running_emulator:
if connect_to_running_emulator:
self.runner = B2GEmulatorRunner(b2g_home=homedir,
logdir=logdir,
process_args=process_args)
self.emulator = self.runner.device
self.emulator.connect()
self.port = self.emulator.setup_port_forwarding(remote_port=self.remote_port)
self.port = self.emulator.setup_port_forwarding(remote_port=self.port)
assert(self.emulator.wait_for_port(self.port)), "Timed out waiting for port!"
elif app and app.lower() == 'b2g':
# There's no way to know if the target is a device, so we try to
# start a device runner and if that fails we assume the target is
# not a device
_runner = B2GDeviceRunner(adb_path=adb_path,
logdir=logdir,
serial=device_serial,
symbols_path=symbols_path,
process_args=process_args)
try:
_runner.start()
self.port = _runner.device.setup_port_forwarding(remote_port=self.remote_port)
assert(_runner.device.wait_for_port(self.port)), "Timed out waiting for port!"
self.runner = _runner
except IOError:
# No device found or target is not a device
pass
self.client = MarionetteTransport(self.host, self.port, self.socket_timeout)
if emulator:
@ -754,14 +735,17 @@ class Marionette(object):
name = None
crashed = False
if self.runner:
crashed = bool(self.runner.check_for_crashes(test_name=self.test_name))
if crashed and self.emulator:
if self.runner.check_for_crashes(test_name=self.test_name):
returncode = self.emulator.proc.returncode
name = 'emulator'
crashed = True
elif self.instance:
crashed = bool(self.instance.runner.check_for_crashes(test_name=self.test_name))
if self.instance.runner.check_for_crashes(
test_name=self.test_name):
crashed = True
if returncode is not None:
print ('PROCESS-CRASH | %s | abnormal termination with exit code %d' % (name, returncode))
print ('PROCESS-CRASH | %s | abnormal termination with exit code %d' %
(name, returncode))
return crashed
def enforce_gecko_prefs(self, prefs):

View File

@ -260,19 +260,11 @@ class CommonTestCase(unittest.TestCase):
if self.expected == 'fail':
try:
testMethod()
assert not self.marionette.check_for_crash()
except:
raise _ExpectedFailure(sys.exc_info())
raise _UnexpectedSuccess
else:
try:
testMethod()
assert not self.marionette.check_for_crash()
except _UnexpectedSuccess:
try:
assert not self.marionette.check_for_crash()
except self.failureException:
raise _ExpectedFailure(sys.exc_info())
testMethod()
except self.failureException:
result.addFailure(self, sys.exc_info())
except KeyboardInterrupt:
@ -517,11 +509,11 @@ class MarionetteTestCase(CommonTestCase):
(self.filepath.replace('\\', '\\\\'), self.methodName))
def tearDown(self):
if not self.marionette.check_for_crash():
self.marionette.set_context("content")
self.marionette.execute_script("log('TEST-END: %s:%s')" %
(self.filepath.replace('\\', '\\\\'), self.methodName))
self.marionette.test_name = None
self.marionette.check_for_crash()
self.marionette.set_context("content")
self.marionette.execute_script("log('TEST-END: %s:%s')" %
(self.filepath.replace('\\', '\\\\'), self.methodName))
self.marionette.test_name = None
CommonTestCase.tearDown(self)
def get_new_emulator(self):

View File

@ -499,8 +499,9 @@ class BaseMarionetteTestRunner(object):
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 and not marionette.check_for_crash():
# In the event we're gathering debug without starting a session, skip marionette commands
if marionette.session is not None:
try:
marionette.set_context(marionette.CONTEXT_CHROME)
rv['screenshot'] = marionette.screenshot()
@ -589,19 +590,15 @@ class BaseMarionetteTestRunner(object):
def _build_kwargs(self):
kwargs = {
'app': self.app,
'device_serial': self.device_serial,
'symbols_path': self.symbols_path,
'timeout': self.timeout,
'process_args': {
'stream': None
}
}
if self.bin:
kwargs.update({
'host': 'localhost',
'port': 2828,
'app': self.app,
'app_args': self.app_args,
'bin': self.bin,
'profile': self.profile,
@ -623,6 +620,14 @@ class BaseMarionetteTestRunner(object):
if self.emulator:
kwargs['connectToRunningEmulator'] = True
if not self.bin:
try:
#establish a socket connection so we can vertify the data come back
connection = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
connection.connect((host,int(port)))
connection.close()
except Exception, e:
raise Exception("Connection attempt to %s:%s failed with error: %s" %(host,port,e))
elif self.emulator:
kwargs.update({
'emulator': self.emulator,
@ -754,6 +759,11 @@ setReq.onerror = function() {
for failed_test in self.failures:
self.logger.info('%s' % failed_test[0])
try:
self.marionette.check_for_crash()
except:
traceback.print_exc()
self.end_time = time.time()
self.elapsedtime = self.end_time - self.start_time
@ -896,6 +906,8 @@ setReq.onerror = function() {
for test in tests:
self.run_test(test['filepath'], test['expected'], test['test_container'])
if self.marionette.check_for_crash():
break
def run_test_sets(self):
if self.total_chunks > len(self.tests):

View File

@ -247,8 +247,8 @@ class HTMLReportingTestResultMixin(object):
def gather_debug(self):
debug = {}
# in the event we're gathering debug without starting a session, skip marionette commands
if self.marionette.session is not None and not self.marionette.check_for_crash():
# In the event we're gathering debug without starting a session, skip marionette commands
if self.marionette.session is not None:
try:
self.marionette.set_context(self.marionette.CONTEXT_CHROME)
debug['screenshot'] = self.marionette.screenshot()

View File

@ -3,7 +3,7 @@ manifestparser
mozhttpd >= 0.5
mozinfo >= 0.7
mozprocess >= 0.9
mozrunner >= 6.4
mozrunner >= 6.2
mozdevice >= 0.37
mozlog >= 2.7
moznetwork >= 0.21

View File

@ -2,7 +2,7 @@ import os
from setuptools import setup, find_packages
import sys
version = '0.8.5'
version = '0.8.4'
# dependencies
with open('requirements.txt') as f:

View File

@ -128,9 +128,6 @@ class B2GContext(object):
return find_executable(binary)
def start_application(self):
self.dm.shellCheckOutput(['start', 'b2g'])
def stop_application(self):
self.dm.shellCheckOutput(['stop', 'b2g'])

View File

@ -257,10 +257,6 @@ class Device(object):
# Remove the test profile
self.dm.removeDir(self.app_ctx.remote_profile)
# Restart the application
self.app_ctx.start_application()
def _rotate_log(self, srclog, index=1):
"""
Rotate a logfile, by recursively rotating logs further in the sequence,