зеркало из https://github.com/mozilla/gecko-dev.git
Bug 978333 - Try to use localhost for marionette webserver if possible. r=jgriffin
This commit is contained in:
Родитель
34877461b4
Коммит
d3bc526224
|
@ -534,7 +534,6 @@ class BaseMarionetteTestRunner(object):
|
||||||
self.logger = logger
|
self.logger = logger
|
||||||
self.noWindow = noWindow
|
self.noWindow = noWindow
|
||||||
self.httpd = None
|
self.httpd = None
|
||||||
self.baseurl = None
|
|
||||||
self.marionette = None
|
self.marionette = None
|
||||||
self.logcat_dir = logcat_dir
|
self.logcat_dir = logcat_dir
|
||||||
self.xml_output = xml_output
|
self.xml_output = xml_output
|
||||||
|
@ -620,17 +619,18 @@ class BaseMarionetteTestRunner(object):
|
||||||
self.todo = 0
|
self.todo = 0
|
||||||
self.failures = []
|
self.failures = []
|
||||||
|
|
||||||
def start_httpd(self):
|
def start_httpd(self, need_external_ip):
|
||||||
host = moznetwork.get_ip()
|
host = "127.0.0.1"
|
||||||
|
if need_external_ip:
|
||||||
|
host = moznetwork.get_ip()
|
||||||
self.httpd = MozHttpd(host=host,
|
self.httpd = MozHttpd(host=host,
|
||||||
port=0,
|
port=0,
|
||||||
docroot=os.path.join(os.path.dirname(os.path.dirname(__file__)), 'www'))
|
docroot=os.path.join(os.path.dirname(os.path.dirname(__file__)), 'www'))
|
||||||
self.httpd.start()
|
self.httpd.start()
|
||||||
self.baseurl = 'http://%s:%d/' % (host, self.httpd.httpd.server_port)
|
self.marionette.baseurl = 'http://%s:%d/' % (host, self.httpd.httpd.server_port)
|
||||||
self.logger.info('running webserver on %s' % self.baseurl)
|
self.logger.info('running webserver on %s' % self.marionette.baseurl)
|
||||||
|
|
||||||
def start_marionette(self):
|
def start_marionette(self):
|
||||||
assert(self.baseurl is not None)
|
|
||||||
if self.bin:
|
if self.bin:
|
||||||
if self.address:
|
if self.address:
|
||||||
host, port = self.address.split(':')
|
host, port = self.address.split(':')
|
||||||
|
@ -643,7 +643,6 @@ class BaseMarionetteTestRunner(object):
|
||||||
app_args=self.app_args,
|
app_args=self.app_args,
|
||||||
bin=self.bin,
|
bin=self.bin,
|
||||||
profile=self.profile,
|
profile=self.profile,
|
||||||
baseurl=self.baseurl,
|
|
||||||
timeout=self.timeout,
|
timeout=self.timeout,
|
||||||
device_serial=self.device_serial)
|
device_serial=self.device_serial)
|
||||||
elif self.address:
|
elif self.address:
|
||||||
|
@ -660,7 +659,6 @@ class BaseMarionetteTestRunner(object):
|
||||||
host=host, port=int(port),
|
host=host, port=int(port),
|
||||||
connectToRunningEmulator=True,
|
connectToRunningEmulator=True,
|
||||||
homedir=self.homedir,
|
homedir=self.homedir,
|
||||||
baseurl=self.baseurl,
|
|
||||||
logcat_dir=self.logcat_dir,
|
logcat_dir=self.logcat_dir,
|
||||||
gecko_path=self.gecko_path,
|
gecko_path=self.gecko_path,
|
||||||
symbols_path=self.symbols_path,
|
symbols_path=self.symbols_path,
|
||||||
|
@ -669,7 +667,6 @@ class BaseMarionetteTestRunner(object):
|
||||||
else:
|
else:
|
||||||
self.marionette = Marionette(host=host,
|
self.marionette = Marionette(host=host,
|
||||||
port=int(port),
|
port=int(port),
|
||||||
baseurl=self.baseurl,
|
|
||||||
timeout=self.timeout,
|
timeout=self.timeout,
|
||||||
device_serial=self.device_serial)
|
device_serial=self.device_serial)
|
||||||
elif self.emulator:
|
elif self.emulator:
|
||||||
|
@ -679,7 +676,6 @@ class BaseMarionetteTestRunner(object):
|
||||||
emulatorImg=self.emulatorImg,
|
emulatorImg=self.emulatorImg,
|
||||||
emulator_res=self.emulator_res,
|
emulator_res=self.emulator_res,
|
||||||
homedir=self.homedir,
|
homedir=self.homedir,
|
||||||
baseurl=self.baseurl,
|
|
||||||
noWindow=self.noWindow,
|
noWindow=self.noWindow,
|
||||||
logcat_dir=self.logcat_dir,
|
logcat_dir=self.logcat_dir,
|
||||||
gecko_path=self.gecko_path,
|
gecko_path=self.gecko_path,
|
||||||
|
@ -738,10 +734,7 @@ class BaseMarionetteTestRunner(object):
|
||||||
self.reset_test_stats()
|
self.reset_test_stats()
|
||||||
starttime = datetime.utcnow()
|
starttime = datetime.utcnow()
|
||||||
|
|
||||||
if not self.httpd:
|
need_external_ip = True
|
||||||
print "starting httpd"
|
|
||||||
self.start_httpd()
|
|
||||||
|
|
||||||
if not self.marionette:
|
if not self.marionette:
|
||||||
self.start_marionette()
|
self.start_marionette()
|
||||||
if self.emulator:
|
if self.emulator:
|
||||||
|
@ -749,6 +742,14 @@ class BaseMarionetteTestRunner(object):
|
||||||
# Retrieve capabilities for later use
|
# Retrieve capabilities for later use
|
||||||
if not self._capabilities:
|
if not self._capabilities:
|
||||||
self.capabilities
|
self.capabilities
|
||||||
|
# if we're working against a desktop version, we usually don't need
|
||||||
|
# an external ip
|
||||||
|
if self._capabilities['device'] == "desktop":
|
||||||
|
need_external_ip = False
|
||||||
|
|
||||||
|
if not self.httpd:
|
||||||
|
print "starting httpd"
|
||||||
|
self.start_httpd(need_external_ip)
|
||||||
|
|
||||||
for test in tests:
|
for test in tests:
|
||||||
self.add_test(test)
|
self.add_test(test)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче