From d1547f1b6adaf075f5c00b5cc08e3cab791f2f80 Mon Sep 17 00:00:00 2001 From: Pierre Le Marre Date: Mon, 25 Mar 2024 15:01:19 +0100 Subject: [PATCH] test(x11): Warn for missing Xvfb program Xvfb is required for *running* X11 tests. We do not make it mandatory in the meson setup though, because we did not find a way to require a *run* time dependency. --- meson.build | 4 ++++ test/xvfb-wrapper.c | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 2de4ee9b..1183563a 100644 --- a/meson.build +++ b/meson.build @@ -769,6 +769,10 @@ test( env: test_env, ) if get_option('enable-x11') + has_xvfb = find_program("Xvfb", required=false) + if not has_xvfb.found() + warning('Xvfb program not found, but is required to run X11 tests.') + endif test( 'x11', executable('test-x11', 'test/x11.c', dependencies: x11_test_dep), diff --git a/test/xvfb-wrapper.c b/test/xvfb-wrapper.c index ab0c645d..167c3ca2 100644 --- a/test/xvfb-wrapper.c +++ b/test/xvfb-wrapper.c @@ -67,7 +67,6 @@ xvfb_wrapper(int (*test_func)(char* display)) goto err_display_fd; } snprintf(display_fd_string, sizeof(display_fd_string), "%d", fileno(display_fd)); - fprintf(stderr, "display_fd_string: %s\n", display_fd_string); /* Set SIGUSR1 to SIG_IGN so Xvfb will send us that signal * when it's ready to accept connections */ @@ -92,6 +91,11 @@ xvfb_wrapper(int (*test_func)(char* display)) ret = posix_spawnp(&xvfb_pid, "Xvfb", NULL, NULL, xvfb_argv, envp); if (ret != 0) { fprintf(stderr, "posix_spawnp error %d: %s\n", ret, strerror(ret)); + if (ret == ENOENT) { + fprintf(stderr, + "Xvfb may be missing. Please install the corresponding " + "package, e.g. \"xvfb\" or \"xorg-x11-server-Xvfb\".\n"); + } ret = TEST_SETUP_FAILURE; goto err_xvfd; }