ozone/wayland: Support running tests in mutter using xvfb.py
Add a new --use-mutter option in xvfb.py to be able to run tests using mutter wayland compositor. Also, add the required packages for install-build-deps.sh. Design doc: https://docs.google.com/document/d/16p8xuNKwAAuN70C9zTV_MXFE5d1WTcciVHZyG6hDsDo/edit?usp=sharing Fixed: 391154461 Change-Id: Iccb89a8bcc0ae16a24f494915a068e46c7e7a300 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6239954 Commit-Queue: Orko Garai <orko@igalia.com> Reviewed-by: Thomas Anderson <thomasanderson@chromium.org> Reviewed-by: Maksim Sisov <msisov@igalia.com> Reviewed-by: Ben Pastene <bpastene@chromium.org> Cr-Commit-Position: refs/heads/main@{#1429188}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
e90111b3f9
commit
f682a9b724
@ -436,6 +436,12 @@ def lib_list():
|
||||
else:
|
||||
packages.append("libasound2")
|
||||
|
||||
# Run-time packages required by interactive_ui_tests on mutter
|
||||
if package_exists("libgraphene-1.0-0"):
|
||||
packages.append("libgraphene-1.0-0")
|
||||
if package_exists("mutter-common"):
|
||||
packages.append("mutter-common")
|
||||
|
||||
return packages
|
||||
|
||||
|
||||
|
@ -304,22 +304,36 @@ use_glib=true
|
||||
use_gtk=true
|
||||
```
|
||||
|
||||
Running some test suites requires a Wayland server. If you're not
|
||||
running one you can use a locally compiled version of Weston. This is
|
||||
what the build bots do. Please note that this is required for
|
||||
interactive_ui_tests, as those tests use a patched version of Weston's
|
||||
test plugin. Add this to your gn args:
|
||||
Running some test suites requires a Wayland server. If you're not running one
|
||||
you can use a locally compiled version of Weston or Mutter. This is what the
|
||||
build bots do. Please note that this is required for interactive_ui_tests, as
|
||||
those tests use a patched version of the compositor.
|
||||
|
||||
Add this to your gn args:
|
||||
|
||||
``` shell
|
||||
# For weston
|
||||
use_bundled_weston = true
|
||||
```
|
||||
|
||||
Then run the xvfb.py wrapper script and tell it to start Weston:
|
||||
``` shell
|
||||
# For mutter
|
||||
use_bundled_mutter = true
|
||||
```
|
||||
|
||||
Then run the xvfb.py wrapper script and tell it to start the compositor with the tests:
|
||||
|
||||
``` shell
|
||||
cd out/debug # or your out directory
|
||||
```
|
||||
``` shell
|
||||
# For weston
|
||||
../../testing/xvfb.py --use-weston --no-xvfb ./views_unittests --ozone-platform=wayland
|
||||
```
|
||||
``` shell
|
||||
# For mutter
|
||||
../../testing/xvfb.py --use-mutter --no-xvfb ./views_unittests --ozone-platform=wayland
|
||||
```
|
||||
|
||||
Feel free to discuss with us on freenode.net, `#ozone-wayland` channel or on
|
||||
`ozone-dev`, or on `#ozone-wayland-x11` channel in [chromium slack](https://www.chromium.org/developers/slack).
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Copyright 2012 The Chromium Authors
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
"""Runs tests with Xvfb or Xorg and Openbox or Weston on Linux and normally on
|
||||
"""Runs tests with Xvfb/Xorg and Openbox/Weston/Mutter on Linux and normally on
|
||||
other platforms."""
|
||||
|
||||
from __future__ import print_function
|
||||
@ -179,11 +179,24 @@ def run_executable(cmd,
|
||||
use_weston = True
|
||||
cmd.remove('--use-weston')
|
||||
|
||||
use_mutter = False
|
||||
if '--use-mutter' in cmd:
|
||||
if use_xvfb or use_xorg or use_weston:
|
||||
print('Unable to use mutter with xvfb or Xorg or weston.\n',
|
||||
file=sys.stderr)
|
||||
return 1
|
||||
use_mutter = True
|
||||
cmd.remove('--use-mutter')
|
||||
|
||||
if sys.platform.startswith('linux') and (use_xvfb or use_xorg):
|
||||
return _run_with_x11(cmd, env, stdoutfile, use_openbox, use_xcompmgr,
|
||||
use_xorg, xvfb_whd or DEFAULT_XVFB_WHD, cwd)
|
||||
if use_weston:
|
||||
return _run_with_weston(cmd, env, stdoutfile, cwd)
|
||||
|
||||
if use_mutter:
|
||||
return _run_with_mutter(cmd, env, stdoutfile, cwd)
|
||||
|
||||
return test_env.run_executable(cmd, env, stdoutfile, cwd)
|
||||
|
||||
|
||||
@ -597,6 +610,40 @@ def _weston_config_file_path():
|
||||
return os.path.join(tempfile.gettempdir(), '.xvfb.py-weston.ini')
|
||||
|
||||
|
||||
def _run_with_mutter(cmd, env, stdoutfile, cwd):
|
||||
with dbus_session(env):
|
||||
mutter_proc = None
|
||||
|
||||
try:
|
||||
mutter_executable = './mutter'
|
||||
compositor_found, cmd = _run_with_wayland_common(mutter_executable, cmd,
|
||||
env)
|
||||
if not compositor_found:
|
||||
return test_env.run_executable(cmd, env, stdoutfile, cwd)
|
||||
|
||||
# Use headless wayland backend with a virtual monitor of appropriate size.
|
||||
mutter_cmd = [
|
||||
mutter_executable, '--headless', '--virtual-monitor=1280x800', '--'
|
||||
]
|
||||
|
||||
# AppArmor is enabled in Ubuntu 24 where mutter tests run on CI bots. So
|
||||
# disable sandbox.
|
||||
cmd = mutter_cmd + cmd + ['--no-sandbox']
|
||||
|
||||
if '--mutter-debug-logging' in cmd:
|
||||
cmd.remove('--mutter-debug-logging')
|
||||
env = copy.deepcopy(env)
|
||||
env['G_MESSAGES_DEBUG'] = 'libmutter'
|
||||
env['MUTTER_DEBUG'] = 'input'
|
||||
|
||||
return test_env.run_executable(cmd, env, stdoutfile, cwd)
|
||||
except _ProcessError as e:
|
||||
print('mutter fail: %s\n' % str(e), file=sys.stderr)
|
||||
return 1
|
||||
finally:
|
||||
kill(mutter_proc, 'mutter')
|
||||
|
||||
|
||||
def _get_display_from_weston(weston_proc_pid):
|
||||
"""Retrieves $WAYLAND_DISPLAY set by Weston.
|
||||
|
||||
@ -686,7 +733,8 @@ def main():
|
||||
usage = ('[command [--no-xvfb or --use-xvfb or --use-weston] args...]\n'
|
||||
'\t --no-xvfb\t\tTurns off all X11 backings (Xvfb and Xorg).\n'
|
||||
'\t --use-xvfb\t\tForces legacy Xvfb backing instead of Xorg.\n'
|
||||
'\t --use-weston\t\tEnable Wayland server.')
|
||||
'\t --use-weston\t\tEnable Weston Wayland server.\n'
|
||||
'\t --use-mutter\t\tEnable Mutter Wayland server.')
|
||||
# TODO(crbug.com/326283384): Argparse-ify this.
|
||||
if len(sys.argv) < 2:
|
||||
print(usage + '\n', file=sys.stderr)
|
||||
|
Reference in New Issue
Block a user