mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-07 10:48:05 +02:00
Extend support for extra arguments in Xwayland configuration
Add support for specifying extra command-line arguments for Xwayland via the [xwayland] config section using the extra-args key. This enables testing different X server configurations (e.g., MIT-SHM extension enable/disable) both in automated tests and manual usage. Changes include: Add xwayland_extra_args field to compositor_setup struct for test harness Generate [xwayland] config section with extra-args in test setup Parse and append extra args to Xwayland command line in spawn_xserver Update xwayland tests to use parameterized fixtures for MIT-SHM configs Signed-off-by: Martin Lopatář <lopin@dataplex.cz>
This commit is contained in:
parent
a78e051421
commit
bc6cd801ac
4 changed files with 50 additions and 2 deletions
|
|
@ -112,6 +112,8 @@ spawn_xserver(void *user_data, const char *display, int abstract_fd, int unix_fd
|
|||
struct fdstr x11_wm_socket = FDSTR_INIT;
|
||||
struct fdstr display_pipe = FDSTR_INIT;
|
||||
char *xserver = NULL;
|
||||
char *extra_args = NULL;
|
||||
struct weston_string_array extra_args_array = { 0 };
|
||||
struct weston_config *config = wet_get_config(wxw->compositor);
|
||||
struct weston_config_section *section;
|
||||
struct wl_client *client;
|
||||
|
|
@ -154,6 +156,10 @@ spawn_xserver(void *user_data, const char *display, int abstract_fd, int unix_fd
|
|||
section = weston_config_get_section(config, "xwayland", NULL, NULL);
|
||||
weston_config_section_get_string(section, "path",
|
||||
&xserver, XSERVER_PATH);
|
||||
weston_config_section_get_string(section, "extra-args", &extra_args, NULL);
|
||||
if (extra_args)
|
||||
extra_args_array = weston_parse_space_separated_list(extra_args);
|
||||
|
||||
custom_env_init_from_environ(&child_env);
|
||||
custom_env_set_env_var(&child_env, "WAYLAND_SOCKET", wayland_socket.str1);
|
||||
|
||||
|
|
@ -170,6 +176,9 @@ spawn_xserver(void *user_data, const char *display, int abstract_fd, int unix_fd
|
|||
custom_env_add_arg(&child_env, x11_wm_socket.str1);
|
||||
custom_env_add_arg(&child_env, "-terminate");
|
||||
|
||||
for (size_t i = 0; i < extra_args_array.len; i++)
|
||||
custom_env_add_arg(&child_env, extra_args_array.array[i]);
|
||||
|
||||
wxw->process =
|
||||
wet_client_launch(wxw->compositor, &child_env,
|
||||
no_cloexec_fds, num_no_cloexec_fds,
|
||||
|
|
@ -208,6 +217,10 @@ spawn_xserver(void *user_data, const char *display, int abstract_fd, int unix_fd
|
|||
handle_display_fd, wxw);
|
||||
|
||||
free(xserver);
|
||||
if (extra_args)
|
||||
free(extra_args);
|
||||
if (extra_args_array.array)
|
||||
weston_string_array_fini(&extra_args_array);
|
||||
|
||||
return client;
|
||||
|
||||
|
|
@ -216,6 +229,10 @@ err_proc:
|
|||
wl_list_remove(&wxw->process->link);
|
||||
err:
|
||||
free(xserver);
|
||||
if (extra_args)
|
||||
free(extra_args);
|
||||
if (extra_args_array.array)
|
||||
weston_string_array_fini(&extra_args_array);
|
||||
fdstr_close_all(&display_pipe);
|
||||
fdstr_close_all(&x11_wm_socket);
|
||||
fdstr_close_all(&wayland_socket);
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@ compositor_setup_defaults_(struct compositor_setup *setup,
|
|||
.renderer = WESTON_RENDERER_NOOP,
|
||||
.shell = SHELL_TEST_DESKTOP,
|
||||
.xwayland = false,
|
||||
.xwayland_extra_args = NULL,
|
||||
.width = 320,
|
||||
.height = 240,
|
||||
.scale = 1,
|
||||
|
|
@ -490,6 +491,14 @@ weston_ini_setup_(struct compositor_setup *setup, ...)
|
|||
weston_ini = open_ini_file(setup);
|
||||
test_assert_ptr_not_null(weston_ini);
|
||||
|
||||
/* Write xwayland section if extra args are specified */
|
||||
if (setup->xwayland_extra_args) {
|
||||
ret = fprintf(weston_ini, "[xwayland]\n");
|
||||
test_assert_int_ge(ret, 0);
|
||||
ret = fprintf(weston_ini, "extra-args=%s\n", setup->xwayland_extra_args);
|
||||
test_assert_int_ge(ret, 0);
|
||||
}
|
||||
|
||||
va_start(entry_list, setup);
|
||||
write_cfg(entry_list, weston_ini);
|
||||
va_end(entry_list);
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@ struct compositor_setup {
|
|||
enum shell_type shell;
|
||||
/** Whether to enable xwayland support. */
|
||||
bool xwayland;
|
||||
/** Extra arguments to pass to Xwayland, or NULL for none. */
|
||||
const char *xwayland_extra_args;
|
||||
/** Default output width. */
|
||||
unsigned width;
|
||||
/** Default output height. */
|
||||
|
|
@ -113,6 +115,7 @@ compositor_setup_defaults_(struct compositor_setup *setup,
|
|||
* - renderer: noop
|
||||
* - shell: test desktop shell
|
||||
* - xwayland: no
|
||||
* - xwayland_extra_args: none
|
||||
* - width: 320
|
||||
* - height: 240
|
||||
* - refresh: 0 (repaint only on demand)
|
||||
|
|
|
|||
|
|
@ -48,8 +48,24 @@
|
|||
#include "weston-test-assert.h"
|
||||
#include "xcb-client-helper.h"
|
||||
|
||||
struct setup_args {
|
||||
struct fixture_metadata meta;
|
||||
const char *extra_args;
|
||||
};
|
||||
|
||||
static const struct setup_args my_setup_args[] = {
|
||||
{
|
||||
.extra_args = "-extension MIT-SHM",
|
||||
.meta.name = "MIT-SHM-disabled"
|
||||
},
|
||||
{
|
||||
.extra_args = "+extension MIT-SHM",
|
||||
.meta.name = "MIT-SHM-enabled"
|
||||
},
|
||||
};
|
||||
|
||||
static enum test_result_code
|
||||
fixture_setup(struct weston_test_harness *harness)
|
||||
fixture_setup(struct weston_test_harness *harness, const struct setup_args *arg)
|
||||
{
|
||||
struct compositor_setup setup;
|
||||
|
||||
|
|
@ -59,11 +75,14 @@ fixture_setup(struct weston_test_harness *harness)
|
|||
setup.shell = SHELL_TEST_DESKTOP;
|
||||
setup.refresh = HIGHEST_OUTPUT_REFRESH;
|
||||
setup.xwayland = true;
|
||||
setup.xwayland_extra_args = arg->extra_args;
|
||||
setup.logging_scopes = "log,xwm-wm-x11";
|
||||
|
||||
weston_ini_setup(&setup, NULL);
|
||||
|
||||
return weston_test_harness_execute_as_client(harness, &setup);
|
||||
}
|
||||
DECLARE_FIXTURE_SETUP(fixture_setup);
|
||||
DECLARE_FIXTURE_SETUP_WITH_ARG(fixture_setup, my_setup_args, meta);
|
||||
|
||||
static char *
|
||||
get_x11_window_name(struct window_x11 *window, xcb_drawable_t win)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue