Module: tools
Branch: master
Commit: 6a5e1e87900c85bd0fc60841170c8d520af0ab48
URL: https://source.winehq.org/git/tools.git/?a=commit;h=6a5e1e87900c85bd0fc6084…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Tue Sep 24 11:10:08 2019 +0200
testbot/LibvirtTool: Wait for the X session for live Wine snapshots.
The TestAgentd server may start before the X session. But we need the
latter to run the Wine tests so make sure the X session has started
before creating the live snapshot.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/bin/LibvirtTool.pl | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl
index 72075ae..d1402bc 100755
--- a/testbot/bin/LibvirtTool.pl
+++ b/testbot/bin/LibvirtTool.pl
@@ -386,6 +386,29 @@ sub CreateSnapshot($$)
{
my ($Domain, $SnapshotName) = @_;
+ if ($VM->Type eq "wine")
+ {
+ # Make sure an X session has started before taking the snapshot
+ Debug(Elapsed($Start), " Waiting for the X session\n");
+ LogMsg "Waiting for the $VMKey X session\n";
+ my $TA = $VM->GetAgent();
+ my $Pid = $TA->Run(["sh", "-c", "while ! xset -display :0.0 q >/dev/null; do sleep 1; done"], 0);
+ if (!$Pid)
+ {
+ FatalError("Could not check for the X session on the $VMKey VM\n");
+ }
+ if (!defined $TA->Wait($Pid, $SleepAfterBoot))
+ {
+ my $ErrMessage = $TA->GetLastError();
+ if ($ErrMessage =~ /timed out waiting for the child process/)
+ {
+ FatalError("Timed out waiting for the X session\n");
+ }
+ FatalError("An error occurred while waiting for the X session: $ErrMessage\n");
+ }
+ $TA->Disconnect();
+ }
+
if ($SleepAfterBoot != 0)
{
Debug(Elapsed($Start), " Sleeping for the $SnapshotName snapshot\n");
Module: tools
Branch: master
Commit: 6c6525ed9cae006e82196c35d0ac29e583356c84
URL: https://source.winehq.org/git/tools.git/?a=commit;h=6c6525ed9cae006e82196c3…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Tue Sep 24 11:10:05 2019 +0200
testbot/LibvirtTool: Create live snapshots as needed.
Live snapshots have to save the content of the VM's memory which takes
space in the disk image. They may also be specific to the host they
are running on (e.g. AMD vs. Intel CPU). And they may need to be
recreated after QEmu upgrades.
So VMs always have a powered off snapshot as reference and backups
made from the powered off state. With VMs that are configured for
autologin and autostart of TestAgentd this patch removes the need for
the administrator to manually recreate the live snapshots.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/bin/LibvirtTool.pl | 85 +++++++++++++++++++++++++++-----
testbot/lib/WineTestBot/Config.pm | 7 ++-
testbot/lib/WineTestBot/LibvirtDomain.pm | 5 +-
3 files changed, 79 insertions(+), 18 deletions(-)
diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl
index dd330a5..72075ae 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-2017 Francois Gouget
+# Copyright 2012-2019 Francois Gouget
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -382,6 +382,25 @@ sub SetupTestAgentd($$)
$TA->Disconnect();
}
+sub CreateSnapshot($$)
+{
+ my ($Domain, $SnapshotName) = @_;
+
+ if ($SleepAfterBoot != 0)
+ {
+ Debug(Elapsed($Start), " Sleeping for the $SnapshotName snapshot\n");
+ LogMsg "Letting $VMKey settle down for the $SnapshotName snapshot\n";
+ sleep($SleepAfterBoot);
+ }
+
+ Debug(Elapsed($Start), " Creating the $SnapshotName snapshot\n");
+ my $ErrMessage = $Domain->CreateSnapshot($SnapshotName);
+ if (defined $ErrMessage)
+ {
+ FatalError("Could not recreate the $SnapshotName snapshot on $VMKey: $ErrMessage\n");
+ }
+}
+
sub Revert()
{
my $VM = CreateVMs()->GetItem($VMKey);
@@ -391,11 +410,34 @@ sub Revert()
return 1;
}
$CurrentStatus = "reverting";
+ my $DomainSnapshot = $VM->IdleSnapshot;
+ my $ExtraTimeout = 0;
+ my $CreateSnapshot;
- # Revert the VM (and power it on if necessary)
my $Domain = $VM->GetDomain();
- Debug(Elapsed($Start), " Reverting $VMKey to ", $VM->IdleSnapshot, "\n");
- my ($ErrMessage, $Booting) = $Domain->RevertToSnapshot();
+ 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)
+ {
+ Debug(Elapsed($Start), " Extend the $VMKey revert deadline by $ExtraTimeout\n");
+ my $Deadline = $VM->Status eq "maintenance" ? (time() + $VMToolTimeout) :
+ $VM->ChildDeadline;
+ $VM->ChildDeadline($Deadline + $ExtraTimeout);
+ $VM->Save();
+ }
+
+ # Revert the VM (and power it on if necessary)
+ Debug(Elapsed($Start), " Reverting $VMKey to $DomainSnapshot\n");
+ my ($ErrMessage, $Booting) = $Domain->RevertToSnapshot($DomainSnapshot);
if (defined $ErrMessage)
{
# Libvirt/QEmu is buggy and cannot revert a running VM from one hardware
@@ -408,28 +450,45 @@ sub Revert()
FatalError("Could not power off $VMKey: $ErrMessage\n");
}
- Debug(Elapsed($Start), " Reverting $VMKey to ", $VM->IdleSnapshot, "... again\n");
- ($ErrMessage, $Booting) = $Domain->RevertToSnapshot();
+ Debug(Elapsed($Start), " Reverting $VMKey to $DomainSnapshot... again\n");
+ ($ErrMessage, $Booting) = $Domain->RevertToSnapshot($DomainSnapshot);
}
if (defined $ErrMessage)
{
- FatalError("Could not revert $VMKey to ". $VM->IdleSnapshot .": $ErrMessage\n");
+ FatalError("Could not revert $VMKey to $DomainSnapshot: $ErrMessage\n");
}
- # The VM is now sleeping which may allow some tasks to run
- return 1 if (ChangeStatus("reverting", "sleeping"));
+ # 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)
+ {
+ return 1 if (ChangeStatus("reverting", "sleeping"));
+ }
# Set up the TestAgent server
SetupTestAgentd($VM, $Booting);
- if ($SleepAfterRevert != 0)
+ if ($CreateSnapshot)
{
+ CreateSnapshot($Domain, $VM->IdleSnapshot);
+ }
+ else
+ {
+ my $Sleep = ($Booting and $SleepAfterBoot > $SleepAfterRevert) ?
+ $SleepAfterBoot : $SleepAfterRevert;
Debug(Elapsed($Start), " Sleeping\n");
- LogMsg "Letting ". $VM->Name ." settle down for ${SleepAfterRevert}s\n";
- sleep($SleepAfterRevert);
+ LogMsg "Letting $VMKey settle down for ${Sleep}s\n";
+ sleep($Sleep);
+ }
+
+ if ($CreateSnapshot)
+ {
+ # The activity monitor does not like it when VMs skip the sleeping step
+ return 1 if (ChangeStatus("reverting", "sleeping"));
}
- return ChangeStatus("sleeping", "idle", "done");
+ return ChangeStatus($CurrentStatus, "idle", "done");
}
diff --git a/testbot/lib/WineTestBot/Config.pm b/testbot/lib/WineTestBot/Config.pm
index 27e863c..56971b7 100644
--- a/testbot/lib/WineTestBot/Config.pm
+++ b/testbot/lib/WineTestBot/Config.pm
@@ -28,7 +28,7 @@ WineTestBot::Config - Site-independent configuration settings
use vars qw (@ISA @EXPORT @EXPORT_OK $UseSSL $LogDir $DataDir $BinDir
%RepoURLs $DbDataSource $DbUsername $DbPassword $MaxRevertingVMs
$MaxRevertsWhileRunningVMs $MaxActiveVMs $MaxRunningVMs
- $MaxVMsWhenIdle $SleepAfterRevert $WaitForBoot
+ $MaxVMsWhenIdle $WaitForBoot $SleepAfterBoot $SleepAfterRevert
$VMToolTimeout $MaxVMErrors $MaxTaskTries $AdminEMail $RobotEMail
$WinePatchToOverride $WinePatchCc
$ExeBuildNativeTimeout $ExeBuildTestTimeout $ExeModuleTimeout
@@ -44,7 +44,8 @@ require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw($UseSSL $LogDir $DataDir $BinDir %RepoURLs
$MaxRevertingVMs $MaxRevertsWhileRunningVMs $MaxActiveVMs
- $MaxRunningVMs $MaxVMsWhenIdle $SleepAfterRevert $WaitForBoot
+ $MaxRunningVMs $MaxVMsWhenIdle $WaitForBoot $SleepAfterBoot
+ $SleepAfterRevert
$VMToolTimeout $MaxVMErrors $MaxTaskTries $AdminEMail
$RobotEMail $WinePatchToOverride $WinePatchCc $SuiteTimeout
$ExeBuildNativeTimeout $ExeBuildTestTimeout $ExeModuleTimeout
@@ -92,6 +93,8 @@ $MaxVMsWhenIdle = undef;
# How long to attempt to connect to the TestAgent while the VM is booting.
$WaitForBoot = 90;
+# How long to let the VM settle down after booting it before taking a snapshot.
+$SleepAfterBoot = 30;
# How long to let the VM settle down after a revert before starting a task on
# it (in seconds).
$SleepAfterRevert = 0;
diff --git a/testbot/lib/WineTestBot/LibvirtDomain.pm b/testbot/lib/WineTestBot/LibvirtDomain.pm
index 1f70c97..14bf71d 100644
--- a/testbot/lib/WineTestBot/LibvirtDomain.pm
+++ b/testbot/lib/WineTestBot/LibvirtDomain.pm
@@ -307,11 +307,10 @@ sub GetSnapshotName($)
return (undef, $SnapshotName);
}
-sub RevertToSnapshot($)
+sub RevertToSnapshot($$)
{
- my ($self) = @_;
+ my ($self, $SnapshotName) = @_;
- my $SnapshotName = $self->{VM}->IdleSnapshot;
my ($ErrMessage, $Domain, $Snapshot) = $self->_GetSnapshot($SnapshotName);
return ($ErrMessage, undef) if (defined $ErrMessage);
Module: tools
Branch: master
Commit: 51f44f2c29d396162aa175f12394ba28e9236dc6
URL: https://source.winehq.org/git/tools.git/?a=commit;h=51f44f2c29d396162aa175f…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Tue Sep 24 11:09:49 2019 +0200
testbot/LibvirtTool: Move the TestAgentd check to a separate function.
GetVersion() is equivalent to Ping() but can be used to perform version
checks.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/bin/LibvirtTool.pl | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)
diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl
index 4635443..dd330a5 100755
--- a/testbot/bin/LibvirtTool.pl
+++ b/testbot/bin/LibvirtTool.pl
@@ -365,6 +365,23 @@ sub CheckOff()
return ChangeStatus("dirty", "off", "done");
}
+sub SetupTestAgentd($$)
+{
+ my ($VM, $Booting) = @_;
+
+ Debug(Elapsed($Start), " Setting up the $VMKey TestAgent server\n");
+ LogMsg "Setting up the $VMKey TestAgent server\n";
+ my $TA = $VM->GetAgent();
+ $TA->SetConnectTimeout(undef, undef, $WaitForBoot) if ($Booting);
+ my $Version = $TA->GetVersion();
+ if (!$Version)
+ {
+ my $ErrMessage = $TA->GetLastError();
+ FatalError("Could not connect to the $VMKey TestAgent: $ErrMessage\n");
+ }
+ $TA->Disconnect();
+}
+
sub Revert()
{
my $VM = CreateVMs()->GetItem($VMKey);
@@ -402,18 +419,8 @@ sub Revert()
# The VM is now sleeping which may allow some tasks to run
return 1 if (ChangeStatus("reverting", "sleeping"));
- # Verify that the TestAgent server accepts connections
- Debug(Elapsed($Start), " Verifying the TestAgent server\n");
- LogMsg "Verifying the $VMKey TestAgent server\n";
- my $TA = $VM->GetAgent();
- $TA->SetConnectTimeout(undef, undef, $WaitForBoot) if ($Booting);
- my $Success = $TA->Ping();
- $TA->Disconnect();
- if (!$Success)
- {
- $ErrMessage = $TA->GetLastError();
- FatalError("Cannot connect to the $VMKey TestAgent: $ErrMessage\n");
- }
+ # Set up the TestAgent server
+ SetupTestAgentd($VM, $Booting);
if ($SleepAfterRevert != 0)
{
Module: tools
Branch: master
Commit: 28c6aeaf86ddf6b8454d6ce59b5f1f16f50f4b82
URL: https://source.winehq.org/git/tools.git/?a=commit;h=28c6aeaf86ddf6b8454d6ce…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Tue Sep 24 11:06:43 2019 +0200
testbot/TestAgent: Add the restart RPC.
This is similar to the upgrade RPC but leaves out sending the new server
binary and allows changing the server command line which makes it more
flexible.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/lib/WineTestBot/TestAgent.pm | 52 ++++++++
testbot/scripts/TestAgent | 14 ++-
testbot/src/testagentd/platform.h | 2 +-
testbot/src/testagentd/platform_unix.c | 45 +++++--
testbot/src/testagentd/platform_windows.c | 199 ++++++++++++++++++++++++++++--
testbot/src/testagentd/testagentd.c | 72 ++++++++++-
6 files changed, 356 insertions(+), 28 deletions(-)
Diff: https://source.winehq.org/git/tools.git/?a=commitdiff;h=28c6aeaf86ddf6b8454…
Module: tools
Branch: master
Commit: 2d8e40dad69c325415f927d37970a7849942f6b0
URL: https://source.winehq.org/git/tools.git/?a=commit;h=2d8e40dad69c325415f927d…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Tue Sep 24 11:04:13 2019 +0200
testbot/testagentd: Fix upgrades when there is more than one server running.
On Windows the second server will keep the old executable busy,
preventing its deletion. So give up after a while.
Usually the second server will be running with --set-time-only so
upgrading it is not as important.
If necessary this condition can be detected on the client by
attempting to delete the old executable and checking for an error.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/src/testagentd/platform_windows.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/testbot/src/testagentd/platform_windows.c b/testbot/src/testagentd/platform_windows.c
index bb52a02..2d971a4 100644
--- a/testbot/src/testagentd/platform_windows.c
+++ b/testbot/src/testagentd/platform_windows.c
@@ -532,17 +532,20 @@ int platform_init(void)
{
/* This also serves to ensure the old server has released the port
* before we attempt to open our own.
+ * But if a second server is running the deletion will never work so
+ * give up after a while.
*/
+ int attempt = 0;
do
{
if (!DeleteFileA(oldtestagentd))
Sleep(500);
+ attempt++;
}
- while (GetLastError() == ERROR_ACCESS_DENIED);
+ while (GetLastError() == ERROR_ACCESS_DENIED && attempt < 20);
free(oldtestagentd);
}
-
wVersionRequested = MAKEWORD(2, 2);
rc = WSAStartup(wVersionRequested, &wsaData);
if (rc)
Module: tools
Branch: master
Commit: 51503c04fea1dd065f35b921b9a3e19dc0cd3d20
URL: https://source.winehq.org/git/tools.git/?a=commit;h=51503c04fea1dd065f35b92…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Tue Sep 24 11:01:12 2019 +0200
testbot/WineRunReconfig: Notify the administrator if recreating the snapshot failed.
It's possible that the connection to the hypervisor was lost right when
the snapshot was being recreated. The TestBot may also be able to
recreate the snapshot from the powered off base snapshot. But such
failures are rare enough to warrant an investigation.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/bin/WineRunReconfig.pl | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/testbot/bin/WineRunReconfig.pl b/testbot/bin/WineRunReconfig.pl
index 063bab2..bfbc5ab 100755
--- a/testbot/bin/WineRunReconfig.pl
+++ b/testbot/bin/WineRunReconfig.pl
@@ -518,6 +518,11 @@ if ($NewStatus eq 'completed')
# Without the snapshot the VM is not usable anymore but FatalError() will
# just mark it as 'dirty'. It's only the next time it is used that the
# problem will be noticed and that it will be taken offline.
+ NotifyAdministrator("The ". $VM->Name ." update failed",
+ "Could not recreate the $IdleSnapshot snapshot:\n\n".
+ "$ErrMessage\n\n".
+ "See the link below for more details:\n".
+ MakeSecureURL(GetTaskURL($JobId, $StepNo, $TaskNo)) ."\n");
FatalError("Could not recreate the $IdleSnapshot snapshot: $ErrMessage\n");
}
Module: tools
Branch: master
Commit: df877ab52c672562541f78fba602ea1bf123e5b0
URL: https://source.winehq.org/git/tools.git/?a=commit;h=df877ab52c672562541f78f…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Tue Sep 24 11:00:40 2019 +0200
testbot/WineRunReconfig: Notify the administrator if the build fails.
Build failures prevent the TestBot snapshot from being updated
(leading to an out-of-date Wine and patches that fail to apply)
and can typically only be fixed manually.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/bin/WineRunReconfig.pl | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/testbot/bin/WineRunReconfig.pl b/testbot/bin/WineRunReconfig.pl
index fe36ad0..063bab2 100755
--- a/testbot/bin/WineRunReconfig.pl
+++ b/testbot/bin/WineRunReconfig.pl
@@ -438,6 +438,11 @@ if ($TA->GetFile("Reconfig.log", "$TaskDir/log"))
{
# We should not have badpatch errors and if the result line is missing we
# probably already have an error message that explains why.
+ NotifyAdministrator("The ". $VM->Name ." build failed",
+ "The ". $VM->Name ." build failed:\n\n".
+ "$Summary->{Task}\n\n".
+ "See the link below for more details:\n".
+ MakeSecureURL(GetTaskURL($JobId, $StepNo, $TaskNo)) ."\n");
$NewStatus = "badbuild";
}
}