From 66b745c840febaeb7199613d001d44347bbbbb78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20R=C5=AF=C5=BEi=C4=8Dka?= Date: Wed, 20 Nov 2024 19:16:26 +0100 Subject: [PATCH] Use mutex to synchronize servers. --- tests/remote_desktop_freerdp.pm | 5 +++++ tests/remote_desktop_server.pm | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/tests/remote_desktop_freerdp.pm b/tests/remote_desktop_freerdp.pm index 67ac71f3..d2a3f0c7 100644 --- a/tests/remote_desktop_freerdp.pm +++ b/tests/remote_desktop_freerdp.pm @@ -20,6 +20,9 @@ sub run { # Return to the desktop desktop_vt(); + # Wait until the RDP server is ready + mutex_lock("kaermorhen_opened"); + # Open terminal and make a connection to the remote server. menu_launch_type("terminal"); wait_still_screen(3); @@ -42,6 +45,8 @@ sub run { # Check that we are on the correct computer. # We can tell from the terminal prompt. assert_screen("freerdp_desktop_connected"); + + mutex_unlock("kaermorhen_opened"); } sub test_flags { diff --git a/tests/remote_desktop_server.pm b/tests/remote_desktop_server.pm index 4efcf0e9..3871c23c 100644 --- a/tests/remote_desktop_server.pm +++ b/tests/remote_desktop_server.pm @@ -2,6 +2,8 @@ use base "installedtest"; use strict; use testapi; use utils; +use lockapi; +use mmapi; sub run { my $self = shift; @@ -51,10 +53,23 @@ sub run { wait_still_screen(3); send_key("alt-f4"); + # RDP does not allow connections when the user is still logged in + # locally, therefore we need to log the user out first. + assert_and_click("system_menu_button"); + assert_and_click("leave_button"); + assert_and_click("log_out_entry"); + assert_and_click("log_out_confirm"); + sleep(10); + + # Check that the service is running. $self->root_console(tty => 3); assert_script_run("ps aux | grep rdp", timeout => 10); + # Create mutex to synchronise with the children. + mutex_create("kaermorhen_opened"); + wait_for_children(); + } sub test_flags {