From 9ad275a8f1382a8273dfcaccf5ae7a2ede83ce97 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 11 May 2026 15:48:03 +1000 Subject: [PATCH] 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: --- test/pyxtest/README.md | 4 ++-- test/pyxtest/conftest.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/pyxtest/README.md b/test/pyxtest/README.md index 0c1eec7ca..e7684de04 100644 --- a/test/pyxtest/README.md +++ b/test/pyxtest/README.md @@ -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. diff --git a/test/pyxtest/conftest.py b/test/pyxtest/conftest.py index 1f49a7da0..cf8bf141d 100644 --- a/test/pyxtest/conftest.py +++ b/test/pyxtest/conftest.py @@ -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