зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1558598
- Force WebRender on or off in the gtest harness. r=ahal
This covers the local and remote gtests, as well as the mach command. Differential Revision: https://phabricator.services.mozilla.com/D35852 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
92b3588b88
Коммит
711c133f6d
|
@ -621,6 +621,9 @@ class GTestCommands(MachCommandBase):
|
|||
@CommandArgument('--libxul',
|
||||
dest='libxul_path',
|
||||
help='(Android only) Path to gtest libxul.so.')
|
||||
@CommandArgument('--enable-webrender', action='store_true',
|
||||
default=False, dest='enable_webrender',
|
||||
help='Enable the WebRender compositor in Gecko.')
|
||||
@CommandArgumentGroup('debugging')
|
||||
@CommandArgument('--debug', action='store_true', group='debugging',
|
||||
help='Enable the debugger. Not specifying a --debugger option will result in '
|
||||
|
@ -633,7 +636,7 @@ class GTestCommands(MachCommandBase):
|
|||
'split as the Bourne shell would.')
|
||||
def gtest(self, shuffle, jobs, gtest_filter, tbpl_parser,
|
||||
package, adb_path, device_serial, remote_test_root, libxul_path,
|
||||
debug, debugger, debugger_args):
|
||||
enable_webrender, debug, debugger, debugger_args):
|
||||
|
||||
# We lazy build gtest because it's slow to link
|
||||
try:
|
||||
|
@ -670,7 +673,8 @@ class GTestCommands(MachCommandBase):
|
|||
print("--debug options are not supported on Android and will be ignored")
|
||||
return self.android_gtest(cwd, shuffle, gtest_filter,
|
||||
package, adb_path, device_serial,
|
||||
remote_test_root, libxul_path)
|
||||
remote_test_root, libxul_path,
|
||||
enable_webrender)
|
||||
|
||||
if package or adb_path or device_serial or remote_test_root or libxul_path:
|
||||
print("One or more Android-only options will be ignored")
|
||||
|
@ -708,6 +712,12 @@ class GTestCommands(MachCommandBase):
|
|||
if tbpl_parser:
|
||||
gtest_env[b"MOZ_TBPL_PARSER"] = b"True"
|
||||
|
||||
if enable_webrender:
|
||||
gtest_env[b"MOZ_WEBRENDER"] = b"1"
|
||||
gtest_env[b"MOZ_ACCELERATED"] = b"1"
|
||||
else:
|
||||
gtest_env[b"MOZ_WEBRENDER"] = b"0"
|
||||
|
||||
if jobs == 1:
|
||||
return self.run_process(args=args,
|
||||
append_env=gtest_env,
|
||||
|
@ -749,7 +759,8 @@ class GTestCommands(MachCommandBase):
|
|||
return exit_code
|
||||
|
||||
def android_gtest(self, test_dir, shuffle, gtest_filter,
|
||||
package, adb_path, device_serial, remote_test_root, libxul_path):
|
||||
package, adb_path, device_serial, remote_test_root, libxul_path,
|
||||
enable_webrender):
|
||||
# setup logging for mozrunner
|
||||
from mozlog.commandline import setup_logging
|
||||
format_args = {'level': self._mach_context.settings['test']['level']}
|
||||
|
@ -774,7 +785,7 @@ class GTestCommands(MachCommandBase):
|
|||
import remotegtests
|
||||
tester = remotegtests.RemoteGTests()
|
||||
tester.run_gtest(test_dir, shuffle, gtest_filter, package, adb_path, device_serial,
|
||||
remote_test_root, libxul_path, None)
|
||||
remote_test_root, libxul_path, None, enable_webrender)
|
||||
tester.cleanup()
|
||||
|
||||
return 0
|
||||
|
|
|
@ -34,7 +34,7 @@ class RemoteGTests(object):
|
|||
def __init__(self):
|
||||
self.device = None
|
||||
|
||||
def build_environment(self, shuffle, test_filter):
|
||||
def build_environment(self, shuffle, test_filter, enable_webrender):
|
||||
"""
|
||||
Create and return a dictionary of all the appropriate env variables
|
||||
and values.
|
||||
|
@ -54,11 +54,15 @@ class RemoteGTests(object):
|
|||
env["GTEST_SHUFFLE"] = "True"
|
||||
if test_filter:
|
||||
env["GTEST_FILTER"] = test_filter
|
||||
if enable_webrender:
|
||||
env["MOZ_WEBRENDER"] = "1"
|
||||
else:
|
||||
env["MOZ_WEBRENDER"] = "0"
|
||||
|
||||
return env
|
||||
|
||||
def run_gtest(self, test_dir, shuffle, test_filter, package, adb_path, device_serial,
|
||||
remote_test_root, libxul_path, symbols_path):
|
||||
remote_test_root, libxul_path, symbols_path, enable_webrender):
|
||||
"""
|
||||
Launch the test app, run gtest, collect test results and wait for completion.
|
||||
Return False if a crash or other failure is detected, else True.
|
||||
|
@ -94,7 +98,7 @@ class RemoteGTests(object):
|
|||
if not os.path.isdir(f):
|
||||
self.device.push(f, self.remote_profile)
|
||||
|
||||
env = self.build_environment(shuffle, test_filter)
|
||||
env = self.build_environment(shuffle, test_filter, enable_webrender)
|
||||
args = ["-unittest", "--gtest_death_test_style=threadsafe",
|
||||
"-profile %s" % self.remote_profile]
|
||||
if 'geckoview' in self.package:
|
||||
|
@ -349,6 +353,11 @@ class remoteGtestOptions(OptionParser):
|
|||
self.add_option("--tests-path",
|
||||
default=None,
|
||||
help="Path to gtest directory containing test support files.")
|
||||
self.add_option("--enable-webrender",
|
||||
action="store_true",
|
||||
dest="enable_webrender",
|
||||
default=False,
|
||||
help="Enable the WebRender compositor in Gecko.")
|
||||
|
||||
|
||||
def update_mozinfo():
|
||||
|
@ -383,7 +392,7 @@ def main():
|
|||
options.shuffle, test_filter, options.package,
|
||||
options.adb_path, options.device_serial,
|
||||
options.remote_test_root, options.libxul_path,
|
||||
options.symbols_path)
|
||||
options.symbols_path, options.enable_webrender)
|
||||
except KeyboardInterrupt:
|
||||
log.info("gtest | Received keyboard interrupt")
|
||||
except Exception as e:
|
||||
|
|
|
@ -26,7 +26,7 @@ class GTests(object):
|
|||
TEST_PROC_NO_OUTPUT_TIMEOUT = 300
|
||||
|
||||
def run_gtest(self, prog, xre_path, cwd, symbols_path=None,
|
||||
utility_path=None):
|
||||
utility_path=None, enable_webrender=False):
|
||||
"""
|
||||
Run a single C++ unit test program.
|
||||
|
||||
|
@ -44,7 +44,7 @@ class GTests(object):
|
|||
Return True if the program exits with a zero status, False otherwise.
|
||||
"""
|
||||
self.xre_path = xre_path
|
||||
env = self.build_environment()
|
||||
env = self.build_environment(enable_webrender)
|
||||
log.info("Running gtest")
|
||||
|
||||
if cwd and not os.path.isdir(cwd):
|
||||
|
@ -110,7 +110,7 @@ class GTests(object):
|
|||
|
||||
return env
|
||||
|
||||
def build_environment(self):
|
||||
def build_environment(self, enable_webrender):
|
||||
"""
|
||||
Create and return a dictionary of all the appropriate env variables
|
||||
and values. On a remote system, we overload this to set different
|
||||
|
@ -149,6 +149,12 @@ class GTests(object):
|
|||
# This should be |testFail| instead of |info|. See bug 1050891.
|
||||
log.info("gtest | Failed to find ASan symbolizer at %s", llvmsym)
|
||||
|
||||
if enable_webrender:
|
||||
env["MOZ_WEBRENDER"] = "1"
|
||||
env["MOZ_ACCELERATED"] = "1"
|
||||
else:
|
||||
env["MOZ_WEBRENDER"] = "0"
|
||||
|
||||
return env
|
||||
|
||||
|
||||
|
@ -175,6 +181,11 @@ class gtestOptions(OptionParser):
|
|||
dest="utility_path",
|
||||
default=None,
|
||||
help="path to a directory containing utility program binaries")
|
||||
self.add_option("--enable-webrender",
|
||||
action="store_true",
|
||||
dest="enable_webrender",
|
||||
default=False,
|
||||
help="Enable the WebRender compositor in Gecko.")
|
||||
|
||||
|
||||
def update_mozinfo():
|
||||
|
@ -209,7 +220,8 @@ def main():
|
|||
result = tester.run_gtest(prog, options.xre_path,
|
||||
options.cwd,
|
||||
symbols_path=options.symbols_path,
|
||||
utility_path=options.utility_path)
|
||||
utility_path=options.utility_path,
|
||||
enable_webrender=options.enable_webrender)
|
||||
except Exception as e:
|
||||
log.error(str(e))
|
||||
result = False
|
||||
|
|
Загрузка…
Ссылка в новой задаче