Module: tools
Branch: master
Commit: 243a8835efd1cd3ee79529fc9830dbcc79184c02
URL: https://source.winehq.org/git/tools.git/?a=commit;h=243a8835efd1cd3ee79529f…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Mon Jan 24 20:57:10 2022 +0100
testbot/SetWinLocale: Remove the --dry-run option.
It is not really useful for debugging or otherwise and supporting it
makes parts of the code significantly more complex.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/bin/SetWinLocale | 75 +++++++++++++++++-------------------------------
1 file changed, 26 insertions(+), 49 deletions(-)
diff --git a/testbot/bin/SetWinLocale b/testbot/bin/SetWinLocale
index 55722e1..f806498 100755
--- a/testbot/bin/SetWinLocale
+++ b/testbot/bin/SetWinLocale
@@ -68,11 +68,10 @@ sub Error(@)
print STDERR "$name0:error: ", @_;
}
-my $DryRun;
my $Debug;
sub Debug(@)
{
- print STDERR @_ if ($Debug or $DryRun);
+ print STDERR @_ if ($Debug);
}
my $Start = Time();
@@ -356,10 +355,6 @@ while (@ARGV)
{
$Debug = 1;
}
- elsif ($Arg eq "--dry-run")
- {
- $DryRun = 1;
- }
elsif ($Arg =~ /^-/)
{
Error("unknown option '$Arg'\n");
@@ -483,7 +478,6 @@ if (defined $Usage)
print " --no-reboot Do not reboot Windows. Some locale changes will only take\n";
print " effect after the next reboot.\n";
print " --debug Show more detailed information about progress.\n";
- print " --dry-run Show what would happen but do nothing.\n";
print " --help Shows this usage message.\n";
exit 0;
}
@@ -769,11 +763,9 @@ push @Config, "</gs:GlobalizationServices>";
# Change the Windows locale using intl.cpl
#
-Debug(Elapsed($Start), " Sending the configuration file\n");
-print STDERR join("\n", "locales.xml:", @Config, "") if ($DryRun or $Debug);
+Debug(Elapsed($Start), join("\n", " Sending the configuration file\nlocales.xml:", @Config, ""));
-if (!$DryRun and
- !$TA->SendFileFromString(join("\r\n", @Config, ""), "locales.xml", 0))
+if (!$TA->SendFileFromString(join("\r\n", @Config, ""), "locales.xml", 0))
{
FatalError("could not send the configuration file:", $TA->GetLastError(), "\n");
}
@@ -781,41 +773,33 @@ if (!$DryRun and
# For some reason this only works when run from a batch script!
Debug(Elapsed($Start), " Sending the batch file\n");
my $Cmd = 'control.exe intl.cpl,,/f:"locales.xml"';
-if ($DryRun)
-{
- print STDERR "script.bat: $Cmd\n";
-}
-elsif (!$TA->SendFileFromString($Cmd, "script.bat", $TestAgent::SENDFILE_EXE))
+if (!$TA->SendFileFromString($Cmd, "script.bat", $TestAgent::SENDFILE_EXE))
{
FatalError("could not send the batch file:", $TA->GetLastError(), "\n");
}
Debug(Elapsed($Start), " Running intl.cpl\n");
-if (!$DryRun)
+my $Pid = $TA->Run(["./script.bat"], 0);
+if (!$Pid)
{
- my $Pid = $TA->Run(["./script.bat"], 0);
- if (!$Pid)
- {
- FatalError("failed to run intl.cpl\n");
- }
+ FatalError("failed to run intl.cpl\n");
+}
- # Unfortunately the control.exe and/or intl.cpl exit code is unusable so
- # there is no way to check for errors
- Debug(Elapsed($Start), " Waiting for intl.cpl\n");
- if (!defined $TA->Wait($Pid, 120))
- {
- FatalError("could not run intl.cpl: ", $TA->GetLastError(), "\n");
- }
+# Unfortunately the control.exe and/or intl.cpl exit code is unusable so
+# there is no way to check for errors
+Debug(Elapsed($Start), " Waiting for intl.cpl\n");
+if (!defined $TA->Wait($Pid, 120))
+{
+ FatalError("could not run intl.cpl: ", $TA->GetLastError(), "\n");
+}
- if ($Debug)
- {
- print STDERR "Not deleting script.bat and locales.xml\n";
- }
- else
- {
- $TA->Rm("script.bat");
- $TA->Rm("locales.xml");
- }
+if ($Debug)
+{
+ print STDERR "Not deleting script.bat and locales.xml\n";
+}
+else
+{
+ $TA->Rm("script.bat", "locales.xml");
}
@@ -841,22 +825,15 @@ if ($OptReboot)
{
Debug(Elapsed($Start), " Rebooting Windows\n");
$Cmd = ["shutdown.exe", "/r", "/t", "0"];
- if ($DryRun)
- {
- print STDERR "Running ", join(" ", @$Cmd), "\n";
- }
- else
- {
- $TA->Run($Cmd, 0);
- # Note that we cannot wait for this command since it reboots Windows
- }
+ $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) if (!$DryRun);
+ sleep(30);
Debug(Elapsed($Start), " Waiting for Windows to boot\n");
$TA->SetConnectTimeout(undef, undef, $WaitForBoot);
- if (!$DryRun and !$TA->Ping())
+ if (!$TA->Ping())
{
FatalError("could not reconnect to $OptHostName after the reboot: ", $TA->GetLastError(), "\n");
}