From 4005fda90267b820a0b114c206dad54dda26b558 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Mon, 20 Feb 2023 10:50:05 +0100 Subject: [PATCH] test: Add a test for "activate" hammering This is what "terminator" (the terminal emulator) does, it basically calls gdk_window_focus() in a loop thousands of times at startup. This in turn fills up the Wayland connection between Xwayland and mutter, and eventually the session dies. See-also: https://github.com/gnome-terminator/terminator/issues/714 Part-of: --- src/tests/xwayland-tests.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/tests/xwayland-tests.c b/src/tests/xwayland-tests.c index ad115f4aa..dc3608b5e 100644 --- a/src/tests/xwayland-tests.c +++ b/src/tests/xwayland-tests.c @@ -214,6 +214,39 @@ meta_test_xwayland_crash_only_x11 (void) meta_test_client_destroy (test_client2); } +static void +meta_test_hammer_activate (void) +{ + MetaTestClient *x11_client; + MetaTestClient *wayland_client; + g_autoptr (GError) error = NULL; + int i; + + x11_client = meta_test_client_new (test_context, "x11-client", + META_WINDOW_CLIENT_TYPE_X11, + &error); + g_assert_nonnull (x11_client); + wayland_client = meta_test_client_new (test_context, "wayland-client", + META_WINDOW_CLIENT_TYPE_WAYLAND, + &error); + g_assert_nonnull (wayland_client); + + meta_test_client_run (x11_client, + "create 1\n" + "show 1\n"); + + meta_test_client_run (wayland_client, + "create 2\n" + "show 2\n"); + + meta_test_client_run (x11_client, "activate 1"); + for (i = 0; i < 10000; i++) + meta_test_client_run (wayland_client, "activate 2"); + + meta_test_client_destroy (x11_client); + meta_test_client_destroy (wayland_client); +} + static void init_tests (void) { @@ -221,6 +254,8 @@ init_tests (void) meta_test_xwayland_restart_selection); g_test_add_func ("/backends/xwayland/crash/only-x11", meta_test_xwayland_crash_only_x11); + g_test_add_func ("/backends/xwayland/crash/hammer-activate", + meta_test_hammer_activate); } int