Module: tools
Branch: master
Commit: c960a95f6025538a9979b56cca652dc7a612615f
URL: https://source.winehq.org/git/tools.git/?a=commit;h=c960a95f6025538a9979b56…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Tue Feb 15 05:03:22 2022 +0100
testbot/LibvirtTool: Clean up the snapshot name parsing.
This also makes it easier to extend it and pass all the configuration
around.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/bin/LibvirtTool.pl | 95 +++++++++++++++++++++++++++-------------------
1 file changed, 56 insertions(+), 39 deletions(-)
diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl
index 3b2794f..d51699f 100755
--- a/testbot/bin/LibvirtTool.pl
+++ b/testbot/bin/LibvirtTool.pl
@@ -6,7 +6,7 @@
# network trouble, and thus are best performed in a separate process.
#
# Copyright 2009 Ge van Geldorp
-# Copyright 2012-2019 Francois Gouget
+# Copyright 2012-2021 Francois Gouget
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -564,6 +564,27 @@ sub SetupTestAgentd($$$)
$TA->Disconnect();
}
+sub GetSnapshotConfig($)
+{
+ my ($Config) = @_;
+
+ while (1)
+ {
+ if ($Config->{base} =~ s/-([a-z]{2}-[A-Z]{2})$//)
+ {
+ $Config->{locale} = $1;
+ }
+ elsif ($Config->{base} =~ s/-(live)$//)
+ {
+ $Config->{$1} = 1;
+ }
+ else
+ {
+ last;
+ }
+ }
+}
+
sub CreateSnapshot($$)
{
my ($Domain, $SnapshotName) = @_;
@@ -591,35 +612,32 @@ sub Revert()
return 1;
}
$CurrentStatus = "reverting";
- my $DomainSnapshot = $VM->IdleSnapshot;
- my $ExtraTimeout = 0;
- my ($SetLocale, $CreateSnapshot);
+ my $Config = { base => $VM->IdleSnapshot };
my $Domain = $VM->GetDomain();
- if (($VM->Type eq "win32" or $VM->Type eq "win64") and
- !$Domain->HasSnapshot($DomainSnapshot) and
- $DomainSnapshot =~ s/-([a-z]{2})-([A-Z]{2})$//)
- {
- # Add some extra time to set up the VM locale and reboot it
- $ExtraTimeout += $VMToolTimeout;
- $SetLocale = "$1-$2";
- $CreateSnapshot = 1;
- Debug(Elapsed($Start), " $VMKey does not yet have a $DomainSnapshot-$SetLocale snapshot\n");
- }
- if (!$Domain->HasSnapshot($DomainSnapshot) and $DomainSnapshot =~ s/-live$//)
- {
- # Add some extra time to boot the VM and create the live snapshot
- $ExtraTimeout += $WaitForBoot + $VMToolTimeout / 2;
- $CreateSnapshot = 1;
- Debug(Elapsed($Start), " $VMKey does not yet have a $DomainSnapshot-live snapshot\n");
- }
- if (!$Domain->HasSnapshot($DomainSnapshot))
- {
- FatalError("Could not find $VMKey\'s $DomainSnapshot snapshot\n");
- }
- if ($ExtraTimeout)
+ if (!$Domain->HasSnapshot($Config->{base}))
{
+ $Config->{create} = 1;
+ GetSnapshotConfig($Config);
+ if ($Config->{locale} and $VM->Type !~ /^win(?:32|64)$/)
+ {
+ FatalError("Creating locale snapshots ($Config->{locale}) is not supported for ". $VM->Type ." VMs ($VMKey)\n");
+ }
+ if (!$Config->{live})
+ {
+ FatalError("Only live snapshots can be created ($VMKey)\n");
+ }
+ if (!$Domain->HasSnapshot($Config->{base}))
+ {
+ FatalError("Could not find $VMKey\'s $Config->{base} snapshot\n");
+ }
+
+ # Extend the deadline to have time to set up the VM and (re)boot it.
+ # Add $WaitForBoot even if no reboot is needed in the end.
+ my $ExtraTimeout = $WaitForBoot + $VMToolTimeout;
Debug(Elapsed($Start), " Extending the $VMKey revert deadline by ${ExtraTimeout}s\n");
+ # ChildDeadline is undefined if the VM (or another sharing the same
+ # hypervisor domain) is in maintenance mode.
my $Deadline = $VM->ChildDeadline || (time() + $VMToolTimeout);
$VM->ChildDeadline($Deadline + $ExtraTimeout);
$VM->Save();
@@ -631,8 +649,8 @@ sub Revert()
sleep(1) if (ShutDownIfOffSnapshot() == 2);
# Revert the VM (and power it on if necessary)
- Debug(Elapsed($Start), " Reverting $VMKey to $DomainSnapshot\n");
- my ($ErrMessage, $Booting) = $Domain->RevertToSnapshot($DomainSnapshot);
+ Debug(Elapsed($Start), " Reverting $VMKey to $Config->{base}\n");
+ my ($ErrMessage, $Booting) = $Domain->RevertToSnapshot($Config->{base});
if (defined $ErrMessage)
{
# Libvirt/QEmu is buggy and cannot revert a running VM from one hardware
@@ -645,40 +663,39 @@ sub Revert()
FatalError("Could not power off $VMKey: $ErrMessage\n");
}
- Debug(Elapsed($Start), " Reverting $VMKey to $DomainSnapshot... again\n");
- ($ErrMessage, $Booting) = $Domain->RevertToSnapshot($DomainSnapshot);
+ Debug(Elapsed($Start), " Reverting $VMKey to $Config->{base}... again\n");
+ ($ErrMessage, $Booting) = $Domain->RevertToSnapshot($Config->{base});
}
if (defined $ErrMessage)
{
- FatalError("Could not revert $VMKey to $DomainSnapshot: $ErrMessage\n");
+ FatalError("Could not revert $VMKey to $Config->{base}: $ErrMessage\n");
}
# Mark the VM as sleeping which allows the scheduler to abort the revert in
# favor of higher priority tasks. But don't allow interruptions in the
# middle of snapshot creation!
- if (!$CreateSnapshot)
+ if (!$Config->{create})
{
return 1 if (ChangeStatus("reverting", "sleeping"));
}
# Set up the TestAgent server. Note that setting the locale will require a
# reboot so reset start.count in that case.
- SetupTestAgentd($Booting, ($CreateSnapshot or $SetLocale), $SetLocale);
+ SetupTestAgentd($Booting, $Config->{create}, $Config->{locale});
# Set up the VM locale
- if ($SetLocale)
+ if ($Config->{locale})
{
- Debug(Elapsed($Start), " Setting up the $SetLocale locale on $VMKey\n");
- my @Cmd = ("$BinDir/SetWinLocale", $VM->Hostname, "--default", $SetLocale);
+ Debug(Elapsed($Start), " Setting up the $Config->{locale} locale on $VMKey\n");
+ my @Cmd = ("$BinDir/SetWinLocale", $VM->Hostname, "--default", $Config->{locale});
push @Cmd, "--debug" if ($Debug);
if (system(@Cmd))
{
- FatalError("Could not set the $VMKey locale to $SetLocale\n");
+ FatalError("Could not set the $VMKey locale to $Config->{locale}\n");
}
- $Booting = 1;
}
- if ($CreateSnapshot)
+ if ($Config->{create})
{
CreateSnapshot($Domain, $VM->IdleSnapshot);
Module: tools
Branch: master
Commit: 93052eced61615df6d9acf5b4d4ef455c284b119
URL: https://source.winehq.org/git/tools.git/?a=commit;h=93052eced61615df6d9acf5…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Tue Feb 15 05:03:19 2022 +0100
testbot/LibvirtTool: Skip creating the intermediate -live snapshot.
Basing the localized snapshots on the plain -live snapshot is not very
useful and skipping this intermediate step makes the code simpler.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/bin/LibvirtTool.pl | 43 +++++++++++++++++++------------------------
1 file changed, 19 insertions(+), 24 deletions(-)
diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl
index fad0727..3b2794f 100755
--- a/testbot/bin/LibvirtTool.pl
+++ b/testbot/bin/LibvirtTool.pl
@@ -603,6 +603,7 @@ sub Revert()
# Add some extra time to set up the VM locale and reboot it
$ExtraTimeout += $VMToolTimeout;
$SetLocale = "$1-$2";
+ $CreateSnapshot = 1;
Debug(Elapsed($Start), " $VMKey does not yet have a $DomainSnapshot-$SetLocale snapshot\n");
}
if (!$Domain->HasSnapshot($DomainSnapshot) and $DomainSnapshot =~ s/-live$//)
@@ -655,7 +656,7 @@ sub Revert()
# Mark the VM as sleeping which allows the scheduler to abort the revert in
# favor of higher priority tasks. But don't allow interruptions in the
# middle of snapshot creation!
- if (!$CreateSnapshot and !$SetLocale)
+ if (!$CreateSnapshot)
{
return 1 if (ChangeStatus("reverting", "sleeping"));
}
@@ -664,10 +665,22 @@ sub Revert()
# reboot so reset start.count in that case.
SetupTestAgentd($Booting, ($CreateSnapshot or $SetLocale), $SetLocale);
+ # Set up the VM locale
+ if ($SetLocale)
+ {
+ Debug(Elapsed($Start), " Setting up the $SetLocale locale on $VMKey\n");
+ my @Cmd = ("$BinDir/SetWinLocale", $VM->Hostname, "--default", $SetLocale);
+ push @Cmd, "--debug" if ($Debug);
+ if (system(@Cmd))
+ {
+ FatalError("Could not set the $VMKey locale to $SetLocale\n");
+ }
+ $Booting = 1;
+ }
+
if ($CreateSnapshot)
{
- $DomainSnapshot .= "-live";
- CreateSnapshot($Domain, $DomainSnapshot);
+ CreateSnapshot($Domain, $VM->IdleSnapshot);
if ($VM->Type eq "build" or $VM->Type eq "wine")
{
@@ -686,23 +699,11 @@ sub Revert()
Debug(Elapsed($Start), " Added a job to update and rebuild Wine on $VMKey\n");
}
}
- }
- # Set up the VM locale
- if ($SetLocale)
- {
- Debug(Elapsed($Start), " Setting up the $SetLocale locale on $VMKey\n");
- my @Cmd = ("$BinDir/SetWinLocale", $VM->Hostname, "--default", $SetLocale);
- push @Cmd, "--debug" if ($Debug);
- if (system(@Cmd))
- {
- FatalError("Could not set the $VMKey locale to $SetLocale\n");
- }
-
- $DomainSnapshot .= "-$SetLocale";
- CreateSnapshot($Domain, $DomainSnapshot);
+ # The activity monitor does not like it when VMs skip the sleeping step
+ return 1 if (ChangeStatus("reverting", "sleeping"));
}
- elsif (!$CreateSnapshot)
+ else
{
my $Sleep = ($Booting and $SleepAfterBoot > $SleepAfterRevert) ?
$SleepAfterBoot : $SleepAfterRevert;
@@ -711,12 +712,6 @@ sub Revert()
sleep($Sleep);
}
- if ($CreateSnapshot or $SetLocale)
- {
- # The activity monitor does not like it when VMs skip the sleeping step
- return 1 if (ChangeStatus("reverting", "sleeping"));
- }
-
return ChangeStatus($CurrentStatus, "idle", "done");
}
Module: tools
Branch: master
Commit: d5be151028e0dab3e1d323e4e6a0fc9be2061118
URL: https://source.winehq.org/git/tools.git/?a=commit;h=d5be151028e0dab3e1d323e…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Tue Feb 15 05:03:17 2022 +0100
testbot/LibvirtTool: Wait a bit between shutting down and reverting a VM.
Also rename ShutDown() to the more descriptive ShutDownIfOffSnapshot()
and document it.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/bin/LibvirtTool.pl | 29 ++++++++++++++++++++++-------
1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl
index a4ae7df..fad0727 100755
--- a/testbot/bin/LibvirtTool.pl
+++ b/testbot/bin/LibvirtTool.pl
@@ -279,7 +279,20 @@ sub GetPrivilegedTA($)
return $TA->SetTime() ? $TA : $VM->GetAgent(1);
}
-sub ShutDown()
+=pod
+=over 12
+
+=item C<ShutDownIfOffSnapshot()>
+
+Attempt a clean shutdown of the VM if it is running a snapshot that requests
+them (snapshot name containing '-off').
+
+Returns 0 if the shutdown failed, 2 if it was successful and 1 if the VM was
+already powered off or a shutdown was not needed.
+=back
+=cut
+
+sub ShutDownIfOffSnapshot()
{
my $Domain = $VM->GetDomain();
my $CurrentSnapshot = $Domain->GetSnapshotName();
@@ -310,7 +323,7 @@ sub ShutDown()
{
Debug(Elapsed($Start), " Successfully shut down $VMKey\n");
LogMsg "Successfully shut down $VMKey\n";
- return 1;
+ return 2;
}
sleep(1);
}
@@ -364,7 +377,7 @@ sub Monitor()
if ($IsReady and $VM->GetDomain()->IsPoweredOn())
{
# Try to perform a clean shutdown if requested
- ShutDown();
+ ShutDownIfOffSnapshot();
my $ErrMessage = $VM->GetDomain()->PowerOff();
if (defined $ErrMessage)
@@ -390,7 +403,7 @@ sub Monitor()
sub PowerOff()
{
# Try to perform a clean shutdown if requested
- ShutDown();
+ ShutDownIfOffSnapshot();
# Power off the VM no matter what its initial status is
$CurrentStatus = $VM->Status;
@@ -430,7 +443,7 @@ sub CheckOff()
if ($SnapshotName eq $VM->IdleSnapshot)
{
# Try to perform a clean shutdown if requested
- ShutDown();
+ ShutDownIfOffSnapshot();
my $ErrMessage = $VM->GetDomain()->PowerOff();
FatalError("$ErrMessage\n") if (defined $ErrMessage);
@@ -611,8 +624,10 @@ sub Revert()
$VM->Save();
}
- # Before reverting, try to perform a clean shutdown if requested
- ShutDown();
+ # Before reverting, try to perform a clean shutdown if requested.
+ # After a shutdown a small wait is also sometimes required, at least when
+ # switching from a PCI-passthrough configuration to a regular one.
+ sleep(1) if (ShutDownIfOffSnapshot() == 2);
# Revert the VM (and power it on if necessary)
Debug(Elapsed($Start), " Reverting $VMKey to $DomainSnapshot\n");
Module: wine
Branch: master
Commit: 14f8089dc1793a6c7d91d3dfe822d2f51526bbe8
URL: https://source.winehq.org/git/wine.git/?a=commit;h=14f8089dc1793a6c7d91d3df…
Author: Eric Pouech <eric.pouech(a)gmail.com>
Date: Fri Feb 11 18:49:45 2022 +0100
msacm32: Use extended structure definition for driver configuration.
1a) fixes a too short memory allocation on 64bit (DRVCONFIGINFO is 20 byte
large while only 16 bytes were allocated)
1b) incidentally, removes a bunch of GCC11 warnings (generated by 1a)
2) introduces DRVCONFIGINFOEX (note, in SDK, it's defined in mmiscapi.h;
since it doesn't exist yet in Wine, I added the structure to
mmsystem.h, where DRVCONFIGINFO already exists)
3) initializes the missing field
Note: my testing don't show on Win10's msacm32 that DRV_CONFIGURE uses the
DRVCONFIGINFOEX structure.
So, maybe (wild guess here), the extended structure is only used
when the driver is linked to some hardware.
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
dlls/msacm32/driver.c | 18 +++++++++---------
include/mmsystem.h | 6 ++++++
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/dlls/msacm32/driver.c b/dlls/msacm32/driver.c
index a8d6f3cf6d7..036461800b1 100644
--- a/dlls/msacm32/driver.c
+++ b/dlls/msacm32/driver.c
@@ -400,7 +400,7 @@ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARA
{
PWINE_ACMDRIVERID padid;
LRESULT lResult;
- LPDRVCONFIGINFO pConfigInfo = NULL;
+ LPDRVCONFIGINFOEX pConfigInfo = NULL;
LPWSTR section_name = NULL;
LPWSTR alias_name = NULL;
@@ -425,16 +425,15 @@ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARA
}
if (pAlias != NULL) {
- /* DRVCONFIGINFO is only 12 bytes long, but native msacm
- * reports a 16-byte structure to codecs, so allocate 16 bytes,
- * just to be on the safe side.
- */
- const unsigned int iStructSize = 16;
- pConfigInfo = HeapAlloc(MSACM_hHeap, 0, iStructSize);
+ pConfigInfo = HeapAlloc(MSACM_hHeap, 0, sizeof(*pConfigInfo));
if (!pConfigInfo) {
- ERR("OOM while supplying DRVCONFIGINFO for DRV_CONFIGURE, using NULL\n");
+ ERR("OOM while supplying DRVCONFIGINFOEX for DRV_CONFIGURE, using NULL\n");
} else {
- pConfigInfo->dwDCISize = iStructSize;
+ /* In some cases (seen in the 32bit world), a DRVCONFIGINFOEX struct is passed
+ * (with extended size) instead of the documented DRVCONFIGINFO.
+ * So, always pass a DRVCONFIGINFOEX to be one the safe side
+ */
+ pConfigInfo->dwDCISize = sizeof(*pConfigInfo);
section_name = HeapAlloc(MSACM_hHeap, 0, sizeof(L"Drivers32"));
if (section_name) lstrcpyW(section_name, L"Drivers32");
@@ -442,6 +441,7 @@ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARA
alias_name = HeapAlloc(MSACM_hHeap, 0, (lstrlenW(pAlias) + 1) * sizeof(WCHAR));
if (alias_name) lstrcpyW(alias_name, pAlias);
pConfigInfo->lpszDCIAliasName = alias_name;
+ pConfigInfo->dnDevNode = 0; /* FIXME */
if (pConfigInfo->lpszDCISectionName == NULL || pConfigInfo->lpszDCIAliasName == NULL) {
HeapFree(MSACM_hHeap, 0, alias_name);
diff --git a/include/mmsystem.h b/include/mmsystem.h
index 2a0782d0cb9..5684ff20683 100644
--- a/include/mmsystem.h
+++ b/include/mmsystem.h
@@ -225,6 +225,12 @@ typedef struct tagDRVCONFIGINFO {
LPCWSTR lpszDCIAliasName;
} DRVCONFIGINFO, *LPDRVCONFIGINFO;
+typedef struct tagDRVCONFIGINFOEX {
+ DWORD dwDCISize;
+ LPCWSTR lpszDCISectionName;
+ LPCWSTR lpszDCIAliasName;
+ DWORD dnDevNode;
+} DRVCONFIGINFOEX, *LPDRVCONFIGINFOEX;
LRESULT WINAPI DefDriverProc(DWORD_PTR,HDRVR,UINT,LPARAM,LPARAM);
/* this sounds odd, but it's the way it is. OpenDriverA even disappeared