зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1387265 - Expand talos tp6 to macosx; r=jmaher
MozReview-Commit-ID: 78LGHEJNGz4 --HG-- extra : rebase_source : ad7189968b15ea7cd830d18a0e7033df65d8489f
This commit is contained in:
Родитель
c15c300513
Коммит
1721a468a7
|
@ -140,6 +140,9 @@ GPATH
|
||||||
^testing/talos/talos/tests/devtools/damp.manifest.develop
|
^testing/talos/talos/tests/devtools/damp.manifest.develop
|
||||||
^talos-venv
|
^talos-venv
|
||||||
^py3venv
|
^py3venv
|
||||||
|
^testing/talos/talos/mitmproxy/mitmdump
|
||||||
|
^testing/talos/talos/mitmproxy/mitmproxy
|
||||||
|
^testing/talos/talos/mitmproxy/mitmweb
|
||||||
|
|
||||||
# Ignore files created when running a reftest.
|
# Ignore files created when running a reftest.
|
||||||
^lextab.py$
|
^lextab.py$
|
||||||
|
|
|
@ -229,6 +229,7 @@ macosx64-tests-talos:
|
||||||
- talos-tp5o
|
- talos-tp5o
|
||||||
- talos-perf-reftest
|
- talos-perf-reftest
|
||||||
- talos-perf-reftest-singletons
|
- talos-perf-reftest-singletons
|
||||||
|
- talos-tp6
|
||||||
|
|
||||||
linux32-tests:
|
linux32-tests:
|
||||||
- cppunit
|
- cppunit
|
||||||
|
|
|
@ -1854,6 +1854,7 @@ talos-tp6:
|
||||||
run-on-projects:
|
run-on-projects:
|
||||||
by-test-platform:
|
by-test-platform:
|
||||||
windows.*: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try', 'date']
|
windows.*: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try', 'date']
|
||||||
|
macosx.*: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try', 'date']
|
||||||
default: []
|
default: []
|
||||||
max-run-time: 3600
|
max-run-time: 3600
|
||||||
mozharness:
|
mozharness:
|
||||||
|
|
|
@ -405,8 +405,16 @@ class Talos(TestingMixin, MercurialScript, BlobUploadMixin, TooltoolMixin,
|
||||||
self.info("Skipping: mitmproxy is not required")
|
self.info("Skipping: mitmproxy is not required")
|
||||||
return
|
return
|
||||||
|
|
||||||
# setup python 3.x virtualenv
|
# tp6 is supported in production only on win and macosx
|
||||||
self.setup_py3_virtualenv()
|
os_name = self.platform_name()
|
||||||
|
if 'win' not in os_name and os_name != 'macosx':
|
||||||
|
self.fatal("Aborting: this test is not supported on this platform.")
|
||||||
|
|
||||||
|
# on windows we need to install a pytyon 3 virtual env; on macosx we
|
||||||
|
# use a mitmdump pre-built binary that doesn't need an external python 3
|
||||||
|
if 'win' in os_name:
|
||||||
|
# setup python 3.x virtualenv
|
||||||
|
self.setup_py3_virtualenv()
|
||||||
|
|
||||||
# install mitmproxy
|
# install mitmproxy
|
||||||
self.install_mitmproxy()
|
self.install_mitmproxy()
|
||||||
|
@ -432,9 +440,18 @@ class Talos(TestingMixin, MercurialScript, BlobUploadMixin, TooltoolMixin,
|
||||||
|
|
||||||
def install_mitmproxy(self):
|
def install_mitmproxy(self):
|
||||||
"""Install the mitmproxy tool into the Python 3.x env"""
|
"""Install the mitmproxy tool into the Python 3.x env"""
|
||||||
self.info("Installing mitmproxy")
|
if 'win' in self.platform_name():
|
||||||
self.py3_install_modules(modules=['mitmproxy'])
|
self.info("Installing mitmproxy")
|
||||||
self.mitmdump = os.path.join(self.py3_path_to_executables(), 'mitmdump')
|
self.py3_install_modules(modules=['mitmproxy'])
|
||||||
|
self.mitmdump = os.path.join(self.py3_path_to_executables(), 'mitmdump')
|
||||||
|
else:
|
||||||
|
# on macosx we use a prebuilt mitmproxy release binary
|
||||||
|
mitmproxy_bin_url = 'https://github.com/mitmproxy/mitmproxy/releases/download/v2.0.2/mitmproxy-2.0.2-osx.tar.gz'
|
||||||
|
mitmproxy_path = os.path.join(self.talos_path, 'talos', 'mitmproxy')
|
||||||
|
self.mitmdump = os.path.join(mitmproxy_path, 'mitmdump')
|
||||||
|
if not os.path.exists(self.mitmdump):
|
||||||
|
self.download_unpack(mitmproxy_bin_url, mitmproxy_path)
|
||||||
|
self.info('The mitmdump macosx binary is found at: %s' % self.mitmdump)
|
||||||
self.run_command([self.mitmdump, '--version'], env=self.query_env())
|
self.run_command([self.mitmdump, '--version'], env=self.query_env())
|
||||||
|
|
||||||
def query_mitmproxy_recording_set(self):
|
def query_mitmproxy_recording_set(self):
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
import os
|
import os
|
||||||
|
import psutil
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
@ -81,6 +82,10 @@ def install_mitmproxy_cert(mitmproxy_proc, browser_path, scripts_path):
|
||||||
LOG.info("Installing mitmxproxy CA certficate into Firefox")
|
LOG.info("Installing mitmxproxy CA certficate into Firefox")
|
||||||
# browser_path is exe, we want install dir
|
# browser_path is exe, we want install dir
|
||||||
browser_install = os.path.dirname(browser_path)
|
browser_install = os.path.dirname(browser_path)
|
||||||
|
# on macosx we need to remove the last folders 'Content/MacOS'
|
||||||
|
if mozinfo.os == 'mac':
|
||||||
|
browser_install = browser_install[:-14]
|
||||||
|
|
||||||
LOG.info('Calling configure_mitmproxy with browser folder: %s' % browser_install)
|
LOG.info('Calling configure_mitmproxy with browser folder: %s' % browser_install)
|
||||||
configure_mitmproxy(browser_install, scripts_path)
|
configure_mitmproxy(browser_install, scripts_path)
|
||||||
# cannot continue if failed to add CA cert to Firefox, need to check
|
# cannot continue if failed to add CA cert to Firefox, need to check
|
||||||
|
@ -104,18 +109,21 @@ def start_mitmproxy_playback(mitmdump_path,
|
||||||
# <path>/mitmdump -s "<path>mitmdump-alternate-server-replay/alternate-server-replay.py
|
# <path>/mitmdump -s "<path>mitmdump-alternate-server-replay/alternate-server-replay.py
|
||||||
# <path>recording-1.mp <path>recording-2.mp..."
|
# <path>recording-1.mp <path>recording-2.mp..."
|
||||||
param = os.path.join(here, 'alternate-server-replay.py')
|
param = os.path.join(here, 'alternate-server-replay.py')
|
||||||
|
env = os.environ.copy()
|
||||||
|
|
||||||
# this part is platform-specific
|
# this part is platform-specific
|
||||||
if mozinfo.os == 'win':
|
if mozinfo.os == 'win':
|
||||||
param2 = '""' + param.replace('\\', '\\\\\\') + ' ' + \
|
param2 = '""' + param.replace('\\', '\\\\\\') + ' ' + \
|
||||||
' '.join(mitmproxy_recordings).replace('\\', '\\\\\\') + '""'
|
' '.join(mitmproxy_recordings).replace('\\', '\\\\\\') + '""'
|
||||||
env = os.environ.copy()
|
|
||||||
sys.path.insert(1, mitmdump_path)
|
sys.path.insert(1, mitmdump_path)
|
||||||
# mitmproxy needs some DLL's that are a part of Firefox itself, so add to path
|
# mitmproxy needs some DLL's that are a part of Firefox itself, so add to path
|
||||||
env["PATH"] = os.path.dirname(browser_path) + ";" + env["PATH"]
|
env["PATH"] = os.path.dirname(browser_path) + ";" + env["PATH"]
|
||||||
|
elif mozinfo.os == 'mac':
|
||||||
|
param2 = param + ' ' + ' '.join(mitmproxy_recordings)
|
||||||
|
env["PATH"] = os.path.dirname(browser_path)
|
||||||
else:
|
else:
|
||||||
# TODO: support other platforms, Bug 1366355
|
# TODO: support other platforms, Bug 1366355
|
||||||
LOG.error('Aborting: talos mitmproxy is currently only supported on Windows')
|
LOG.error('Aborting: talos mitmproxy is currently only supported on Windows and Mac')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
command = [mitmdump_path, '-k', '-s', param2]
|
command = [mitmdump_path, '-k', '-s', param2]
|
||||||
|
@ -125,7 +133,7 @@ def start_mitmproxy_playback(mitmdump_path,
|
||||||
# to turn off mitmproxy log output, use these params for Popen:
|
# to turn off mitmproxy log output, use these params for Popen:
|
||||||
# Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
|
# Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
|
||||||
mitmproxy_proc = subprocess.Popen(command, env=env)
|
mitmproxy_proc = subprocess.Popen(command, env=env)
|
||||||
time.sleep(5)
|
time.sleep(10)
|
||||||
data = mitmproxy_proc.poll()
|
data = mitmproxy_proc.poll()
|
||||||
if data is None:
|
if data is None:
|
||||||
LOG.info("Mitmproxy playback successfully started as pid %d" % mitmproxy_proc.pid)
|
LOG.info("Mitmproxy playback successfully started as pid %d" % mitmproxy_proc.pid)
|
||||||
|
@ -138,13 +146,15 @@ def start_mitmproxy_playback(mitmdump_path,
|
||||||
def stop_mitmproxy_playback(mitmproxy_proc):
|
def stop_mitmproxy_playback(mitmproxy_proc):
|
||||||
"""Stop the mitproxy server playback"""
|
"""Stop the mitproxy server playback"""
|
||||||
LOG.info("Stopping mitmproxy playback, klling process %d" % mitmproxy_proc.pid)
|
LOG.info("Stopping mitmproxy playback, klling process %d" % mitmproxy_proc.pid)
|
||||||
mitmproxy_proc.kill()
|
if mozinfo.os == 'mac':
|
||||||
time.sleep(5)
|
mitmproxy_proc.terminate()
|
||||||
exit_code = mitmproxy_proc.poll()
|
|
||||||
if exit_code:
|
|
||||||
LOG.info("Successfully killed the mitmproxy playback process")
|
|
||||||
else:
|
else:
|
||||||
|
mitmproxy_proc.kill()
|
||||||
|
time.sleep(10)
|
||||||
|
if mitmproxy_proc.pid in psutil.pids():
|
||||||
# I *think* we can still continue, as process will be automatically
|
# I *think* we can still continue, as process will be automatically
|
||||||
# killed anyway when mozharness is done (?) if not, we won't be able
|
# killed anyway when mozharness is done (?) if not, we won't be able
|
||||||
# to startup mitmxproy next time if it is already running
|
# to startup mitmxproy next time if it is already running
|
||||||
LOG.error("Failed to kill the mitmproxy playback process")
|
LOG.error("Failed to kill the mitmproxy playback process")
|
||||||
|
else:
|
||||||
|
LOG.info("Successfully killed the mitmproxy playback process")
|
||||||
|
|
Загрузка…
Ссылка в новой задаче