Module: tools
Branch: master
Commit: 5ae6b2f3401f9184e16b5c90884633d051d1972f
URL: https://source.winehq.org/git/tools.git/?a=commit;h=5ae6b2f3401f9184e16b5c9…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Wed Mar 28 01:44:05 2018 +0200
testbot: Allow running a second, higher privilege TestAgentd.
By convention it shall run on $AgentPort+1.
This makes it possible to run the tests in an unprivileged account,
while still having a TestAgentd server with high enough privileges to
adjust the VM clock.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/bin/WineRunTask.pl | 10 ++++++++--
testbot/lib/WineTestBot/VMs.pm | 8 +++++---
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/testbot/bin/WineRunTask.pl b/testbot/bin/WineRunTask.pl
index 88c3b58..4f69a1e 100755
--- a/testbot/bin/WineRunTask.pl
+++ b/testbot/bin/WineRunTask.pl
@@ -372,8 +372,14 @@ my $TA = $VM->GetAgent();
Debug(Elapsed($Start), " Setting the time\n");
if (!$TA->SetTime())
{
- # Not a fatal error
- LogTaskError("Unable to set the VM system time: ". $TA->GetLastError() .". Maybe the TestAgentd process is missing the required privileges.\n");
+ # Not a fatal error. Try the next port in case the VM runs a privileged
+ # TestAgentd daemon there.
+ my $PrivilegedTA = $VM->GetAgent(1);
+ if (!$PrivilegedTA->SetTime())
+ {
+ LogTaskError("Unable to set the VM system time: ". $PrivilegedTA->GetLastError() .". Maybe the TestAgentd process is missing the required privileges.\n");
+ $PrivilegedTA->Disconnect();
+ }
}
my $FileType = $Step->FileType;
diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm
index e932082..e74640b 100644
--- a/testbot/lib/WineTestBot/VMs.pm
+++ b/testbot/lib/WineTestBot/VMs.pm
@@ -208,9 +208,9 @@ sub GetDomain($)
return LibvirtDomain->new($self);
}
-sub GetAgent($)
+sub GetAgent($;$)
{
- my ($self) = @_;
+ my ($self, $Privileged) = @_;
# Use either the tunnel specified in the configuration file
# or autodetect the settings based on the VM's VirtURI setting.
@@ -226,7 +226,9 @@ sub GetAgent($)
$TunnelInfo->{sshport} = $ParsedURI->port;
$TunnelInfo->{username} = $ParsedURI->userinfo;
}
- return TestAgent->new($self->Hostname, $AgentPort, $TunnelInfo);
+ my $Port = $AgentPort;
+ $Port++ if ($Privileged);
+ return TestAgent->new($self->Hostname, $Port, $TunnelInfo);
}
sub Status($;$)