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@codeweavers.com --- testbot/bin/SetWinLocale | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/testbot/bin/SetWinLocale b/testbot/bin/SetWinLocale index 2324a5cb16..dc551853af 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.
This matches LibvirtTool.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- I believe a reason was added to LibvirtTool because the (some?) Windows server editions require a shutdown reason, even if it is a dummy one. I don't know if the same is true for reboots. SetWinLocale has probably not been used on the Windows server editions so far.
testbot/bin/SetWinLocale | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testbot/bin/SetWinLocale b/testbot/bin/SetWinLocale index dc551853af..818a67b31d 100755 --- a/testbot/bin/SetWinLocale +++ b/testbot/bin/SetWinLocale @@ -900,7 +900,7 @@ SetWinLocales($OptSysCopy, $OptDefCopy, $OptLocale, $CountryId,
if ($OptReboot) { - my $Cmd = ["shutdown.exe", "/r", "/t", "0"]; + my $Cmd = ["shutdown.exe", "/r", "/d", "00:00", "/t", "0"]; Debug(Elapsed($Start), " Rebooting: ", join(" ", @$Cmd), "\n"); my $OldCount = $TA->GetProperties("start.count"); $TA->Run($Cmd, 0);
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/SetWinLocale | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/testbot/bin/SetWinLocale b/testbot/bin/SetWinLocale index 818a67b31d..4a67a6ac5e 100755 --- a/testbot/bin/SetWinLocale +++ b/testbot/bin/SetWinLocale @@ -869,7 +869,7 @@ sub SetWinLocales($$$$$$$$) $KeyboardIds ? $KeyboardIds->[0] : ".", $SysCopy ? "true" : "false", $DefCopy ? "true" : "false", $OptUseIntl ? "true" : "false"]; - Debug(Elapsed($Start), " Running: ", join(" ", @$Cmd), "\n"); + Debug(Elapsed($Start), " Running: @$Cmd\n"); my $Ret = $TA->RunAndWait($Cmd, 0, 30, undef, "$name0.out", "$name0.out"); FatalError("$name0.ps1 locales failed: ", $TA->GetLastError(), "\n") if ($Ret < 0); my $Out = $TA->GetFileToString("$name0.out"); @@ -901,7 +901,7 @@ SetWinLocales($OptSysCopy, $OptDefCopy, $OptLocale, $CountryId, if ($OptReboot) { my $Cmd = ["shutdown.exe", "/r", "/d", "00:00", "/t", "0"]; - Debug(Elapsed($Start), " Rebooting: ", join(" ", @$Cmd), "\n"); + Debug(Elapsed($Start), " Rebooting: @$Cmd\n"); my $OldCount = $TA->GetProperties("start.count"); $TA->Run($Cmd, 0); # Note that we cannot wait for this command since it reboots Windows