Francois Gouget : testbot/SetWinLocale: Add an option to change the locale of VMs.

Alexandre Julliard julliard at winehq.org
Wed Apr 6 15:55:31 CDT 2022


Module: tools
Branch: master
Commit: 10eb4bde779f4a9e74ffc7c58dabc62bd8aa7105
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=10eb4bde779f4a9e74ffc7c58dabc62bd8aa7105

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Apr  6 14:17:16 2022 +0200

testbot/SetWinLocale: Add an option to change the locale of VMs.

The --vm ensures the right TestAgent connection parameters will be used
to connect to the specified VM.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 testbot/bin/SetWinLocale | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/testbot/bin/SetWinLocale b/testbot/bin/SetWinLocale
index 670de46..e41af20 100755
--- a/testbot/bin/SetWinLocale
+++ b/testbot/bin/SetWinLocale
@@ -40,6 +40,7 @@ use WineTestBot::Config;
 use WineTestBot::Log;
 use WineTestBot::TestAgent;
 use WineTestBot::Utils;
+use WineTestBot::VMs;
 
 my $HKCU_INTERNATIONAL = "HKCU\\Control Panel\\International";
 my $HKCU_GEO = "HKCU\\Control Panel\\International\\Geo";
@@ -315,7 +316,7 @@ sub CheckLocale($$)
   return undef;
 }
 
-my ($OptHostName, $OptShow, $OptSysCopy, $OptDefCopy, $OptUseIntl, $OptReboot);
+my ($OptVM, $OptHostName, $OptShow, $OptSysCopy, $OptDefCopy, $OptUseIntl, $OptReboot);
 my ($OptDefault, $OptLocale, $OptCountry, $OptSystem, $OptUTF8, $OptMUI, $OptKeyboard);
 while (@ARGV)
 {
@@ -324,6 +325,10 @@ while (@ARGV)
   {
     $Usage = 0;
   }
+  elsif ($Arg eq "--vm")
+  {
+    $OptVM = CheckValue($Arg, $OptVM);
+  }
   elsif ($Arg eq "--show")
   {
     $OptShow = 1;
@@ -415,10 +420,25 @@ while (@ARGV)
 }
 
 # Check and untaint parameters
-my ($Keyboard, $CountryId);
+my ($VM, $Keyboard, $CountryId);
 if (!defined $Usage)
 {
-  if (!defined $OptHostName)
+  if (defined $OptVM)
+  {
+    my $VMs = CreateVMs();
+    $VM = $VMs->GetItem($OptVM);
+    if (!$VM)
+    {
+      Error("could not find the '$OptVM' VM\n");
+      $Usage = 2;
+    }
+    elsif (!$Debug and $VM->Role eq "deleted")
+    {
+      Error("'$OptVM' is marked for deletion\n");
+      $Usage = 2;
+    }
+  }
+  elsif (!defined $OptHostName)
   {
     Error("you must specify the Windows machine to work on\n");
     $Usage = 2;
@@ -510,14 +530,16 @@ if (defined $Usage)
     Error("try '$name0 --help' for more information\n");
     exit $Usage;
   }
-  print "Usage: $name0 [options] --show HOSTNAME\n";
-  print "or     $name0 [options] [--default DEF] [--locale LOC] [--country CTY] [--system SYS] [--utf8] [--mui MUI] [--keyboard KBD] [--no-sys-copy] [--no-def-copy] [--use-intl] [--no-reboot] HOSTNAME\n";
+  print "Usage: $name0 [options] --show (HOSTNAME|--vm VM)\n";
+  print "or     $name0 [options] [--default DEF] [--locale LOC] [--country CTY] [--system SYS] [--utf8] [--mui MUI] [--keyboard KBD] [--no-sys-copy] [--no-def-copy] [--use-intl] [--no-reboot] (HOSTNAME|--vm VM)\n";
   print "\n";
   print "Sets the locale of the specified Windows machine.\n";
   print "\n";
   print "Where:\n";
   print "  HOSTNAME       Work on the specified Windows host (must be running TestAgentd).\n";
   print "  --show         Show the locale settings of the specified host and exit.\n";
+  print "  --vm VM        Work on the specified TestBot VM, using its TestAgent\n";
+  print "                 connection parameters.\n";
   print "  --default DEF  Use this Windows locale as the default for the other options.\n";
   print "                 The locale must be in a form suitable for Windows' intl.cpl\n";
   print "                 control panel module, that is roughly ll-CC where ll is an\n";
@@ -604,7 +626,7 @@ if (defined $Usage)
   exit 0;
 }
 
-$TA = TestAgent->new($OptHostName, $AgentPort);
+$TA = $VM ? $VM->GetAgent() : TestAgent->new($OptHostName, $AgentPort);
 
 
 #




More information about the wine-cvs mailing list