Bug 1495430 - Use AndroidMixin in web_platform_tests.py mozharness script; r=bc,automatedtester

This commit is contained in:
Geoff Brown 2018-10-11 09:47:56 -06:00
Родитель cce55b662a
Коммит 355c3ff64a
2 изменённых файлов: 82 добавлений и 2 удалений

Просмотреть файл

@ -0,0 +1,50 @@
# ***** BEGIN LICENSE BLOCK *****
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.
# ***** END LICENSE BLOCK *****
import os
config = {
"options": [
"--prefs-root=%(test_path)s/prefs",
"--processes=1",
"--config=%(test_path)s/wptrunner.ini",
"--ca-cert-path=%(test_path)s/tests/tools/certs/cacert.pem",
"--host-key-path=%(test_path)s/tests/tools/certs/web-platform.test.key",
"--host-cert-path=%(test_path)s/tests/tools/certs/web-platform.test.pem",
"--certutil-binary=%(xre_path)s/certutil",
"--product=fennec",
],
"avds_dir": "/builds/worker/workspace/build/.android",
"binary_path": "/tmp",
"download_minidump_stackwalk": False,
"emulator_avd_name": "test-1",
"emulator_extra_args": "-gpu swiftshader_indirect -skip-adb-auth -verbose -show-kernel -use-system-libs -ranchu -selinux permissive -memory 3072 -cores 4",
"emulator_manifest": """
[
{
"size": 135064025,
"digest": "125678c5b0d93ead8bbf01ba94253e532909417b40637460624cfca34e92f431534fc77a0225e9c4728dcbcf2884a8f7fa1ee059efdfa82d827ca20477d41705",
"algorithm": "sha512",
"filename": "android-sdk_r27.1.12-linux-x86emu.tar.gz",
"unpack": "True"
}
] """,
"emulator_process_name": "emulator64-x86",
"env": {
"PATH": "%(PATH)s:%(abs_work_dir)s/android-sdk-linux/emulator:%(abs_work_dir)s/android-sdk-linux/tools:%(abs_work_dir)s/android-sdk-linux/platform-tools",
},
"exes": {
'adb': '%(abs_work_dir)s/android-sdk-linux/platform-tools/adb',
},
"geckodriver": "%(abs_test_bin_dir)s/geckodriver",
"hostutils_manifest_path": "testing/config/tooltool-manifests/linux64/hostutils.manifest",
"log_tbpl_level": "info",
"log_raw_level": "info",
"minidump_stackwalk_path": "/usr/local/bin/linux64-minidump_stackwalk",
"per_test_category": "web-platform",
"tooltool_cache": os.environ.get("TOOLTOOL_CACHE"),
"tooltool_manifest_path": "testing/config/tooltool-manifests/androidx86_7_0/releng.manifest",
"tooltool_servers": ['http://relengapi/tooltool/'],
}

Просмотреть файл

@ -18,6 +18,7 @@ import mozinfo
from mozharness.base.errors import BaseErrorList
from mozharness.base.script import PreScriptAction
from mozharness.base.vcs.vcsbase import MercurialScript
from mozharness.mozilla.testing.android import AndroidMixin
from mozharness.mozilla.testing.testbase import TestingMixin, testing_config_options
from mozharness.mozilla.testing.codecoverage import (
CodeCoverageMixin,
@ -29,7 +30,7 @@ from mozharness.mozilla.structuredlog import StructuredOutputParser
from mozharness.base.log import INFO
class WebPlatformTest(TestingMixin, MercurialScript, CodeCoverageMixin):
class WebPlatformTest(TestingMixin, MercurialScript, CodeCoverageMixin, AndroidMixin):
config_options = [
[['--test-type'], {
"action": "extend",
@ -104,9 +105,12 @@ class WebPlatformTest(TestingMixin, MercurialScript, CodeCoverageMixin):
config_options=self.config_options,
all_actions=[
'clobber',
'setup-avds',
'start-emulator',
'download-and-extract',
'create-virtualenv',
'pull',
'verify-device',
'install',
'run-tests',
],
@ -121,6 +125,9 @@ class WebPlatformTest(TestingMixin, MercurialScript, CodeCoverageMixin):
self.installer_path = c.get('installer_path')
self.binary_path = c.get('binary_path')
self.abs_app_dir = None
self.xre_path = None
if self.is_emulator:
self.device_serial = 'emulator-5554'
def query_abs_app_dir(self):
"""We can't set this in advance, because OSX install directories
@ -144,6 +151,10 @@ class WebPlatformTest(TestingMixin, MercurialScript, CodeCoverageMixin):
dirs['abs_test_bin_dir'] = os.path.join(dirs['abs_test_install_dir'], 'bin')
dirs["abs_wpttest_dir"] = os.path.join(dirs['abs_test_install_dir'], "web-platform")
dirs['abs_blob_upload_dir'] = os.path.join(abs_dirs['abs_work_dir'], 'blobber_upload_dir')
if self.is_android:
dirs['abs_xre_dir'] = os.path.join(abs_dirs['abs_work_dir'], 'hostutils')
if self.is_emulator:
dirs['abs_avds_dir'] = self.config.get('avds_dir')
abs_dirs.update(dirs)
self.abs_dirs = abs_dirs
@ -187,7 +198,8 @@ class WebPlatformTest(TestingMixin, MercurialScript, CodeCoverageMixin):
'test_path': dirs["abs_wpttest_dir"],
'test_install_path': dirs["abs_test_install_dir"],
'abs_app_dir': abs_app_dir,
'abs_work_dir': dirs["abs_work_dir"]
'abs_work_dir': dirs["abs_work_dir"],
'xre_path': self.xre_path,
}
cmd = [self.query_python_path('python'), '-u']
@ -214,6 +226,10 @@ class WebPlatformTest(TestingMixin, MercurialScript, CodeCoverageMixin):
"--run-by-dir=%i" % (3 if not mozinfo.info["asan"] else 0),
"--no-pause-after-test"]
if self.is_android:
cmd += ["--device-serial=%s" % self.device_serial]
cmd += ["--package-name=%s" % self.query_package_name()]
if not sys.platform.startswith("linux"):
cmd += ["--exclude=css"]
@ -282,8 +298,19 @@ class WebPlatformTest(TestingMixin, MercurialScript, CodeCoverageMixin):
"mozpack/*",
"mozbuild/*"],
suite_categories=["web-platform"])
if self.is_android:
dirs = self.query_abs_dirs()
self.xre_path = self.download_hostutils(dirs['abs_xre_dir'])
def install(self):
if self.is_android:
self.install_apk(self.installer_path)
else:
super(WebPlatformTest, self).install()
def _install_fonts(self):
if self.is_android:
return
# Ensure the Ahem font is available
dirs = self.query_abs_dirs()
@ -327,6 +354,9 @@ class WebPlatformTest(TestingMixin, MercurialScript, CodeCoverageMixin):
else:
env['STYLO_THREADS'] = '4'
if self.is_android:
env['ADB_PATH'] = self.adb_path
env = self.query_env(partial_env=env, log_level=INFO)
start_time = datetime.now()