Bug 1612345 - Ensure that most custom retriggers repeat the original task by default; r=bc

Various updates to the custom retrigger action so that, without any custom changes to
parameters, the retriggered task runs with the same parameters as the original task.
Several issues were found and corrected, notably:
 - parameters like --allow-software-gl-layers were ignored
 - MOZHARNESS_TEST_PATHS was ignored
 - many parameter customizations in the desktop mozharness configs were ignored
 - mochitest suite/subsuite/flavor selection was not always correct
 - using repeat=1 by default meant that each test ran twice

Differential Revision: https://phabricator.services.mozilla.com/D70457
This commit is contained in:
Geoff Brown 2020-04-17 22:11:02 +00:00
parent cb7f18181e
commit e245496607
5 changed files with 111 additions and 21 deletions

View File

@ -5,6 +5,7 @@
from __future__ import absolute_import, unicode_literals, print_function
import os
import sys
from argparse import Namespace
from functools import partial
@ -14,10 +15,17 @@ from mach.decorators import (
)
here = os.path.abspath(os.path.dirname(__file__))
logger = None
def run_reftest(context, **kwargs):
import mozinfo
from mozlog.commandline import setup_logging
if not kwargs.get('log'):
kwargs['log'] = setup_logging('reftest', kwargs, {'mach': sys.stdout})
global logger
logger = kwargs['log']
args = Namespace(**kwargs)
args.e10s = context.mozharness_config.get('e10s', args.e10s)
@ -29,6 +37,9 @@ def run_reftest(context, **kwargs):
normalize = partial(context.normalize_test_path, test_root)
args.tests = map(normalize, args.tests)
if kwargs.get('allow_software_gl_layers'):
os.environ['MOZ_LAYERS_ALLOW_SOFTWARE_GL'] = '1'
if mozinfo.info.get('buildapp') == 'mobile/android':
return run_reftest_android(context, args)
return run_reftest_desktop(context, args)
@ -40,6 +51,10 @@ def run_reftest_desktop(context, args):
args.app = args.app or context.firefox_bin
args.extraProfileFiles.append(os.path.join(context.bin_dir, 'plugins'))
args.utilityPath = context.bin_dir
args.sandboxReadWhitelist.append(context.mozharness_workdir)
args.extraPrefs.append('layers.acceleration.force-enabled=true')
logger.info("mach calling runreftest with args: " + str(args))
return run_test_harness(parser, args)
@ -56,14 +71,26 @@ def run_reftest_android(context, args):
config = context.mozharness_config
if config:
args.remoteWebServer = config['remote_webserver']
args.httpPort = config['emulator']['http_port']
args.sslPort = config['emulator']['ssl_port']
host = os.environ.get("HOST_IP", "10.0.2.2")
args.remoteWebServer = config.get('remote_webserver', host)
args.httpPort = config.get('http_port', 8854)
args.sslPort = config.get('ssl_port', 4454)
args.adb_path = config['exes']['adb'] % {'abs_work_dir': context.mozharness_workdir}
args.deviceSerial = os.environ.get('DEVICE_SERIAL', 'emulator-5554')
logger.info("mach calling remotereftest with args: " + str(args))
return run_test_harness(parser, args)
def add_global_arguments(parser):
parser.add_argument('--test-suite')
parser.add_argument('--reftest-suite')
parser.add_argument('--download-symbols')
parser.add_argument('--allow-software-gl-layers', action='store_true')
parser.add_argument('--no-run-tests', action='store_true')
def setup_argument_parser():
import mozinfo
import reftestcommandline
@ -74,6 +101,7 @@ def setup_argument_parser():
parser = reftestcommandline.RemoteArgumentsParser()
else:
parser = reftestcommandline.DesktopArgumentsParser()
add_global_arguments(parser)
return parser

View File

@ -233,6 +233,6 @@ fi
# Run a custom mach command (this is typically used by action tasks to run
# harnesses in a particular way)
if [ "$CUSTOM_MACH_COMMAND" ]; then
eval "'$WORKSPACE/build/tests/mach' ${CUSTOM_MACH_COMMAND}"
eval "'$WORKSPACE/build/tests/mach' ${CUSTOM_MACH_COMMAND} ${@}"
exit $?
fi

