[tools 2/2] testbot/LibvirtTool: Add support for UTF-8 and Unicode-only locales.

Francois Gouget fgouget at codeweavers.com
Wed Feb 16 13:11:27 CST 2022


Adding '-u8' to a snapshot name sets the code pages to UTF-8 and allows
using a Unicode-only locale as the Windows system locale.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
For instance for hi_HI (but also en_AE!).

 testbot/bin/LibvirtTool.pl | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl
index aecca4b534..f714e48545 100755
--- a/testbot/bin/LibvirtTool.pl
+++ b/testbot/bin/LibvirtTool.pl
@@ -561,7 +561,7 @@ sub GetSnapshotConfig($)
     {
       $Config->{locale} ||= $1; # take only the last match
     }
-    elsif ($Config->{base} =~ s/-(live)$//)
+    elsif ($Config->{base} =~ s/-(live|u8)$//)
     {
       $Config->{$1} = 1;
     }
@@ -615,20 +615,28 @@ sub CreateSnapshot($$$$)
     # A side effect is that it will force TestAgentd.exe.old to stay around.
   }
 
-  if ($Config->{locale})
+  my @Locale;
+  push @Locale, $Config->{locale} if ($Config->{locale});
+  push @Locale, $Config->{u8} if ($Config->{u8});
+  if (@Locale)
   {
-    Debug(Elapsed($Start), " Setting up the $Config->{locale} locale on $VMKey\n");
-    # SetWinLocale --default performs a reboot and WaitForBoot()
-    ResetBootCount($TA);
+    Debug(Elapsed($Start), " Setting up the @Locale locale on $VMKey\n");
+    my @Cmd = ("$BinDir/SetWinLocale", $VM->Hostname);
+    if ($Config->{locale})
+    {
+      push @Cmd, "--default", $Config->{locale};
+      # SetWinLocale --default performs a reboot and WaitForBoot()
+      ResetBootCount($TA);
+      $Booting = 1;
+    }
+    push @Cmd, "--utf8" if ($Config->{u8});
+    push @Cmd, "--debug" if ($Debug);
     $TA->Disconnect();
-    $Booting = 1;
 
-    my @Cmd = ("$BinDir/SetWinLocale", $VM->Hostname, "--default", $Config->{locale});
-    push @Cmd, "--debug" if ($Debug);
-    Debug("Running: ", join(" ", @Cmd), "\n");
+    Debug("Running: @Cmd\n");
     if (system(@Cmd))
     {
-      FatalError("Could not set the $VMKey locale to $Config->{locale}\n");
+      FatalError("Could not set the $VMKey locale to @Locale\n");
     }
   }
 
-- 
2.30.2



More information about the wine-devel mailing list