pyxtest: require root to run the test as Xorg

This is the easiest way to notify users that it just won't run as-is.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2213>
This commit is contained in:
Peter Hutterer 2026-05-11 15:48:03 +10:00 committed by Marge Bot
parent 87dd72ce99
commit 9ad275a8f1
2 changed files with 5 additions and 2 deletions

View file

@ -4,8 +4,8 @@ This is a pytest-based test suite that launches X servers and sends crafted
protocol requests to verify that security vulnerabilities and other bugs
are properly handled.
It can be run against Xvfb, Xwayland, or Xorg but the latter is potentially
flaky and requires some setup outside the test suite. The test suite
It can be run against Xvfb, Xwayland, or Xorg but the latter typically
requires root and/or some setup outside the test suite. The test suite
uses both AddressSanitizer (ASAN) and valgrind for detecting
memory errors such as out-of-bounds reads/writes and use-after-free.

View file

@ -173,6 +173,9 @@ def _start_server(request, server_type, log_file=None):
is set in the environment (typically by meson when the server is
built with ``-Db_sanitize=address``).
"""
if server_type == "xorg" and os.geteuid() != 0:
pytest.skip("Xorg requires root to access /dev/tty0 and GPU devices")
use_valgrind = (
request.config.getoption("--valgrind")
or request.node.get_closest_marker("valgrind") is not None