diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2023-02-20 10:50:05 +0100 |
---|---|---|
committer | Marge Bot <marge-bot@gnome.org> | 2023-03-04 09:07:44 +0000 |
commit | 4005fda90267b820a0b114c206dad54dda26b558 (patch) | |
tree | abbd527d3593d67c3dda45a7ceb87d9b0b324e06 | |
parent | 3be189192a4192f3c2743817e448b6b09b5a8714 (diff) | |
download | mutter-4005fda90267b820a0b114c206dad54dda26b558.tar.gz |
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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2849>
-rw-r--r-- | src/tests/xwayland-tests.c | 35 |
1 files changed, 35 insertions, 0 deletions
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 @@ -215,12 +215,47 @@ meta_test_xwayland_crash_only_x11 (void) } 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) { g_test_add_func ("/backends/xwayland/restart/selection", 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 |