Module: tools
Branch: master
Commit: 1ac164b1d6af05258a864270cafc61bf60ad9dc5
URL: https://source.winehq.org/git/tools.git/?a=commit;h=1ac164b1d6af05258a86427…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Tue Feb 8 23:46:22 2022 +0100
testbot/SetWinLocale: Better detect when Windows has rebooted.
This no longer relies on a long pause to give time for Windows to start
rebooting and should detect when TestAgentd is ready again faster.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/bin/SetWinLocale | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/testbot/bin/SetWinLocale b/testbot/bin/SetWinLocale
index df0d6f7..b43b501 100755
--- a/testbot/bin/SetWinLocale
+++ b/testbot/bin/SetWinLocale
@@ -902,18 +902,19 @@ if ($OptReboot)
{
my $Cmd = ["shutdown.exe", "/r", "/t", "0"];
Debug(Elapsed($Start), " Rebooting: ", join(" ", @$Cmd), "\n");
+ my $OldCount = $TA->GetProperties("start.count");
$TA->Run($Cmd, 0);
# Note that we cannot wait for this command since it reboots Windows
- # Wait a bit to make sure we don't reconnect before Windows has rebooted.
- sleep(30);
-
- Debug(Elapsed($Start), " Waiting for Windows to boot\n");
- $TA->SetConnectTimeout(undef, undef, $WaitForBoot);
- if (!$TA->Ping())
+ my ($OneTimeout, $MinAttempts, $MinTimeout) = $TA->SetConnectTimeout(3, 1, 3);
+ while (1)
{
- FatalError("could not reconnect to $OptHostName after the reboot: ", $TA->GetLastError(), "\n");
+ my $NewCount = $TA->GetProperties("start.count");
+ next if (!defined $NewCount); # Rebooting (TestAgentd is not running)
+ last if ($NewCount != $OldCount); # start.count got incremented
+ sleep(10); # Not rebooting yet
}
+ $TA->SetConnectTimeout($OneTimeout, $MinAttempts, $MinTimeout);
# Skip this check on pre-Windows 10 versions, i.e. those that don't have
# 'CountryName' and if the settings were not changed in the first place.