View File

@ -57,8 +57,8 @@ extended_properties.update({
},
'repeat': {
'type': 'integer',
'default': 1,
'minimum': 1,
'default': 0,
'minimum': 0,
'title': 'Repeat test(s) N times',
'description': ('Run test(s) repeatedly (usually used in '
'conjunction with runUntilFail)')

View File

@ -15,7 +15,7 @@ from mach.decorators import (
here = os.path.abspath(os.path.dirname(__file__))
parser = None
log = None
logger = None
def run_gtest(context, **kwargs):
@ -23,8 +23,8 @@ def run_gtest(context, **kwargs):
if not kwargs.get('log'):
kwargs['log'] = setup_logging('gtest', kwargs, {'mach': sys.stdout})
global log
log = kwargs['log']
global logger
logger = kwargs['log']
args = Namespace(**kwargs)
@ -42,14 +42,14 @@ def run_gtest_desktop(context, args):
utility_path = context.bin_dir
cwd = os.path.join(context.package_root, 'gtest')
log.info("mach calling run_gtest with prog=%s xre_path=%s cwd=%s utility_path=%s" %
(prog, xre_path, cwd, utility_path))
logger.info("mach calling run_gtest with prog=%s xre_path=%s cwd=%s utility_path=%s" %
(prog, xre_path, cwd, utility_path))
# The gtest option parser ignores some options normally passed to the mozharness
# command, so some hacking is required, for now:
extra_args = [arg for arg in args.args if not arg.startswith('-')]
if extra_args:
os.environ['GTEST_FILTER'] = extra_args[0]
log.info("GTEST_FILTER=%s" % extra_args[0])
logger.info("GTEST_FILTER=%s" % extra_args[0])
import rungtests
tester = rungtests.GTests()
@ -67,13 +67,13 @@ def run_gtest_android(context, args):
cwd = os.path.join(context.package_root, 'gtest')
libxul_path = os.path.join(cwd, 'gtest_bin', 'gtest', 'libxul.so')
log.info("mach calling android run_gtest with package=%s cwd=%s libxul=%s" %
(args.package, cwd, libxul_path))
logger.info("mach calling android run_gtest with package=%s cwd=%s libxul=%s" %
(args.package, cwd, libxul_path))
# The remote gtest option parser ignores some options normally passed to the mozharness
# command, so some hacking is required, for now:
extra_args = [arg for arg in args.args if not arg.startswith('-')]
test_filter = extra_args[0] if extra_args else None
log.info("test filter=%s" % test_filter)
logger.info("test filter=%s" % test_filter)
import remotegtests
tester = remotegtests.RemoteGTests()

View File

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import json
import os
import sys
from argparse import Namespace
@ -16,7 +17,7 @@ from mach.decorators import (
here = os.path.abspath(os.path.dirname(__file__))
parser = None
log = None
logger = None
def run_test(context, is_junit, **kwargs):
@ -25,8 +26,8 @@ def run_test(context, is_junit, **kwargs):
if not kwargs.get('log'):
kwargs['log'] = setup_logging('mochitest', kwargs, {'mach': sys.stdout})
global log
log = kwargs['log']
global logger
logger = kwargs['log']
flavor = kwargs.get('flavor') or 'mochitest'
if flavor not in ALL_FLAVORS:
@ -37,6 +38,18 @@ def run_test(context, is_junit, **kwargs):
fobj = ALL_FLAVORS[flavor]
kwargs.update(fobj.get('extra_args', {}))
if kwargs.get('allow_software_gl_layers'):
os.environ['MOZ_LAYERS_ALLOW_SOFTWARE_GL'] = '1'
del kwargs['allow_software_gl_layers']
if kwargs.get('mochitest_suite'):
suite = kwargs['mochitest_suite']
del kwargs['mochitest_suite']
elif kwargs.get('test_suite'):
suite = kwargs['test_suite']
del kwargs['test_suite']
if kwargs.get('no_run_tests'):
del kwargs['no_run_tests']
args = Namespace(**kwargs)
args.e10s = context.mozharness_config.get('e10s', args.e10s)
args.certPath = context.certs_dir
@ -44,6 +57,34 @@ def run_test(context, is_junit, **kwargs):
if is_junit:
return run_geckoview_junit(context, args)
# subsuite mapping from mozharness configs
subsuites = {
# --mochitest-suite -> --subsuite
"mochitest-chrome-gpu": "gpu",
"mochitest-plain-gpu": "gpu",
"mochitest-media": "media",
"mochitest-browser-chrome-screenshots": "screenshots",
"mochitest-webgl1-core": "webgl1-core",
"mochitest-webgl1-ext": "webgl1-ext",
"mochitest-webgl2-core": "webgl2-core",
"mochitest-webgl2-ext": "webgl2-ext",
"mochitest-webgl2-deqp": "webgl2-deqp",
"mochitest-webgpu": "webgpu",
"mochitest-devtools-chrome": "devtools",
"mochitest-remote": "remote",
}
args.subsuite = subsuites.get(suite)
if args.subsuite == 'devtools':
args.flavor = 'browser'
if not args.test_paths:
mh_test_paths = json.loads(os.environ.get('MOZHARNESS_TEST_PATHS', '""'))
if mh_test_paths:
logger.info("Found MOZHARNESS_TEST_PATHS:")
logger.info(str(mh_test_paths))
args.test_paths = []
for k in mh_test_paths:
args.test_paths.extend(mh_test_paths[k])
if args.test_paths:
install_subdir = fobj.get('install_subdir', fobj['suite'])
test_root = os.path.join(context.package_root, 'mochitest', install_subdir)
@ -60,9 +101,20 @@ def run_mochitest_desktop(context, args):
args.app = args.app or context.firefox_bin
args.utilityPath = context.bin_dir
args.extraProfileFiles.append(os.path.join(context.bin_dir, 'plugins'))
args.extraPrefs.append("webgl.force-enabled=true")
args.quiet = True
args.useTestMediaDevices = True
args.screenshotOnFail = True
args.cleanupCrashes = True
args.marionette_startup_timeout = '180'
args.sandboxReadWhitelist.append(context.mozharness_workdir)
if args.flavor == 'browser':
args.chunkByRuntime = True
else:
args.chunkByDir = 4
from runtests import run_test_harness
log.info("mach calling runtests with args: " + str(args))
logger.info("mach calling runtests with args: " + str(args))
return run_test_harness(parser, args)
@ -86,7 +138,7 @@ def run_mochitest_android(context, args):
args.extraProfileFiles.append(os.path.join(context.package_root, 'mochitest', 'fonts'))
from runtestsremote import run_test_harness
log.info("mach calling runtestsremote with args: " + str(args))
logger.info("mach calling runtestsremote with args: " + str(args))
return run_test_harness(parser, args)
@ -94,10 +146,18 @@ def run_geckoview_junit(context, args):
args = set_android_args(context, args)
from runjunit import run_test_harness
log.info("mach calling runjunit with args: " + str(args))
logger.info("mach calling runjunit with args: " + str(args))
return run_test_harness(parser, args)
def add_global_arguments(parser):
parser.add_argument('--test-suite')
parser.add_argument('--mochitest-suite')
parser.add_argument('--download-symbols')
parser.add_argument('--allow-software-gl-layers', action='store_true')
parser.add_argument('--no-run-tests', action='store_true')
def setup_mochitest_argument_parser():
import mozinfo
mozinfo.find_and_update_from_json(here)
@ -108,6 +168,7 @@ def setup_mochitest_argument_parser():
from mochitest_options import MochitestArgumentParser
global parser
parser = MochitestArgumentParser(app=app)
add_global_arguments(parser)
return parser
@ -115,6 +176,7 @@ def setup_junit_argument_parser():
from runjunit import JunitArgumentParser
global parser
parser = JunitArgumentParser()
add_global_arguments(parser)
return parser